SchemaLoader

atmosphere.SchemaLoader(client)

Loads PackableSample schemas from ATProto.

This class fetches schema records from ATProto and can list available schemas from a repository.

Examples

>>> atmo = Atmosphere.login("handle", "password")
>>>
>>> loader = SchemaLoader(atmo)
>>> schema = loader.get("at://did:plc:.../ac.foundation.dataset.schema/...")
>>> print(schema["name"])
'MySample'

Methods

Name Description
get Fetch a schema record by AT URI.
get_typed Fetch a schema record and return as a typed object.
list_all List schema records from a repository.

get

atmosphere.SchemaLoader.get(uri)

Fetch a schema record by AT URI.

Parameters

Name Type Description Default
uri str | AtUri The AT URI of the schema record. required

Returns

Name Type Description
dict The schema record as a dictionary.

Raises

Name Type Description
ValueError If the record is not a schema record.
atproto.exceptions.AtProtocolError If record not found.

get_typed

atmosphere.SchemaLoader.get_typed(uri)

Fetch a schema record and return as a typed object.

Parameters

Name Type Description Default
uri str | AtUri The AT URI of the schema record. required

Returns

Name Type Description
LexSchemaRecord LexSchemaRecord instance.

list_all

atmosphere.SchemaLoader.list_all(repo=None, limit=100)

List schema records from a repository.

Parameters

Name Type Description Default
repo Optional[str] The DID of the repository. Defaults to authenticated user. None
limit int Maximum number of records to return. 100

Returns

Name Type Description
list[dict] List of schema records.