From 11c601959bb73b1b2d5f189d7734b8609cfc1b69 Mon Sep 17 00:00:00 2001 From: mnogu <127841+mnogu@users.noreply.github.com> Date: Sun, 8 Sep 2024 09:46:06 +0000 Subject: [PATCH] Update atproto --- atproto | 2 +- chitose/app/bsky/actor/__init__.py | 44 ++--- chitose/app/bsky/feed/__init__.py | 110 +++++------ chitose/app/bsky/graph/__init__.py | 104 +++++------ chitose/app/bsky/notification/__init__.py | 24 +-- chitose/app/bsky/unspecced/__init__.py | 56 +++--- chitose/chat/bsky/actor/__init__.py | 8 +- chitose/chat/bsky/convo/__init__.py | 44 ++--- chitose/chat/bsky/moderation/__init__.py | 10 +- chitose/com/atproto/admin/__init__.py | 66 +++---- chitose/com/atproto/identity/__init__.py | 36 ++-- chitose/com/atproto/label/__init__.py | 18 +- chitose/com/atproto/repo/__init__.py | 84 ++++----- chitose/com/atproto/server/__init__.py | 172 +++++++++--------- chitose/com/atproto/sync/__init__.py | 88 ++++----- chitose/com/atproto/temp/__init__.py | 10 +- chitose/tools/ozone/communication/__init__.py | 24 ++- .../ozone/communication/create_template.py | 6 +- chitose/tools/ozone/communication/defs.py | 7 +- .../ozone/communication/update_template.py | 6 +- chitose/tools/ozone/moderation/__init__.py | 76 ++++---- chitose/tools/ozone/moderation/emit_event.py | 2 +- chitose/tools/ozone/team/__init__.py | 16 +- 23 files changed, 512 insertions(+), 501 deletions(-) diff --git a/atproto b/atproto index bfbac24..6c1ec14 160000 --- a/atproto +++ b/atproto @@ -1 +1 @@ -Subproject commit bfbac2431214a0c96dad104e7310ea10c863ac08 +Subproject commit 6c1ec149cf4046aa2c1345a6104bc7630e9659b6 diff --git a/chitose/app/bsky/actor/__init__.py b/chitose/app/bsky/actor/__init__.py index 0ee1109..8a89d91 100644 --- a/chitose/app/bsky/actor/__init__.py +++ b/chitose/app/bsky/actor/__init__.py @@ -19,20 +19,6 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def search_actors_typeahead(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None) -> bytes: - """Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. - - - :param term: DEPRECATED: use 'q' instead. - - :param q: Search query prefix; not a full query string. - """ - return _search_actors_typeahead(self.call, term, q, limit) - - def put_preferences(self, preferences: chitose.app.bsky.actor.defs.Preferences) -> bytes: - """Set the private preferences attached to the account.""" - return _put_preferences(self.call, preferences) - def get_profile(self, actor: str) -> bytes: """Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth. @@ -41,10 +27,6 @@ def get_profile(self, actor: str) -> bytes: """ return _get_profile(self.call, actor) - def get_suggestions(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding.""" - return _get_suggestions(self.call, limit, cursor) - def search_actors(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Find actors (profiles) matching search criteria. Does not require auth. @@ -55,10 +37,28 @@ def search_actors(self, term: typing.Optional[str]=None, q: typing.Optional[str] """ return _search_actors(self.call, term, q, limit, cursor) - def get_profiles(self, actors: list[str]) -> bytes: - """Get detailed profile views of multiple actors.""" - return _get_profiles(self.call, actors) + def search_actors_typeahead(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None) -> bytes: + """Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth. + + + :param term: DEPRECATED: use 'q' instead. + + :param q: Search query prefix; not a full query string. + """ + return _search_actors_typeahead(self.call, term, q, limit) + + def get_suggestions(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding.""" + return _get_suggestions(self.call, limit, cursor) def get_preferences(self) -> bytes: """Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth.""" - return _get_preferences(self.call) \ No newline at end of file + return _get_preferences(self.call) + + def put_preferences(self, preferences: chitose.app.bsky.actor.defs.Preferences) -> bytes: + """Set the private preferences attached to the account.""" + return _put_preferences(self.call, preferences) + + def get_profiles(self, actors: list[str]) -> bytes: + """Get detailed profile views of multiple actors.""" + return _get_profiles(self.call, actors) \ No newline at end of file diff --git a/chitose/app/bsky/feed/__init__.py b/chitose/app/bsky/feed/__init__.py index 8ab8961..19b151c 100644 --- a/chitose/app/bsky/feed/__init__.py +++ b/chitose/app/bsky/feed/__init__.py @@ -34,33 +34,33 @@ def send_interactions(self, interactions: list[chitose.app.bsky.feed.defs.Intera """Send information about interactions with feed items back to the feed generator that served them.""" return _send_interactions(self.call, interactions) - def get_feed_generators(self, feeds: list[str]) -> bytes: - """Get information about a list of feed generators.""" - return _get_feed_generators(self.call, feeds) - - def get_timeline(self, algorithm: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. + def get_author_feed(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, filter: typing.Optional[typing.Literal['posts_with_replies', 'posts_no_replies', 'posts_with_media', 'posts_and_author_threads']]=None) -> bytes: + """Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. - :param algorithm: Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. + :param filter: Combinations of post/repost types to include in response. """ - return _get_timeline(self.call, algorithm, limit, cursor) - - def get_feed_generator(self, feed: str) -> bytes: - """Get information about a feed generator. Implemented by AppView. + return _get_author_feed(self.call, actor, limit, cursor, filter) + def get_post_thread(self, uri: str, depth: typing.Optional[int]=None, parent_height: typing.Optional[int]=None) -> bytes: + """Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. - :param feed: AT-URI of the feed generator record. - """ - return _get_feed_generator(self.call, feed) - def get_author_feed(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, filter: typing.Optional[typing.Literal['posts_with_replies', 'posts_no_replies', 'posts_with_media', 'posts_and_author_threads']]=None) -> bytes: - """Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth. + :param uri: Reference (AT-URI) to post record. + :param depth: How many levels of reply depth should be included in response. - :param filter: Combinations of post/repost types to include in response. + :param parent_height: How many levels of parent (and grandparent, etc) post to include. """ - return _get_author_feed(self.call, actor, limit, cursor, filter) + return _get_post_thread(self.call, uri, depth, parent_height) + + def get_feed(self, feed: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a hydrated feed from an actor's selected feed generator. Implemented by App View.""" + return _get_feed(self.call, feed, limit, cursor) + + def describe_feed_generator(self) -> bytes: + """Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View).""" + return _describe_feed_generator(self.call) def get_likes(self, uri: str, cid: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Get like records which reference a subject (by AT-URI and CID). @@ -72,21 +72,21 @@ def get_likes(self, uri: str, cid: typing.Optional[str]=None, limit: typing.Opti """ return _get_likes(self.call, uri, cid, limit, cursor) - def get_post_thread(self, uri: str, depth: typing.Optional[int]=None, parent_height: typing.Optional[int]=None) -> bytes: - """Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests. + def get_list_feed(self, list: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. - :param uri: Reference (AT-URI) to post record. + :param list: Reference (AT-URI) to the list record. + """ + return _get_list_feed(self.call, list, limit, cursor) - :param depth: How many levels of reply depth should be included in response. + def get_timeline(self, algorithm: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed. - :param parent_height: How many levels of parent (and grandparent, etc) post to include. - """ - return _get_post_thread(self.call, uri, depth, parent_height) - def get_actor_likes(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a list of posts liked by an actor. Requires auth, actor must be the requesting account.""" - return _get_actor_likes(self.call, actor, limit, cursor) + :param algorithm: Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism. + """ + return _get_timeline(self.call, algorithm, limit, cursor) def get_reposted_by(self, uri: str, cid: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Get a list of reposts for a given post. @@ -98,10 +98,6 @@ def get_reposted_by(self, uri: str, cid: typing.Optional[str]=None, limit: typin """ return _get_reposted_by(self.call, uri, cid, limit, cursor) - def describe_feed_generator(self) -> bytes: - """Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View).""" - return _describe_feed_generator(self.call) - def search_posts(self, q: str, sort: typing.Optional[typing.Literal['top', 'latest']]=None, since: typing.Optional[str]=None, until: typing.Optional[str]=None, mentions: typing.Optional[str]=None, author: typing.Optional[str]=None, lang: typing.Optional[str]=None, domain: typing.Optional[str]=None, url: typing.Optional[str]=None, tag: typing.Optional[list[str]]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Find posts matching search criteria, returning views of those posts. @@ -130,6 +126,14 @@ def search_posts(self, q: str, sort: typing.Optional[typing.Literal['top', 'late """ return _search_posts(self.call, q, sort, since, until, mentions, author, lang, domain, url, tag, limit, cursor) + def get_actor_likes(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a list of posts liked by an actor. Requires auth, actor must be the requesting account.""" + return _get_actor_likes(self.call, actor, limit, cursor) + + def get_feed_generators(self, feeds: list[str]) -> bytes: + """Get information about a list of feed generators.""" + return _get_feed_generators(self.call, feeds) + def get_posts(self, uris: list[str]) -> bytes: """Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'. @@ -138,20 +142,6 @@ def get_posts(self, uris: list[str]) -> bytes: """ return _get_posts(self.call, uris) - def get_feed(self, feed: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a hydrated feed from an actor's selected feed generator. Implemented by App View.""" - return _get_feed(self.call, feed, limit, cursor) - - def get_quotes(self, uri: str, cid: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a list of quotes for a given post. - - - :param uri: Reference (AT-URI) of post record - - :param cid: If supplied, filters to quotes of specific version (by CID) of the post record. - """ - return _get_quotes(self.call, uri, cid, limit, cursor) - def get_feed_skeleton(self, feed: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service. @@ -160,18 +150,28 @@ def get_feed_skeleton(self, feed: str, limit: typing.Optional[int]=None, cursor: """ return _get_feed_skeleton(self.call, feed, limit, cursor) - def get_list_feed(self, list: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth. - - - :param list: Reference (AT-URI) to the list record. - """ - return _get_list_feed(self.call, list, limit, cursor) - def get_suggested_feeds(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Get a list of suggested feeds (feed generators) for the requesting account.""" return _get_suggested_feeds(self.call, limit, cursor) def get_actor_feeds(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Get a list of feeds (feed generator records) created by the actor (in the actor's repo).""" - return _get_actor_feeds(self.call, actor, limit, cursor) \ No newline at end of file + return _get_actor_feeds(self.call, actor, limit, cursor) + + def get_feed_generator(self, feed: str) -> bytes: + """Get information about a feed generator. Implemented by AppView. + + + :param feed: AT-URI of the feed generator record. + """ + return _get_feed_generator(self.call, feed) + + def get_quotes(self, uri: str, cid: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a list of quotes for a given post. + + + :param uri: Reference (AT-URI) of post record + + :param cid: If supplied, filters to quotes of specific version (by CID) of the post record. + """ + return _get_quotes(self.call, uri, cid, limit, cursor) \ No newline at end of file diff --git a/chitose/app/bsky/graph/__init__.py b/chitose/app/bsky/graph/__init__.py index 854aaaa..83a20cb 100644 --- a/chitose/app/bsky/graph/__init__.py +++ b/chitose/app/bsky/graph/__init__.py @@ -31,41 +31,13 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def get_starter_packs(self, uris: list[str]) -> bytes: - """Get views for a list of starter packs.""" - return _get_starter_packs(self.call, uris) - - def get_suggested_follows_by_actor(self, actor: str) -> bytes: - """Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account.""" - return _get_suggested_follows_by_actor(self.call, actor) - - def unmute_actor_list(self, list: str) -> bytes: - """Unmutes the specified list of accounts. Requires auth.""" - return _unmute_actor_list(self.call, list) - - def get_list_blocks(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get mod lists that the requesting account (actor) is blocking. Requires auth.""" - return _get_list_blocks(self.call, limit, cursor) - - def get_starter_pack(self, starter_pack: str) -> bytes: - """Gets a view of a starter pack. - - - :param starter_pack: Reference (AT-URI) of the starter pack record. - """ - return _get_starter_pack(self.call, starter_pack) - - def mute_actor_list(self, list: str) -> bytes: - """Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth.""" - return _mute_actor_list(self.call, list) - - def mute_thread(self, root: str) -> bytes: - """Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth.""" - return _mute_thread(self.call, root) + def get_list_mutes(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth.""" + return _get_list_mutes(self.call, limit, cursor) - def get_actor_starter_packs(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Get a list of starter packs created by the actor.""" - return _get_actor_starter_packs(self.call, actor, limit, cursor) + def get_mutes(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Enumerates accounts that the requesting account (actor) currently has muted. Requires auth.""" + return _get_mutes(self.call, limit, cursor) def get_lists(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Enumerates the lists created by a specified account (actor). @@ -75,38 +47,70 @@ def get_lists(self, actor: str, limit: typing.Optional[int]=None, cursor: typing """ return _get_lists(self.call, actor, limit, cursor) - def get_followers(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Enumerates accounts which follow a specified account (actor).""" - return _get_followers(self.call, actor, limit, cursor) - def unmute_thread(self, root: str) -> bytes: """Unmutes the specified thread. Requires auth.""" return _unmute_thread(self.call, root) + def mute_thread(self, root: str) -> bytes: + """Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth.""" + return _mute_thread(self.call, root) + def mute_actor(self, actor: str) -> bytes: """Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth.""" return _mute_actor(self.call, actor) - def get_mutes(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Enumerates accounts that the requesting account (actor) currently has muted. Requires auth.""" - return _get_mutes(self.call, limit, cursor) + def mute_actor_list(self, list: str) -> bytes: + """Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth.""" + return _mute_actor_list(self.call, list) + + def get_suggested_follows_by_actor(self, actor: str) -> bytes: + """Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account.""" + return _get_suggested_follows_by_actor(self.call, actor) + + def get_list_blocks(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get mod lists that the requesting account (actor) is blocking. Requires auth.""" + return _get_list_blocks(self.call, limit, cursor) def get_known_followers(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Enumerates accounts which follow a specified account (actor) and are followed by the viewer.""" return _get_known_followers(self.call, actor, limit, cursor) - def get_list_mutes(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth.""" - return _get_list_mutes(self.call, limit, cursor) - - def get_follows(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Enumerates accounts which a specified account (actor) follows.""" - return _get_follows(self.call, actor, limit, cursor) + def get_followers(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Enumerates accounts which follow a specified account (actor).""" + return _get_followers(self.call, actor, limit, cursor) def get_blocks(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Enumerates which accounts the requesting account is currently blocking. Requires auth.""" return _get_blocks(self.call, limit, cursor) + def unmute_actor_list(self, list: str) -> bytes: + """Unmutes the specified list of accounts. Requires auth.""" + return _unmute_actor_list(self.call, list) + + def get_actor_starter_packs(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Get a list of starter packs created by the actor.""" + return _get_actor_starter_packs(self.call, actor, limit, cursor) + + def get_starter_packs(self, uris: list[str]) -> bytes: + """Get views for a list of starter packs.""" + return _get_starter_packs(self.call, uris) + + def unmute_actor(self, actor: str) -> bytes: + """Unmutes the specified account. Requires auth.""" + return _unmute_actor(self.call, actor) + + def get_starter_pack(self, starter_pack: str) -> bytes: + """Gets a view of a starter pack. + + + :param starter_pack: Reference (AT-URI) of the starter pack record. + """ + return _get_starter_pack(self.call, starter_pack) + + def get_follows(self, actor: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Enumerates accounts which a specified account (actor) follows.""" + return _get_follows(self.call, actor, limit, cursor) + def get_relationships(self, actor: str, others: typing.Optional[list[str]]=None) -> bytes: """Enumerates public relationships between one account, and a list of other accounts. Does not require auth. @@ -117,10 +121,6 @@ def get_relationships(self, actor: str, others: typing.Optional[list[str]]=None) """ return _get_relationships(self.call, actor, others) - def unmute_actor(self, actor: str) -> bytes: - """Unmutes the specified account. Requires auth.""" - return _unmute_actor(self.call, actor) - def get_list(self, list: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Gets a 'view' (with additional context) of a specified list. diff --git a/chitose/app/bsky/notification/__init__.py b/chitose/app/bsky/notification/__init__.py index 72c75f0..53dd9f9 100644 --- a/chitose/app/bsky/notification/__init__.py +++ b/chitose/app/bsky/notification/__init__.py @@ -16,22 +16,22 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def register_push(self, service_did: str, token: str, platform: typing.Literal['ios', 'android', 'web'], app_id: str) -> bytes: - """Register to receive push notifications, via a specified service, for the requesting account. Requires auth.""" - return _register_push(self.call, service_did, token, platform, app_id) + def get_unread_count(self, priority: typing.Optional[bool]=None, seen_at: typing.Optional[str]=None) -> bytes: + """Count the number of unread notifications for the requesting account. Requires auth.""" + return _get_unread_count(self.call, priority, seen_at) - def put_preferences(self, priority: bool) -> bytes: - """Set notification-related preferences for an account. Requires auth.""" - return _put_preferences(self.call, priority) + def list_notifications(self, limit: typing.Optional[int]=None, priority: typing.Optional[bool]=None, cursor: typing.Optional[str]=None, seen_at: typing.Optional[str]=None) -> bytes: + """Enumerate notifications for the requesting account. Requires auth.""" + return _list_notifications(self.call, limit, priority, cursor, seen_at) def update_seen(self, seen_at: str) -> bytes: """Notify server that the requesting account has seen notifications. Requires auth.""" return _update_seen(self.call, seen_at) - def list_notifications(self, limit: typing.Optional[int]=None, priority: typing.Optional[bool]=None, cursor: typing.Optional[str]=None, seen_at: typing.Optional[str]=None) -> bytes: - """Enumerate notifications for the requesting account. Requires auth.""" - return _list_notifications(self.call, limit, priority, cursor, seen_at) + def put_preferences(self, priority: bool) -> bytes: + """Set notification-related preferences for an account. Requires auth.""" + return _put_preferences(self.call, priority) - def get_unread_count(self, priority: typing.Optional[bool]=None, seen_at: typing.Optional[str]=None) -> bytes: - """Count the number of unread notifications for the requesting account. Requires auth.""" - return _get_unread_count(self.call, priority, seen_at) \ No newline at end of file + def register_push(self, service_did: str, token: str, platform: typing.Literal['ios', 'android', 'web'], app_id: str) -> bytes: + """Register to receive push notifications, via a specified service, for the requesting account. Requires auth.""" + return _register_push(self.call, service_did, token, platform, app_id) \ No newline at end of file diff --git a/chitose/app/bsky/unspecced/__init__.py b/chitose/app/bsky/unspecced/__init__.py index 65105ec..58195fa 100644 --- a/chitose/app/bsky/unspecced/__init__.py +++ b/chitose/app/bsky/unspecced/__init__.py @@ -16,29 +16,9 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def search_actors_skeleton(self, q: str, viewer: typing.Optional[str]=None, typeahead: typing.Optional[bool]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Backend Actors (profile) search, returns only skeleton. - - - :param q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. - - :param viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. - - :param typeahead: If true, acts as fast/simple 'typeahead' query. - - :param cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. - """ - return _search_actors_skeleton(self.call, q, viewer, typeahead, limit, cursor) - - def get_suggestions_skeleton(self, viewer: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, relative_to_did: typing.Optional[str]=None) -> bytes: - """Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions - - - :param viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. - - :param relative_to_did: DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. - """ - return _get_suggestions_skeleton(self.call, viewer, limit, cursor, relative_to_did) + def get_tagged_suggestions(self) -> bytes: + """Get a list of suggestions (feeds and users) tagged with categories""" + return _get_tagged_suggestions(self.call) def search_posts_skeleton(self, q: str, sort: typing.Optional[typing.Literal['top', 'latest']]=None, since: typing.Optional[str]=None, until: typing.Optional[str]=None, mentions: typing.Optional[str]=None, author: typing.Optional[str]=None, lang: typing.Optional[str]=None, domain: typing.Optional[str]=None, url: typing.Optional[str]=None, tag: typing.Optional[list[str]]=None, viewer: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Backend Posts search, returns only skeleton @@ -70,10 +50,30 @@ def search_posts_skeleton(self, q: str, sort: typing.Optional[typing.Literal['to """ return _search_posts_skeleton(self.call, q, sort, since, until, mentions, author, lang, domain, url, tag, viewer, limit, cursor) + def get_suggestions_skeleton(self, viewer: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, relative_to_did: typing.Optional[str]=None) -> bytes: + """Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions + + + :param viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. + + :param relative_to_did: DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer. + """ + return _get_suggestions_skeleton(self.call, viewer, limit, cursor, relative_to_did) + + def search_actors_skeleton(self, q: str, viewer: typing.Optional[str]=None, typeahead: typing.Optional[bool]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Backend Actors (profile) search, returns only skeleton. + + + :param q: Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax. + + :param viewer: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. + + :param typeahead: If true, acts as fast/simple 'typeahead' query. + + :param cursor: Optional pagination mechanism; may not necessarily allow scrolling through entire result set. + """ + return _search_actors_skeleton(self.call, q, viewer, typeahead, limit, cursor) + def get_popular_feed_generators(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, query: typing.Optional[str]=None) -> bytes: """An unspecced view of globally popular feed generators.""" - return _get_popular_feed_generators(self.call, limit, cursor, query) - - def get_tagged_suggestions(self) -> bytes: - """Get a list of suggestions (feeds and users) tagged with categories""" - return _get_tagged_suggestions(self.call) \ No newline at end of file + return _get_popular_feed_generators(self.call, limit, cursor, query) \ No newline at end of file diff --git a/chitose/chat/bsky/actor/__init__.py b/chitose/chat/bsky/actor/__init__.py index 18bb4ea..43c358f 100644 --- a/chitose/chat/bsky/actor/__init__.py +++ b/chitose/chat/bsky/actor/__init__.py @@ -12,10 +12,10 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def export_account_data(self) -> bytes: + def delete_account(self) -> bytes: """""" - return _export_account_data(self.call) + return _delete_account(self.call) - def delete_account(self) -> bytes: + def export_account_data(self) -> bytes: """""" - return _delete_account(self.call) \ No newline at end of file + return _export_account_data(self.call) \ No newline at end of file diff --git a/chitose/chat/bsky/convo/__init__.py b/chitose/chat/bsky/convo/__init__.py index cd66f58..97f5626 100644 --- a/chitose/chat/bsky/convo/__init__.py +++ b/chitose/chat/bsky/convo/__init__.py @@ -25,50 +25,50 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def list_convos(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """""" - return _list_convos(self.call, limit, cursor) - - def unmute_convo(self, convo_id: str) -> bytes: - """""" - return _unmute_convo(self.call, convo_id) - - def get_log(self, cursor: typing.Optional[str]=None) -> bytes: - """""" - return _get_log(self.call, cursor) - - def send_message(self, convo_id: str, message: chitose.chat.bsky.convo.defs.MessageInput) -> bytes: + def send_message_batch(self, items: list[chitose.chat.bsky.convo.send_message_batch.BatchItem]) -> bytes: """""" - return _send_message(self.call, convo_id, message) + return _send_message_batch(self.call, items) def leave_convo(self, convo_id: str) -> bytes: """""" return _leave_convo(self.call, convo_id) - def mute_convo(self, convo_id: str) -> bytes: + def get_convo_for_members(self, members: list[str]) -> bytes: """""" - return _mute_convo(self.call, convo_id) + return _get_convo_for_members(self.call, members) - def delete_message_for_self(self, convo_id: str, message_id: str) -> bytes: + def list_convos(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """""" - return _delete_message_for_self(self.call, convo_id, message_id) + return _list_convos(self.call, limit, cursor) def update_read(self, convo_id: str, message_id: typing.Optional[str]=None) -> bytes: """""" return _update_read(self.call, convo_id, message_id) + def unmute_convo(self, convo_id: str) -> bytes: + """""" + return _unmute_convo(self.call, convo_id) + def get_convo(self, convo_id: str) -> bytes: """""" return _get_convo(self.call, convo_id) + def delete_message_for_self(self, convo_id: str, message_id: str) -> bytes: + """""" + return _delete_message_for_self(self.call, convo_id, message_id) + + def mute_convo(self, convo_id: str) -> bytes: + """""" + return _mute_convo(self.call, convo_id) + def get_messages(self, convo_id: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """""" return _get_messages(self.call, convo_id, limit, cursor) - def get_convo_for_members(self, members: list[str]) -> bytes: + def get_log(self, cursor: typing.Optional[str]=None) -> bytes: """""" - return _get_convo_for_members(self.call, members) + return _get_log(self.call, cursor) - def send_message_batch(self, items: list[chitose.chat.bsky.convo.send_message_batch.BatchItem]) -> bytes: + def send_message(self, convo_id: str, message: chitose.chat.bsky.convo.defs.MessageInput) -> bytes: """""" - return _send_message_batch(self.call, items) \ No newline at end of file + return _send_message(self.call, convo_id, message) \ No newline at end of file diff --git a/chitose/chat/bsky/moderation/__init__.py b/chitose/chat/bsky/moderation/__init__.py index a2a5900..c1d31ad 100644 --- a/chitose/chat/bsky/moderation/__init__.py +++ b/chitose/chat/bsky/moderation/__init__.py @@ -14,10 +14,6 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def get_actor_metadata(self, actor: str) -> bytes: - """""" - return _get_actor_metadata(self.call, actor) - def get_message_context(self, message_id: str, convo_id: typing.Optional[str]=None, before: typing.Optional[int]=None, after: typing.Optional[int]=None) -> bytes: """ @@ -28,4 +24,8 @@ def get_message_context(self, message_id: str, convo_id: typing.Optional[str]=No def update_actor_access(self, actor: str, allow_access: bool, ref: typing.Optional[str]=None) -> bytes: """""" - return _update_actor_access(self.call, actor, allow_access, ref) \ No newline at end of file + return _update_actor_access(self.call, actor, allow_access, ref) + + def get_actor_metadata(self, actor: str) -> bytes: + """""" + return _get_actor_metadata(self.call, actor) \ No newline at end of file diff --git a/chitose/com/atproto/admin/__init__.py b/chitose/com/atproto/admin/__init__.py index caaa637..db473e7 100644 --- a/chitose/com/atproto/admin/__init__.py +++ b/chitose/com/atproto/admin/__init__.py @@ -27,25 +27,21 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def update_account_email(self, account: str, email: str) -> bytes: - """Administrative action to update an account's email. - + def search_accounts(self, email: typing.Optional[str]=None, cursor: typing.Optional[str]=None, limit: typing.Optional[int]=None) -> bytes: + """Get list of accounts that matches your search query.""" + return _search_accounts(self.call, email, cursor, limit) - :param account: The handle or DID of the repo. - """ - return _update_account_email(self.call, account, email) + def send_email(self, recipient_did: str, content: str, sender_did: str, subject: typing.Optional[str]=None, comment: typing.Optional[str]=None) -> bytes: + """Send email to a user's account email address. - def get_account_info(self, did: str) -> bytes: - """Get details about an account.""" - return _get_account_info(self.call, did) - def get_subject_status(self, did: typing.Optional[str]=None, uri: typing.Optional[str]=None, blob: typing.Optional[str]=None) -> bytes: - """Get the service-specific admin status of a subject (account, record, or blob).""" - return _get_subject_status(self.call, did, uri, blob) + :param comment: Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers + """ + return _send_email(self.call, recipient_did, content, sender_did, subject, comment) - def search_accounts(self, email: typing.Optional[str]=None, cursor: typing.Optional[str]=None, limit: typing.Optional[int]=None) -> bytes: - """Get list of accounts that matches your search query.""" - return _search_accounts(self.call, email, cursor, limit) + def update_subject_status(self, subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef, chitose.com.atproto.admin.defs.RepoBlobRef], takedown: typing.Optional[chitose.com.atproto.admin.defs.StatusAttr]=None, deactivated: typing.Optional[chitose.com.atproto.admin.defs.StatusAttr]=None) -> bytes: + """Update the service-specific admin status of a subject (account, record, or blob).""" + return _update_subject_status(self.call, subject, takedown, deactivated) def update_account_password(self, did: str, password: str) -> bytes: """Update the password for a user account as an administrator.""" @@ -67,34 +63,38 @@ def enable_account_invites(self, account: str, note: typing.Optional[str]=None) """ return _enable_account_invites(self.call, account, note) - def disable_account_invites(self, account: str, note: typing.Optional[str]=None) -> bytes: - """Disable an account from receiving new invite codes, but does not invalidate existing codes. - - - :param note: Optional reason for disabled invites. - """ - return _disable_account_invites(self.call, account, note) + def get_account_info(self, did: str) -> bytes: + """Get details about an account.""" + return _get_account_info(self.call, did) def disable_invite_codes(self, codes: typing.Optional[list[str]]=None, accounts: typing.Optional[list[str]]=None) -> bytes: """Disable some set of codes and/or all codes associated with a set of users.""" return _disable_invite_codes(self.call, codes, accounts) - def update_subject_status(self, subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef, chitose.com.atproto.admin.defs.RepoBlobRef], takedown: typing.Optional[chitose.com.atproto.admin.defs.StatusAttr]=None, deactivated: typing.Optional[chitose.com.atproto.admin.defs.StatusAttr]=None) -> bytes: - """Update the service-specific admin status of a subject (account, record, or blob).""" - return _update_subject_status(self.call, subject, takedown, deactivated) - - def send_email(self, recipient_did: str, content: str, sender_did: str, subject: typing.Optional[str]=None, comment: typing.Optional[str]=None) -> bytes: - """Send email to a user's account email address. + def update_account_email(self, account: str, email: str) -> bytes: + """Administrative action to update an account's email. - :param comment: Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers + :param account: The handle or DID of the repo. """ - return _send_email(self.call, recipient_did, content, sender_did, subject, comment) + return _update_account_email(self.call, account, email) + + def delete_account(self, did: str) -> bytes: + """Delete a user account as an administrator.""" + return _delete_account(self.call, did) def get_account_infos(self, dids: list[str]) -> bytes: """Get details about some accounts.""" return _get_account_infos(self.call, dids) - def delete_account(self, did: str) -> bytes: - """Delete a user account as an administrator.""" - return _delete_account(self.call, did) \ No newline at end of file + def disable_account_invites(self, account: str, note: typing.Optional[str]=None) -> bytes: + """Disable an account from receiving new invite codes, but does not invalidate existing codes. + + + :param note: Optional reason for disabled invites. + """ + return _disable_account_invites(self.call, account, note) + + def get_subject_status(self, did: typing.Optional[str]=None, uri: typing.Optional[str]=None, blob: typing.Optional[str]=None) -> bytes: + """Get the service-specific admin status of a subject (account, record, or blob).""" + return _get_subject_status(self.call, did, uri, blob) \ No newline at end of file diff --git a/chitose/com/atproto/identity/__init__.py b/chitose/com/atproto/identity/__init__.py index f055ecf..4fa99d1 100644 --- a/chitose/com/atproto/identity/__init__.py +++ b/chitose/com/atproto/identity/__init__.py @@ -17,38 +17,38 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def update_handle(self, handle: str) -> bytes: - """Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. + def resolve_handle(self, handle: str) -> bytes: + """Resolves a handle (domain name) to a DID. - :param handle: The new handle. + :param handle: The handle to resolve. """ - return _update_handle(self.call, handle) - - def sign_plc_operation(self, token: typing.Optional[str]=None, rotation_keys: typing.Optional[list[str]]=None, also_known_as: typing.Optional[list[str]]=None, verification_methods: typing.Optional[typing.Any]=None, services: typing.Optional[typing.Any]=None) -> bytes: - """Signs a PLC operation to update some value(s) in the requesting DID's document. - + return _resolve_handle(self.call, handle) - :param token: A token received through com.atproto.identity.requestPlcOperationSignature - """ - return _sign_plc_operation(self.call, token, rotation_keys, also_known_as, verification_methods, services) + def get_recommended_did_credentials(self) -> bytes: + """Describe the credentials that should be included in the DID doc of an account that is migrating to this service.""" + return _get_recommended_did_credentials(self.call) def submit_plc_operation(self, operation: typing.Any) -> bytes: """Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry""" return _submit_plc_operation(self.call, operation) - def resolve_handle(self, handle: str) -> bytes: - """Resolves a handle (domain name) to a DID. + def update_handle(self, handle: str) -> bytes: + """Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth. - :param handle: The handle to resolve. + :param handle: The new handle. """ - return _resolve_handle(self.call, handle) + return _update_handle(self.call, handle) def request_plc_operation_signature(self) -> bytes: """Request an email with a code to in order to request a signed PLC operation. Requires Auth.""" return _request_plc_operation_signature(self.call) - def get_recommended_did_credentials(self) -> bytes: - """Describe the credentials that should be included in the DID doc of an account that is migrating to this service.""" - return _get_recommended_did_credentials(self.call) \ No newline at end of file + def sign_plc_operation(self, token: typing.Optional[str]=None, rotation_keys: typing.Optional[list[str]]=None, also_known_as: typing.Optional[list[str]]=None, verification_methods: typing.Optional[typing.Any]=None, services: typing.Optional[typing.Any]=None) -> bytes: + """Signs a PLC operation to update some value(s) in the requesting DID's document. + + + :param token: A token received through com.atproto.identity.requestPlcOperationSignature + """ + return _sign_plc_operation(self.call, token, rotation_keys, also_known_as, verification_methods, services) \ No newline at end of file diff --git a/chitose/com/atproto/label/__init__.py b/chitose/com/atproto/label/__init__.py index fe1269d..e7644fc 100644 --- a/chitose/com/atproto/label/__init__.py +++ b/chitose/com/atproto/label/__init__.py @@ -14,14 +14,6 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def subscribe_labels(self, handler: chitose.xrpc.XrpcHandler, cursor: typing.Optional[int]=None) -> None: - """Subscribe to stream of labels (and negations). Public endpoint implemented by mod services. Uses same sequencing scheme as repo event stream. - - - :param cursor: The last known event seq number to backfill from. - """ - _subscribe_labels(self.subscribe, handler, cursor) - def query_labels(self, uri_patterns: list[str], sources: typing.Optional[list[str]]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth. @@ -30,4 +22,12 @@ def query_labels(self, uri_patterns: list[str], sources: typing.Optional[list[st :param sources: Optional list of label sources (DIDs) to filter on. """ - return _query_labels(self.call, uri_patterns, sources, limit, cursor) \ No newline at end of file + return _query_labels(self.call, uri_patterns, sources, limit, cursor) + + def subscribe_labels(self, handler: chitose.xrpc.XrpcHandler, cursor: typing.Optional[int]=None) -> None: + """Subscribe to stream of labels (and negations). Public endpoint implemented by mod services. Uses same sequencing scheme as repo event stream. + + + :param cursor: The last known event seq number to backfill from. + """ + _subscribe_labels(self.subscribe, handler, cursor) \ No newline at end of file diff --git a/chitose/com/atproto/repo/__init__.py b/chitose/com/atproto/repo/__init__.py index 7e5318f..42916a8 100644 --- a/chitose/com/atproto/repo/__init__.py +++ b/chitose/com/atproto/repo/__init__.py @@ -22,9 +22,43 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def list_missing_blobs(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.""" - return _list_missing_blobs(self.call, limit, cursor) + def describe_repo(self, repo: str) -> bytes: + """Get information about an account and repository, including the list of collections. Does not require auth. + + + :param repo: The handle or DID of the repo. + """ + return _describe_repo(self.call, repo) + + def get_record(self, repo: str, collection: str, rkey: str, cid: typing.Optional[str]=None) -> bytes: + """Get a single record from a repository. Does not require auth. + + + :param repo: The handle or DID of the repo. + + :param collection: The NSID of the record collection. + + :param rkey: The Record Key. + + :param cid: The CID of the version of the record. If not specified, then return the most recent version. + """ + return _get_record(self.call, repo, collection, rkey, cid) + + def upload_blob(self, 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.""" + return _upload_blob(self.call, input_) + + def apply_writes(self, repo: str, writes: list[typing.Union[chitose.com.atproto.repo.apply_writes.Create, chitose.com.atproto.repo.apply_writes.Update, chitose.com.atproto.repo.apply_writes.Delete]], validate: typing.Optional[bool]=None, swap_commit: typing.Optional[str]=None) -> bytes: + """Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. + + + :param repo: The handle or DID of the repo (aka, current account). + + :param 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. + + :param 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. + """ + return _apply_writes(self.call, repo, writes, validate, swap_commit) def create_record(self, repo: str, collection: str, record: typing.Any, rkey: typing.Optional[str]=None, validate: typing.Optional[bool]=None, swap_commit: typing.Optional[str]=None) -> bytes: """Create a single new repository record. Requires auth, implemented by PDS. @@ -80,48 +114,10 @@ def put_record(self, repo: str, collection: str, rkey: str, record: typing.Any, """ return _put_record(self.call, repo, collection, rkey, record, validate, swap_record, swap_commit) - def upload_blob(self, 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.""" - return _upload_blob(self.call, input_) - def import_repo(self, input_: bytes) -> bytes: """Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.""" return _import_repo(self.call, input_) - def describe_repo(self, repo: str) -> bytes: - """Get information about an account and repository, including the list of collections. Does not require auth. - - - :param repo: The handle or DID of the repo. - """ - return _describe_repo(self.call, repo) - - def get_record(self, repo: str, collection: str, rkey: str, cid: typing.Optional[str]=None) -> bytes: - """Get a single record from a repository. Does not require auth. - - - :param repo: The handle or DID of the repo. - - :param collection: The NSID of the record collection. - - :param rkey: The Record Key. - - :param cid: The CID of the version of the record. If not specified, then return the most recent version. - """ - return _get_record(self.call, repo, collection, rkey, cid) - - def apply_writes(self, repo: str, writes: list[typing.Union[chitose.com.atproto.repo.apply_writes.Create, chitose.com.atproto.repo.apply_writes.Update, chitose.com.atproto.repo.apply_writes.Delete]], validate: typing.Optional[bool]=None, swap_commit: typing.Optional[str]=None) -> bytes: - """Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS. - - - :param repo: The handle or DID of the repo (aka, current account). - - :param 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. - - :param 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. - """ - return _apply_writes(self.call, repo, writes, validate, swap_commit) - def list_records(self, repo: str, collection: str, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None, rkey_start: typing.Optional[str]=None, rkey_end: typing.Optional[str]=None, reverse: typing.Optional[bool]=None) -> bytes: """List a range of records in a repository, matching a specific collection. Does not require auth. @@ -138,4 +134,8 @@ def list_records(self, repo: str, collection: str, limit: typing.Optional[int]=N :param reverse: Flag to reverse the order of the returned records. """ - return _list_records(self.call, repo, collection, limit, cursor, rkey_start, rkey_end, reverse) \ No newline at end of file + return _list_records(self.call, repo, collection, limit, cursor, rkey_start, rkey_end, reverse) + + def list_missing_blobs(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.""" + return _list_missing_blobs(self.call, limit, cursor) \ No newline at end of file diff --git a/chitose/com/atproto/server/__init__.py b/chitose/com/atproto/server/__init__.py index 24b2ce7..e150552 100644 --- a/chitose/com/atproto/server/__init__.py +++ b/chitose/com/atproto/server/__init__.py @@ -40,95 +40,89 @@ def request_email_confirmation(self) -> bytes: """Request an email with a code to confirm ownership of email.""" return _request_email_confirmation(self.call) - def reserve_signing_key(self, did: typing.Optional[str]=None) -> bytes: - """Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. + def confirm_email(self, email: str, token: str) -> bytes: + """Confirm an email using a token from com.atproto.server.requestEmailConfirmation.""" + return _confirm_email(self.call, email, token) + def delete_session(self) -> bytes: + """Delete the current session. Requires auth.""" + return _delete_session(self.call) - :param did: The DID to reserve a key for. - """ - return _reserve_signing_key(self.call, did) + def list_app_passwords(self) -> bytes: + """List all App Passwords.""" + return _list_app_passwords(self.call) - def get_service_auth(self, aud: str, exp: typing.Optional[int]=None, lxm: typing.Optional[str]=None) -> bytes: - """Get a signed token on behalf of the requesting DID for the requested service. + def check_account_status(self) -> bytes: + """Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.""" + return _check_account_status(self.call) + def activate_account(self) -> bytes: + """Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.""" + return _activate_account(self.call) - :param aud: The DID of the service that the token will be used to authenticate with + def request_account_delete(self) -> bytes: + """Initiate a user account deletion via email.""" + return _request_account_delete(self.call) - :param exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. + def revoke_app_password(self, name: str) -> bytes: + """Revoke an App Password by name.""" + return _revoke_app_password(self.call, name) - :param lxm: Lexicon (XRPC) method to bind the requested token to - """ - return _get_service_auth(self.call, aud, exp, lxm) + def request_password_reset(self, email: str) -> bytes: + """Initiate a user account password reset via email.""" + return _request_password_reset(self.call, email) - def get_account_invite_codes(self, include_used: typing.Optional[bool]=None, create_available: typing.Optional[bool]=None) -> bytes: - """Get all invite codes for the current account. Requires auth. + def get_session(self) -> bytes: + """Get information about the current auth session. Requires auth.""" + return _get_session(self.call) + def get_service_auth(self, aud: str, exp: typing.Optional[int]=None, lxm: typing.Optional[str]=None) -> bytes: + """Get a signed token on behalf of the requesting DID for the requested service. - :param create_available: Controls whether any new 'earned' but not 'created' invites should be created. - """ - return _get_account_invite_codes(self.call, include_used, create_available) - def create_session(self, identifier: str, password: str, auth_factor_token: typing.Optional[str]=None) -> bytes: - """Create an authentication session. + :param aud: The DID of the service that the token will be used to authenticate with + :param exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. - :param identifier: Handle or other identifier supported by the server for the authenticating user. + :param lxm: Lexicon (XRPC) method to bind the requested token to """ - return _create_session(self.call, identifier, password, auth_factor_token) + return _get_service_auth(self.call, aud, exp, lxm) - def list_app_passwords(self) -> bytes: - """List all App Passwords.""" - return _list_app_passwords(self.call) + def request_email_update(self) -> bytes: + """Request a token in order to update email.""" + return _request_email_update(self.call) def create_invite_codes(self, code_count: int, use_count: int, for_accounts: typing.Optional[list[str]]=None) -> bytes: """Create invite codes.""" return _create_invite_codes(self.call, code_count, use_count, for_accounts) - def delete_session(self) -> bytes: - """Delete the current session. Requires auth.""" - return _delete_session(self.call) - - def revoke_app_password(self, name: str) -> bytes: - """Revoke an App Password by name.""" - return _revoke_app_password(self.call, name) - - def create_app_password(self, name: str, privileged: typing.Optional[bool]=None) -> bytes: - """Create an App Password. + def create_account(self, handle: str, email: typing.Optional[str]=None, did: typing.Optional[str]=None, invite_code: typing.Optional[str]=None, verification_code: typing.Optional[str]=None, verification_phone: typing.Optional[str]=None, password: typing.Optional[str]=None, recovery_key: typing.Optional[str]=None, plc_op: typing.Optional[typing.Any]=None) -> bytes: + """Create an account. Implemented by PDS. - :param name: A short name for the App Password, to help distinguish them. + :param handle: Requested handle for the account. - :param privileged: If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. - """ - return _create_app_password(self.call, name, privileged) + :param did: Pre-existing atproto DID, being imported to a new account. - def activate_account(self) -> bytes: - """Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup.""" - return _activate_account(self.call) + :param password: Initial account password. May need to meet instance-specific password strength requirements. - def describe_server(self) -> bytes: - """Describes the server's account creation requirements and capabilities. Implemented by PDS.""" - return _describe_server(self.call) + :param recovery_key: DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. - def confirm_email(self, email: str, token: str) -> bytes: - """Confirm an email using a token from com.atproto.server.requestEmailConfirmation.""" - return _confirm_email(self.call, email, token) + :param plc_op: A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. + """ + return _create_account(self.call, handle, email, did, invite_code, verification_code, verification_phone, password, recovery_key, plc_op) - def get_session(self) -> bytes: - """Get information about the current auth session. Requires auth.""" - return _get_session(self.call) + def reset_password(self, token: str, password: str) -> bytes: + """Reset a user account password using a token.""" + return _reset_password(self.call, token, password) def refresh_session(self) -> bytes: """Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt').""" return _refresh_session(self.call) - def deactivate_account(self, delete_after: typing.Optional[str]=None) -> bytes: - """Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. - - - :param delete_after: A recommendation to server as to how long they should hold onto the deactivated account before deleting. - """ - return _deactivate_account(self.call, delete_after) + def create_invite_code(self, use_count: int, for_account: typing.Optional[str]=None) -> bytes: + """Create an invite code.""" + return _create_invite_code(self.call, use_count, for_account) def update_email(self, email: str, email_auth_factor: typing.Optional[bool]=None, token: typing.Optional[str]=None) -> bytes: """Update an account's email. @@ -138,46 +132,52 @@ def update_email(self, email: str, email_auth_factor: typing.Optional[bool]=None """ return _update_email(self.call, email, email_auth_factor, token) - def reset_password(self, token: str, password: str) -> bytes: - """Reset a user account password using a token.""" - return _reset_password(self.call, token, password) + def create_session(self, identifier: str, password: str, auth_factor_token: typing.Optional[str]=None) -> bytes: + """Create an authentication session. - def check_account_status(self) -> bytes: - """Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.""" - return _check_account_status(self.call) - def request_email_update(self) -> bytes: - """Request a token in order to update email.""" - return _request_email_update(self.call) + :param identifier: Handle or other identifier supported by the server for the authenticating user. + """ + return _create_session(self.call, identifier, password, auth_factor_token) - def request_password_reset(self, email: str) -> bytes: - """Initiate a user account password reset via email.""" - return _request_password_reset(self.call, email) + def delete_account(self, did: str, password: str, token: str) -> bytes: + """Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth.""" + return _delete_account(self.call, did, password, token) - def request_account_delete(self) -> bytes: - """Initiate a user account deletion via email.""" - return _request_account_delete(self.call) + def create_app_password(self, name: str, privileged: typing.Optional[bool]=None) -> bytes: + """Create an App Password. - def create_account(self, handle: str, email: typing.Optional[str]=None, did: typing.Optional[str]=None, invite_code: typing.Optional[str]=None, verification_code: typing.Optional[str]=None, verification_phone: typing.Optional[str]=None, password: typing.Optional[str]=None, recovery_key: typing.Optional[str]=None, plc_op: typing.Optional[typing.Any]=None) -> bytes: - """Create an account. Implemented by PDS. + :param name: A short name for the App Password, to help distinguish them. - :param handle: Requested handle for the account. + :param privileged: If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients. + """ + return _create_app_password(self.call, name, privileged) - :param did: Pre-existing atproto DID, being imported to a new account. + def deactivate_account(self, delete_after: typing.Optional[str]=None) -> bytes: + """Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host. - :param password: Initial account password. May need to meet instance-specific password strength requirements. - :param recovery_key: DID PLC rotation key (aka, recovery key) to be included in PLC creation operation. + :param delete_after: A recommendation to server as to how long they should hold onto the deactivated account before deleting. + """ + return _deactivate_account(self.call, delete_after) - :param plc_op: A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented. + def describe_server(self) -> bytes: + """Describes the server's account creation requirements and capabilities. Implemented by PDS.""" + return _describe_server(self.call) + + def reserve_signing_key(self, did: typing.Optional[str]=None) -> bytes: + """Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented. + + + :param did: The DID to reserve a key for. """ - return _create_account(self.call, handle, email, did, invite_code, verification_code, verification_phone, password, recovery_key, plc_op) + return _reserve_signing_key(self.call, did) - def delete_account(self, did: str, password: str, token: str) -> bytes: - """Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth.""" - return _delete_account(self.call, did, password, token) + def get_account_invite_codes(self, include_used: typing.Optional[bool]=None, create_available: typing.Optional[bool]=None) -> bytes: + """Get all invite codes for the current account. Requires auth. - def create_invite_code(self, use_count: int, for_account: typing.Optional[str]=None) -> bytes: - """Create an invite code.""" - return _create_invite_code(self.call, use_count, for_account) \ No newline at end of file + + :param create_available: Controls whether any new 'earned' but not 'created' invites should be created. + """ + return _get_account_invite_codes(self.call, include_used, create_available) \ No newline at end of file diff --git a/chitose/com/atproto/sync/__init__.py b/chitose/com/atproto/sync/__init__.py index 625e0a0..ee7e7e0 100644 --- a/chitose/com/atproto/sync/__init__.py +++ b/chitose/com/atproto/sync/__init__.py @@ -33,6 +33,16 @@ def get_head(self, did: str) -> bytes: """ return _get_head(self.call, did) + def list_blobs(self, did: str, since: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. + + + :param did: The DID of the repo. + + :param since: Optional revision of the repo to list blobs since. + """ + return _list_blobs(self.call, did, since, limit, cursor) + def get_blob(self, did: str, cid: str) -> bytes: """Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS. @@ -53,84 +63,74 @@ def get_repo(self, did: str, since: typing.Optional[str]=None) -> bytes: """ return _get_repo(self.call, did, since) - def notify_of_update(self, hostname: str) -> bytes: - """Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. - - - :param hostname: Hostname of the current service (usually a PDS) that is notifying of update. - """ - return _notify_of_update(self.call, hostname) - - def request_crawl(self, hostname: str) -> bytes: - """Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. - - - :param hostname: Hostname of the current service (eg, PDS) that is requesting to be crawled. - """ - return _request_crawl(self.call, hostname) - - def list_blobs(self, did: str, since: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS. + def get_record(self, did: str, collection: str, rkey: str, commit: typing.Optional[str]=None) -> bytes: + """Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. :param did: The DID of the repo. - :param since: Optional revision of the repo to list blobs since. + :param rkey: Record Key + + :param commit: DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit """ - return _list_blobs(self.call, did, since, limit, cursor) + return _get_record(self.call, did, collection, rkey, commit) - def get_latest_commit(self, did: str) -> bytes: - """Get the current commit CID & revision of the specified repo. Does not require auth. + def get_checkout(self, did: str) -> bytes: + """DEPRECATED - please use com.atproto.sync.getRepo instead :param did: The DID of the repo. """ - return _get_latest_commit(self.call, did) + return _get_checkout(self.call, did) - def subscribe_repos(self, handler: chitose.xrpc.XrpcHandler, cursor: typing.Optional[int]=None) -> None: - """Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. + def notify_of_update(self, hostname: str) -> bytes: + """Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. - :param cursor: The last known event seq number to backfill from. + :param hostname: Hostname of the current service (usually a PDS) that is notifying of update. """ - _subscribe_repos(self.subscribe, handler, cursor) + return _notify_of_update(self.call, hostname) - def get_repo_status(self, did: str) -> bytes: - """Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. + def get_blocks(self, did: str, cids: list[str]) -> bytes: + """Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. :param did: The DID of the repo. """ - return _get_repo_status(self.call, did) - - def get_record(self, did: str, collection: str, rkey: str, commit: typing.Optional[str]=None) -> bytes: - """Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth. - + return _get_blocks(self.call, did, cids) - :param did: The DID of the repo. + def request_crawl(self, hostname: str) -> bytes: + """Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth. - :param rkey: Record Key - :param commit: DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit + :param hostname: Hostname of the current service (eg, PDS) that is requesting to be crawled. """ - return _get_record(self.call, did, collection, rkey, commit) + return _request_crawl(self.call, hostname) def list_repos(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay.""" return _list_repos(self.call, limit, cursor) - def get_blocks(self, did: str, cids: list[str]) -> bytes: - """Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS. + def get_repo_status(self, did: str) -> bytes: + """Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay. :param did: The DID of the repo. """ - return _get_blocks(self.call, did, cids) + return _get_repo_status(self.call, did) - def get_checkout(self, did: str) -> bytes: - """DEPRECATED - please use com.atproto.sync.getRepo instead + def subscribe_repos(self, handler: chitose.xrpc.XrpcHandler, cursor: typing.Optional[int]=None) -> None: + """Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay. + + + :param cursor: The last known event seq number to backfill from. + """ + _subscribe_repos(self.subscribe, handler, cursor) + + def get_latest_commit(self, did: str) -> bytes: + """Get the current commit CID & revision of the specified repo. Does not require auth. :param did: The DID of the repo. """ - return _get_checkout(self.call, did) \ No newline at end of file + return _get_latest_commit(self.call, did) \ No newline at end of file diff --git a/chitose/com/atproto/temp/__init__.py b/chitose/com/atproto/temp/__init__.py index f43d05b..1ebd446 100644 --- a/chitose/com/atproto/temp/__init__.py +++ b/chitose/com/atproto/temp/__init__.py @@ -14,14 +14,14 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe + def fetch_labels(self, since: typing.Optional[int]=None, limit: typing.Optional[int]=None) -> bytes: + """DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date.""" + return _fetch_labels(self.call, since, limit) + def check_signup_queue(self) -> bytes: """Check accounts location in signup queue.""" return _check_signup_queue(self.call) def request_phone_verification(self, phone_number: str) -> bytes: """Request a verification code to be sent to the supplied phone number""" - return _request_phone_verification(self.call, phone_number) - - def fetch_labels(self, since: typing.Optional[int]=None, limit: typing.Optional[int]=None) -> bytes: - """DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date.""" - return _fetch_labels(self.call, since, limit) \ No newline at end of file + return _request_phone_verification(self.call, phone_number) \ No newline at end of file diff --git a/chitose/tools/ozone/communication/__init__.py b/chitose/tools/ozone/communication/__init__.py index c5d961d..5e1e1dd 100644 --- a/chitose/tools/ozone/communication/__init__.py +++ b/chitose/tools/ozone/communication/__init__.py @@ -15,11 +15,9 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def update_template(self, id: str, name: typing.Optional[str]=None, content_markdown: typing.Optional[str]=None, subject: typing.Optional[str]=None, updated_by: typing.Optional[str]=None, disabled: typing.Optional[bool]=None) -> bytes: - """Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. - + def create_template(self, name: str, content_markdown: str, subject: str, lang: typing.Optional[str]=None, created_by: typing.Optional[str]=None) -> bytes: + """Administrative action to create a new, re-usable communication (email for now) template. - :param id: ID of the template to be updated. :param name: Name of the template. @@ -27,23 +25,29 @@ def update_template(self, id: str, name: typing.Optional[str]=None, content_mark :param subject: Subject of the message, used in emails. - :param updated_by: DID of the user who is updating the template. + :param lang: Message language. + + :param created_by: DID of the user who is creating the template. """ - return _update_template(self.call, id, name, content_markdown, subject, updated_by, disabled) + return _create_template(self.call, name, content_markdown, subject, lang, created_by) - def create_template(self, name: str, content_markdown: str, subject: str, created_by: typing.Optional[str]=None) -> bytes: - """Administrative action to create a new, re-usable communication (email for now) template. + def update_template(self, id: str, name: typing.Optional[str]=None, lang: typing.Optional[str]=None, content_markdown: typing.Optional[str]=None, subject: typing.Optional[str]=None, updated_by: typing.Optional[str]=None, disabled: typing.Optional[bool]=None) -> bytes: + """Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. + :param id: ID of the template to be updated. + :param name: Name of the template. + :param lang: Message language. + :param content_markdown: Content of the template, markdown supported, can contain variable placeholders. :param subject: Subject of the message, used in emails. - :param created_by: DID of the user who is creating the template. + :param updated_by: DID of the user who is updating the template. """ - return _create_template(self.call, name, content_markdown, subject, created_by) + return _update_template(self.call, id, name, lang, content_markdown, subject, updated_by, disabled) def list_templates(self) -> bytes: """Get list of all communication templates.""" diff --git a/chitose/tools/ozone/communication/create_template.py b/chitose/tools/ozone/communication/create_template.py index 06e7443..252192d 100644 --- a/chitose/tools/ozone/communication/create_template.py +++ b/chitose/tools/ozone/communication/create_template.py @@ -4,7 +4,7 @@ import chitose import typing -def _create_template(call: chitose.xrpc.XrpcCall, name: str, content_markdown: str, subject: str, created_by: typing.Optional[str]=None) -> bytes: +def _create_template(call: chitose.xrpc.XrpcCall, name: str, content_markdown: str, subject: str, lang: typing.Optional[str]=None, created_by: typing.Optional[str]=None) -> bytes: """Administrative action to create a new, re-usable communication (email for now) template. @@ -14,6 +14,8 @@ def _create_template(call: chitose.xrpc.XrpcCall, name: str, content_markdown: s :param subject: Subject of the message, used in emails. + :param lang: Message language. + :param created_by: DID of the user who is creating the template. """ - return call('tools.ozone.communication.createTemplate', [], {'name': name, 'contentMarkdown': content_markdown, 'subject': subject, 'createdBy': created_by}, {'Content-Type': 'application/json'}) \ No newline at end of file + return call('tools.ozone.communication.createTemplate', [], {'name': name, 'contentMarkdown': content_markdown, 'subject': subject, 'lang': lang, 'createdBy': created_by}, {'Content-Type': 'application/json'}) \ No newline at end of file diff --git a/chitose/tools/ozone/communication/defs.py b/chitose/tools/ozone/communication/defs.py index 33242d7..a31e7c2 100644 --- a/chitose/tools/ozone/communication/defs.py +++ b/chitose/tools/ozone/communication/defs.py @@ -15,9 +15,11 @@ class TemplateView(chitose.Object): :param last_updated_by: DID of the user who last updated the template. :param subject: Content of the template, can contain markdown and variable placeholders. + + :param lang: Message language. """ - def __init__(self, id: str, name: str, content_markdown: str, disabled: bool, last_updated_by: str, created_at: str, updated_at: str, subject: typing.Optional[str]=None) -> None: + def __init__(self, id: str, name: str, content_markdown: str, disabled: bool, last_updated_by: str, created_at: str, updated_at: str, subject: typing.Optional[str]=None, lang: typing.Optional[str]=None) -> None: self.id = id self.name = name self.content_markdown = content_markdown @@ -26,6 +28,7 @@ def __init__(self, id: str, name: str, content_markdown: str, disabled: bool, la self.created_at = created_at self.updated_at = updated_at self.subject = subject + self.lang = lang def to_dict(self) -> dict[str, typing.Any]: - return {'id': self.id, 'name': self.name, 'contentMarkdown': self.content_markdown, 'disabled': self.disabled, 'lastUpdatedBy': self.last_updated_by, 'createdAt': self.created_at, 'updatedAt': self.updated_at, 'subject': self.subject, '$type': 'tools.ozone.communication.defs#templateView'} \ No newline at end of file + return {'id': self.id, 'name': self.name, 'contentMarkdown': self.content_markdown, 'disabled': self.disabled, 'lastUpdatedBy': self.last_updated_by, 'createdAt': self.created_at, 'updatedAt': self.updated_at, 'subject': self.subject, 'lang': self.lang, '$type': 'tools.ozone.communication.defs#templateView'} \ No newline at end of file diff --git a/chitose/tools/ozone/communication/update_template.py b/chitose/tools/ozone/communication/update_template.py index f206216..f245b16 100644 --- a/chitose/tools/ozone/communication/update_template.py +++ b/chitose/tools/ozone/communication/update_template.py @@ -4,7 +4,7 @@ import chitose import typing -def _update_template(call: chitose.xrpc.XrpcCall, id: str, name: typing.Optional[str]=None, content_markdown: typing.Optional[str]=None, subject: typing.Optional[str]=None, updated_by: typing.Optional[str]=None, disabled: typing.Optional[bool]=None) -> bytes: +def _update_template(call: chitose.xrpc.XrpcCall, id: str, name: typing.Optional[str]=None, lang: typing.Optional[str]=None, content_markdown: typing.Optional[str]=None, subject: typing.Optional[str]=None, updated_by: typing.Optional[str]=None, disabled: typing.Optional[bool]=None) -> bytes: """Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only. @@ -12,10 +12,12 @@ def _update_template(call: chitose.xrpc.XrpcCall, id: str, name: typing.Optional :param name: Name of the template. + :param lang: Message language. + :param content_markdown: Content of the template, markdown supported, can contain variable placeholders. :param subject: Subject of the message, used in emails. :param updated_by: DID of the user who is updating the template. """ - return call('tools.ozone.communication.updateTemplate', [], {'id': id, 'name': name, 'contentMarkdown': content_markdown, 'subject': subject, 'updatedBy': updated_by, 'disabled': disabled}, {'Content-Type': 'application/json'}) \ No newline at end of file + return call('tools.ozone.communication.updateTemplate', [], {'id': id, 'name': name, 'lang': lang, 'contentMarkdown': content_markdown, 'subject': subject, 'updatedBy': updated_by, 'disabled': disabled}, {'Content-Type': 'application/json'}) \ No newline at end of file diff --git a/chitose/tools/ozone/moderation/__init__.py b/chitose/tools/ozone/moderation/__init__.py index 18a1024..2a3c3e2 100644 --- a/chitose/tools/ozone/moderation/__init__.py +++ b/chitose/tools/ozone/moderation/__init__.py @@ -21,41 +21,13 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def query_statuses(self, subject: typing.Optional[str]=None, comment: typing.Optional[str]=None, reported_after: typing.Optional[str]=None, reported_before: typing.Optional[str]=None, reviewed_after: typing.Optional[str]=None, reviewed_before: typing.Optional[str]=None, include_muted: typing.Optional[bool]=None, only_muted: typing.Optional[bool]=None, review_state: typing.Optional[str]=None, ignore_subjects: typing.Optional[list[str]]=None, last_reviewed_by: typing.Optional[str]=None, sort_field: typing.Optional[str]=None, sort_direction: typing.Optional[str]=None, takendown: typing.Optional[bool]=None, appealed: typing.Optional[bool]=None, limit: typing.Optional[int]=None, tags: typing.Optional[list[str]]=None, exclude_tags: typing.Optional[list[str]]=None, cursor: typing.Optional[str]=None) -> bytes: - """View moderation statuses of subjects (record or repo). - - - :param comment: Search subjects by keyword from comments - - :param reported_after: Search subjects reported after a given timestamp - - :param reported_before: Search subjects reported before a given timestamp - - :param reviewed_after: Search subjects reviewed after a given timestamp - - :param reviewed_before: Search subjects reviewed before a given timestamp - - :param include_muted: By default, we don't include muted subjects in the results. Set this to true to include them. - - :param only_muted: When set to true, only muted subjects and reporters will be returned. - - :param review_state: Specify when fetching subjects in a certain state - - :param last_reviewed_by: Get all subject statuses that were reviewed by a specific moderator - - :param takendown: Get subjects that were taken down - - :param appealed: Get subjects in unresolved appealed status - """ - return _query_statuses(self.call, subject, comment, reported_after, reported_before, reviewed_after, reviewed_before, include_muted, only_muted, review_state, ignore_subjects, last_reviewed_by, sort_field, sort_direction, takendown, appealed, limit, tags, exclude_tags, cursor) - def get_repo(self, did: str) -> bytes: """Get details about a repository.""" return _get_repo(self.call, did) - def get_event(self, id: int) -> bytes: - """Get details about a moderation event.""" - return _get_event(self.call, id) + def get_record(self, uri: str, cid: typing.Optional[str]=None) -> bytes: + """Get details about a record.""" + return _get_record(self.call, uri, cid) def query_events(self, types: typing.Optional[list[str]]=None, created_by: typing.Optional[str]=None, sort_direction: typing.Optional[str]=None, created_after: typing.Optional[str]=None, created_before: typing.Optional[str]=None, subject: typing.Optional[str]=None, include_all_user_records: typing.Optional[bool]=None, limit: typing.Optional[int]=None, has_comment: typing.Optional[bool]=None, comment: typing.Optional[str]=None, added_labels: typing.Optional[list[str]]=None, removed_labels: typing.Optional[list[str]]=None, added_tags: typing.Optional[list[str]]=None, removed_tags: typing.Optional[list[str]]=None, report_types: typing.Optional[list[str]]=None, cursor: typing.Optional[str]=None) -> bytes: """List moderation events related to a subject. @@ -85,13 +57,33 @@ def query_events(self, types: typing.Optional[list[str]]=None, created_by: typin """ return _query_events(self.call, types, created_by, sort_direction, created_after, created_before, subject, include_all_user_records, limit, has_comment, comment, added_labels, removed_labels, added_tags, removed_tags, report_types, cursor) - def get_record(self, uri: str, cid: typing.Optional[str]=None) -> bytes: - """Get details about a record.""" - return _get_record(self.call, uri, cid) + def query_statuses(self, subject: typing.Optional[str]=None, comment: typing.Optional[str]=None, reported_after: typing.Optional[str]=None, reported_before: typing.Optional[str]=None, reviewed_after: typing.Optional[str]=None, reviewed_before: typing.Optional[str]=None, include_muted: typing.Optional[bool]=None, only_muted: typing.Optional[bool]=None, review_state: typing.Optional[str]=None, ignore_subjects: typing.Optional[list[str]]=None, last_reviewed_by: typing.Optional[str]=None, sort_field: typing.Optional[str]=None, sort_direction: typing.Optional[str]=None, takendown: typing.Optional[bool]=None, appealed: typing.Optional[bool]=None, limit: typing.Optional[int]=None, tags: typing.Optional[list[str]]=None, exclude_tags: typing.Optional[list[str]]=None, cursor: typing.Optional[str]=None) -> bytes: + """View moderation statuses of subjects (record or repo). - def emit_event(self, event: typing.Union[chitose.tools.ozone.moderation.defs.ModEventTakedown, chitose.tools.ozone.moderation.defs.ModEventAcknowledge, chitose.tools.ozone.moderation.defs.ModEventEscalate, chitose.tools.ozone.moderation.defs.ModEventComment, chitose.tools.ozone.moderation.defs.ModEventLabel, chitose.tools.ozone.moderation.defs.ModEventReport, chitose.tools.ozone.moderation.defs.ModEventMute, chitose.tools.ozone.moderation.defs.ModEventUnmute, chitose.tools.ozone.moderation.defs.ModEventMuteReporter, chitose.tools.ozone.moderation.defs.ModEventUnmuteReporter, chitose.tools.ozone.moderation.defs.ModEventReverseTakedown, chitose.tools.ozone.moderation.defs.ModEventEmail, chitose.tools.ozone.moderation.defs.ModEventTag], subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef], created_by: str, subject_blob_cids: typing.Optional[list[str]]=None) -> bytes: - """Take a moderation action on an actor.""" - return _emit_event(self.call, event, subject, created_by, subject_blob_cids) + + :param comment: Search subjects by keyword from comments + + :param reported_after: Search subjects reported after a given timestamp + + :param reported_before: Search subjects reported before a given timestamp + + :param reviewed_after: Search subjects reviewed after a given timestamp + + :param reviewed_before: Search subjects reviewed before a given timestamp + + :param include_muted: By default, we don't include muted subjects in the results. Set this to true to include them. + + :param only_muted: When set to true, only muted subjects and reporters will be returned. + + :param review_state: Specify when fetching subjects in a certain state + + :param last_reviewed_by: Get all subject statuses that were reviewed by a specific moderator + + :param takendown: Get subjects that were taken down + + :param appealed: Get subjects in unresolved appealed status + """ + return _query_statuses(self.call, subject, comment, reported_after, reported_before, reviewed_after, reviewed_before, include_muted, only_muted, review_state, ignore_subjects, last_reviewed_by, sort_field, sort_direction, takendown, appealed, limit, tags, exclude_tags, cursor) def search_repos(self, term: typing.Optional[str]=None, q: typing.Optional[str]=None, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: """Find repositories based on a search term. @@ -99,4 +91,12 @@ def search_repos(self, term: typing.Optional[str]=None, q: typing.Optional[str]= :param term: DEPRECATED: use 'q' instead """ - return _search_repos(self.call, term, q, limit, cursor) \ No newline at end of file + return _search_repos(self.call, term, q, limit, cursor) + + def get_event(self, id: int) -> bytes: + """Get details about a moderation event.""" + return _get_event(self.call, id) + + def emit_event(self, event: typing.Union[chitose.tools.ozone.moderation.defs.ModEventTakedown, chitose.tools.ozone.moderation.defs.ModEventAcknowledge, chitose.tools.ozone.moderation.defs.ModEventEscalate, chitose.tools.ozone.moderation.defs.ModEventComment, chitose.tools.ozone.moderation.defs.ModEventLabel, chitose.tools.ozone.moderation.defs.ModEventReport, chitose.tools.ozone.moderation.defs.ModEventMute, chitose.tools.ozone.moderation.defs.ModEventUnmute, chitose.tools.ozone.moderation.defs.ModEventMuteReporter, chitose.tools.ozone.moderation.defs.ModEventUnmuteReporter, chitose.tools.ozone.moderation.defs.ModEventReverseTakedown, chitose.tools.ozone.moderation.defs.ModEventResolveAppeal, chitose.tools.ozone.moderation.defs.ModEventEmail, chitose.tools.ozone.moderation.defs.ModEventTag], subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef], created_by: str, subject_blob_cids: typing.Optional[list[str]]=None) -> bytes: + """Take a moderation action on an actor.""" + return _emit_event(self.call, event, subject, created_by, subject_blob_cids) \ No newline at end of file diff --git a/chitose/tools/ozone/moderation/emit_event.py b/chitose/tools/ozone/moderation/emit_event.py index fb1e32d..7b92d41 100644 --- a/chitose/tools/ozone/moderation/emit_event.py +++ b/chitose/tools/ozone/moderation/emit_event.py @@ -7,6 +7,6 @@ import chitose.tools.ozone.moderation.defs import typing -def _emit_event(call: chitose.xrpc.XrpcCall, event: typing.Union[chitose.tools.ozone.moderation.defs.ModEventTakedown, chitose.tools.ozone.moderation.defs.ModEventAcknowledge, chitose.tools.ozone.moderation.defs.ModEventEscalate, chitose.tools.ozone.moderation.defs.ModEventComment, chitose.tools.ozone.moderation.defs.ModEventLabel, chitose.tools.ozone.moderation.defs.ModEventReport, chitose.tools.ozone.moderation.defs.ModEventMute, chitose.tools.ozone.moderation.defs.ModEventUnmute, chitose.tools.ozone.moderation.defs.ModEventMuteReporter, chitose.tools.ozone.moderation.defs.ModEventUnmuteReporter, chitose.tools.ozone.moderation.defs.ModEventReverseTakedown, chitose.tools.ozone.moderation.defs.ModEventEmail, chitose.tools.ozone.moderation.defs.ModEventTag], subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef], created_by: str, subject_blob_cids: typing.Optional[list[str]]=None) -> bytes: +def _emit_event(call: chitose.xrpc.XrpcCall, event: typing.Union[chitose.tools.ozone.moderation.defs.ModEventTakedown, chitose.tools.ozone.moderation.defs.ModEventAcknowledge, chitose.tools.ozone.moderation.defs.ModEventEscalate, chitose.tools.ozone.moderation.defs.ModEventComment, chitose.tools.ozone.moderation.defs.ModEventLabel, chitose.tools.ozone.moderation.defs.ModEventReport, chitose.tools.ozone.moderation.defs.ModEventMute, chitose.tools.ozone.moderation.defs.ModEventUnmute, chitose.tools.ozone.moderation.defs.ModEventMuteReporter, chitose.tools.ozone.moderation.defs.ModEventUnmuteReporter, chitose.tools.ozone.moderation.defs.ModEventReverseTakedown, chitose.tools.ozone.moderation.defs.ModEventResolveAppeal, chitose.tools.ozone.moderation.defs.ModEventEmail, chitose.tools.ozone.moderation.defs.ModEventTag], subject: typing.Union[chitose.com.atproto.admin.defs.RepoRef, chitose.com.atproto.repo.strong_ref.StrongRef], created_by: str, subject_blob_cids: typing.Optional[list[str]]=None) -> bytes: """Take a moderation action on an actor.""" return call('tools.ozone.moderation.emitEvent', [], {'event': event, 'subject': subject, 'subjectBlobCids': subject_blob_cids, 'createdBy': created_by}, {'Content-Type': 'application/json'}) \ No newline at end of file diff --git a/chitose/tools/ozone/team/__init__.py b/chitose/tools/ozone/team/__init__.py index 6aef406..0a15ed8 100644 --- a/chitose/tools/ozone/team/__init__.py +++ b/chitose/tools/ozone/team/__init__.py @@ -15,18 +15,18 @@ def __init__(self, call: XrpcCall, subscribe: XrpcSubscribe) -> None: self.call = call self.subscribe = subscribe - def list_members(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: - """List all members with access to the ozone service.""" - return _list_members(self.call, limit, cursor) + def add_member(self, did: str, role: typing.Literal['tools.ozone.team.defs#roleAdmin', 'tools.ozone.team.defs#roleModerator', 'tools.ozone.team.defs#roleTriage']) -> bytes: + """Add a member to the ozone team. Requires admin role.""" + return _add_member(self.call, did, role) def delete_member(self, did: str) -> bytes: """Delete a member from ozone team. Requires admin role.""" return _delete_member(self.call, did) + def list_members(self, limit: typing.Optional[int]=None, cursor: typing.Optional[str]=None) -> bytes: + """List all members with access to the ozone service.""" + return _list_members(self.call, limit, cursor) + def update_member(self, did: str, disabled: typing.Optional[bool]=None, role: typing.Optional[typing.Literal['tools.ozone.team.defs#roleAdmin', 'tools.ozone.team.defs#roleModerator', 'tools.ozone.team.defs#roleTriage']]=None) -> bytes: """Update a member in the ozone service. Requires admin role.""" - return _update_member(self.call, did, disabled, role) - - def add_member(self, did: str, role: typing.Literal['tools.ozone.team.defs#roleAdmin', 'tools.ozone.team.defs#roleModerator', 'tools.ozone.team.defs#roleTriage']) -> bytes: - """Add a member to the ozone team. Requires admin role.""" - return _add_member(self.call, did, role) \ No newline at end of file + return _update_member(self.call, did, disabled, role) \ No newline at end of file