LensLoader
atmosphere.LensLoader(client)
Loads lens records from ATProto.
This class fetches lens transformation records. Note that actually using a lens requires installing the referenced code and importing it manually.
Examples
>>> client = AtmosphereClient()
>>> loader = LensLoader(client)
>>>
>>> record = loader.get("at://did:plc:abc/ac.foundation.dataset.lens/xyz")
>>> print(record["name"])
>>> print(record["sourceSchema"])
>>> print(record.get("getterCode", {}).get("repository"))
Methods
| find_by_schemas |
Find lenses that transform between specific schemas. |
| get |
Fetch a lens record by AT URI. |
| list_all |
List lens records from a repository. |
find_by_schemas
atmosphere.LensLoader.find_by_schemas(
source_schema_uri,
target_schema_uri=None,
repo=None,
)
Find lenses that transform between specific schemas.
Parameters
| source_schema_uri |
str |
AT URI of the source schema. |
required |
| target_schema_uri |
Optional[str] |
Optional AT URI of the target schema. If not provided, returns all lenses from the source. |
None |
| repo |
Optional[str] |
The DID of the repository to search. |
None |
Returns
|
list[dict] |
List of matching lens records. |
get
atmosphere.LensLoader.get(uri)
Fetch a lens record by AT URI.
Parameters
| uri |
str | AtUri |
The AT URI of the lens record. |
required |
Returns
|
dict |
The lens record as a dictionary. |
list_all
atmosphere.LensLoader.list_all(repo=None, limit=100)
List lens records from a repository.
Parameters
| repo |
Optional[str] |
The DID of the repository. Defaults to authenticated user. |
None |
| limit |
int |
Maximum number of records to return. |
100 |