chitose.com.atproto.repo package#
Submodules#
chitose.com.atproto.repo.apply_writes module#
- class chitose.com.atproto.repo.apply_writes.Create(collection: str, value: Any, rkey: str | None = None)#
Bases:
ObjectOperation which creates a new record.
- to_dict() dict[str, Any]#
- class chitose.com.atproto.repo.apply_writes.CreateResult(uri: str, cid: str, validation_status: Literal['valid', 'unknown'] | None = None)#
Bases:
Object- to_dict() dict[str, Any]#
- class chitose.com.atproto.repo.apply_writes.Delete(collection: str, rkey: str)#
Bases:
ObjectOperation which deletes an existing record.
- to_dict() dict[str, Any]#
chitose.com.atproto.repo.create_record module#
chitose.com.atproto.repo.defs module#
chitose.com.atproto.repo.delete_record module#
chitose.com.atproto.repo.describe_repo module#
chitose.com.atproto.repo.get_record module#
chitose.com.atproto.repo.import_repo module#
chitose.com.atproto.repo.list_missing_blobs module#
chitose.com.atproto.repo.list_records module#
chitose.com.atproto.repo.put_record module#
chitose.com.atproto.repo.strong_ref module#
A URI with a content-hash fingerprint.
chitose.com.atproto.repo.upload_blob module#
Module contents#
- class chitose.com.atproto.repo.Repo_(call: Callable[[str, list[tuple[str, str | None | int | list[str]]], bytes | dict[str, Any] | None, dict[str, str]], bytes], subscribe: Callable[[str, list[tuple[str, str | None | int | list[str]]], Callable[[str | bytes], None]], None])#
Bases:
objectWe recommend calling methods in this class via the chitose.BskyAgent class instead of creating instances of this class directly.
- apply_writes(repo: str, writes: list[Create | Update | Delete], validate: bool | None = None, swap_commit: str | None = None) bytes#
Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.
- Parameters:
repo – The handle or DID of the repo (aka, current account).
validate – Can be set to ‘false’ to skip Lexicon schema validation of record data across all operations, ‘true’ to require it, or leave unset to validate only for known Lexicons.
swap_commit – If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations.
- create_record(repo: str, collection: str, record: Any, rkey: str | None = None, validate: bool | None = None, swap_commit: str | None = None) bytes#
Create a single new repository record. Requires auth, implemented by PDS.
- Parameters:
repo – The handle or DID of the repo (aka, current account).
collection – The NSID of the record collection.
record – The record itself. Must contain a $type field.
rkey – The Record Key.
validate – Can be set to ‘false’ to skip Lexicon schema validation of record data, ‘true’ to require it, or leave unset to validate only for known Lexicons.
swap_commit – Compare and swap with the previous commit by CID.
- delete_record(repo: str, collection: str, rkey: str, swap_record: str | None = None, swap_commit: str | None = None) bytes#
Delete a repository record, or ensure it doesn’t exist. Requires auth, implemented by PDS.
- Parameters:
repo – The handle or DID of the repo (aka, current account).
collection – The NSID of the record collection.
rkey – The Record Key.
swap_record – Compare and swap with the previous record by CID.
swap_commit – Compare and swap with the previous commit by CID.
- describe_repo(repo: str) bytes#
Get information about an account and repository, including the list of collections. Does not require auth.
- Parameters:
repo – The handle or DID of the repo.
- get_record(repo: str, collection: str, rkey: str, cid: str | None = None) bytes#
Get a single record from a repository. Does not require auth.
- Parameters:
repo – The handle or DID of the repo.
collection – The NSID of the record collection.
rkey – The Record Key.
cid – The CID of the version of the record. If not specified, then return the most recent version.
- import_repo(input_: bytes) bytes#
Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.
- list_missing_blobs(limit: int | None = None, cursor: str | None = None) bytes#
Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.
- list_records(repo: str, collection: str, limit: int | None = None, cursor: str | None = None, rkey_start: str | None = None, rkey_end: str | None = None, reverse: bool | None = None) bytes#
List a range of records in a repository, matching a specific collection. Does not require auth.
- Parameters:
repo – The handle or DID of the repo.
collection – The NSID of the record type.
limit – The number of records to return.
rkey_start – DEPRECATED: The lowest sort-ordered rkey to start from (exclusive)
rkey_end – DEPRECATED: The highest sort-ordered rkey to stop at (exclusive)
reverse – Flag to reverse the order of the returned records.
- put_record(repo: str, collection: str, rkey: str, record: Any, validate: bool | None = None, swap_record: str | None = None, swap_commit: str | None = None) bytes#
Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.
- Parameters:
repo – The handle or DID of the repo (aka, current account).
collection – The NSID of the record collection.
rkey – The Record Key.
record – The record to write.
validate – Can be set to ‘false’ to skip Lexicon schema validation of record data, ‘true’ to require it, or leave unset to validate only for known Lexicons.
swap_record – Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation
swap_commit – Compare and swap with the previous commit by CID.
- upload_blob(input_: bytes) bytes#
Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.