models
Code-generated AT Protocol models and service bindings. Kotlin Multiplatform (JVM + iOS). This is what downstream consumers depend on to call Bluesky and atproto endpoints.
What's in here
Everything under this module is emitted by :generator at build time from the upstream @atproto/lex lexicon corpus. You won't find a src/commonMain/ — the sources live under build/generated/source/lexicon/ and flow through to the published jar.
Per lexicon NSID, the generator emits:
Record types — data classes like
Post,Like,Follow,Profile,Generatorfor everyrecordlexicon definition.Request / response pairs —
GetTimelineRequest+GetTimelineResponse, etc., for everyqueryandprocedure.<Namespace>Service— classes likeFeedService,ActorService,GraphService,RepoServicethat wrap anXrpcClientand expose every NSID as asuspend fun.Open unions — sealed interfaces like
PostViewEmbed,Reason,RecordViewRecordUnionwith a data-class arm per known$typeplus anUnknownfallback for unknown variants.*Flow()/*PageFlow()extensions — cursor pagination convenience functions on service classes, auto-generated for every paginated query.Typed string formats — the generator uses the value classes from
runtime(Did,Handle,AtUri, …) for fields declared with those formats in the lexicon.
How regeneration works
The :generator:generateModels Gradle task regenerates this module's sources from generator/lexicons/. It runs automatically before every compileKotlin* task on :models and is Gradle-incremental — idle when lexicons haven't changed.
Do not edit generated sources
Files under models/build/generated/ and the published models-<version>.jar are the output of KotlinPoet emitters in the generator. Incorrect output is a generator bug — open an issue at kikin81/atproto-kotlin.
Versioning
Bumped automatically on every feat: or fix: commit to main via semantic-release. New @atproto/lex releases land via an auto-generated PR (see lexicon-drift-automation) and cut a release when merged.