From 3c3e8c05158969c71bcebf44400f56ef56ff7344 Mon Sep 17 00:00:00 2001 From: mnogu <127841+mnogu@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:19:31 +0000 Subject: [PATCH] Update atproto --- atproto | 2 +- chitose/app/bsky/actor/defs.py | 27 ++++++++++++++++--- chitose/tools/ozone/moderation/__init__.py | 8 ++++-- chitose/tools/ozone/moderation/defs.py | 7 +++-- .../tools/ozone/moderation/query_statuses.py | 8 ++++-- 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/atproto b/atproto index 6c1ec14..319aa7c 160000 --- a/atproto +++ b/atproto @@ -1 +1 @@ -Subproject commit 6c1ec149cf4046aa2c1345a6104bc7630e9659b6 +Subproject commit 319aa7cf6dd7de0262a40d69f695c9a0eb0b5179 diff --git a/chitose/app/bsky/actor/defs.py b/chitose/app/bsky/actor/defs.py index e5637d0..b5836bc 100644 --- a/chitose/app/bsky/actor/defs.py +++ b/chitose/app/bsky/actor/defs.py @@ -312,14 +312,17 @@ class BskyAppStatePref(chitose.Object): :param queued_nudges: An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. + + :param nuxs: Storage for NUXs the user has encountered. """ - def __init__(self, active_progress_guide: typing.Optional[chitose.app.bsky.actor.defs.BskyAppProgressGuide]=None, queued_nudges: typing.Optional[list[str]]=None) -> None: + def __init__(self, active_progress_guide: typing.Optional[chitose.app.bsky.actor.defs.BskyAppProgressGuide]=None, queued_nudges: typing.Optional[list[str]]=None, nuxs: typing.Optional[list[chitose.app.bsky.actor.defs.Nux]]=None) -> None: self.active_progress_guide = active_progress_guide self.queued_nudges = queued_nudges + self.nuxs = nuxs def to_dict(self) -> dict[str, typing.Any]: - return {'activeProgressGuide': self.active_progress_guide, 'queuedNudges': self.queued_nudges, '$type': 'app.bsky.actor.defs#bskyAppStatePref'} + return {'activeProgressGuide': self.active_progress_guide, 'queuedNudges': self.queued_nudges, 'nuxs': self.nuxs, '$type': 'app.bsky.actor.defs#bskyAppStatePref'} class BskyAppProgressGuide(chitose.Object): """If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress.""" @@ -328,4 +331,22 @@ def __init__(self, guide: str) -> None: self.guide = guide def to_dict(self) -> dict[str, typing.Any]: - return {'guide': self.guide, '$type': 'app.bsky.actor.defs#bskyAppProgressGuide'} \ No newline at end of file + return {'guide': self.guide, '$type': 'app.bsky.actor.defs#bskyAppProgressGuide'} + +class Nux(chitose.Object): + """A new user experiences (NUX) storage object + + + :param data: Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + + :param expires_at: The date and time at which the NUX will expire and should be considered completed. + """ + + def __init__(self, id: str, completed: bool, data: typing.Optional[str]=None, expires_at: typing.Optional[str]=None) -> None: + self.id = id + self.completed = completed + self.data = data + self.expires_at = expires_at + + def to_dict(self) -> dict[str, typing.Any]: + return {'id': self.id, 'completed': self.completed, 'data': self.data, 'expiresAt': self.expires_at, '$type': 'app.bsky.actor.defs#nux'} \ No newline at end of file diff --git a/chitose/tools/ozone/moderation/__init__.py b/chitose/tools/ozone/moderation/__init__.py index 2a3c3e2..ef50491 100644 --- a/chitose/tools/ozone/moderation/__init__.py +++ b/chitose/tools/ozone/moderation/__init__.py @@ -57,10 +57,14 @@ 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 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: + def query_statuses(self, include_all_user_records: typing.Optional[bool]=None, 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 include_all_user_records: All subjects belonging to the account specified in the 'subject' param will be returned. + + :param subject: The subject to get the status for. + :param comment: Search subjects by keyword from comments :param reported_after: Search subjects reported after a given timestamp @@ -83,7 +87,7 @@ def query_statuses(self, subject: typing.Optional[str]=None, comment: typing.Opt :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) + return _query_statuses(self.call, include_all_user_records, 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. diff --git a/chitose/tools/ozone/moderation/defs.py b/chitose/tools/ozone/moderation/defs.py index e340f31..bc6e3fa 100644 --- a/chitose/tools/ozone/moderation/defs.py +++ b/chitose/tools/ozone/moderation/defs.py @@ -89,14 +89,17 @@ class ModEventTakedown(chitose.Object): :param duration_in_hours: Indicates how long the takedown should be in effect before automatically expiring. + + :param acknowledge_account_subjects: If true, all other reports on content authored by this account will be resolved (acknowledged). """ - def __init__(self, comment: typing.Optional[str]=None, duration_in_hours: typing.Optional[int]=None) -> None: + def __init__(self, comment: typing.Optional[str]=None, duration_in_hours: typing.Optional[int]=None, acknowledge_account_subjects: typing.Optional[bool]=None) -> None: self.comment = comment self.duration_in_hours = duration_in_hours + self.acknowledge_account_subjects = acknowledge_account_subjects def to_dict(self) -> dict[str, typing.Any]: - return {'comment': self.comment, 'durationInHours': self.duration_in_hours, '$type': 'tools.ozone.moderation.defs#modEventTakedown'} + return {'comment': self.comment, 'durationInHours': self.duration_in_hours, 'acknowledgeAccountSubjects': self.acknowledge_account_subjects, '$type': 'tools.ozone.moderation.defs#modEventTakedown'} class ModEventReverseTakedown(chitose.Object): """Revert take down action on a subject diff --git a/chitose/tools/ozone/moderation/query_statuses.py b/chitose/tools/ozone/moderation/query_statuses.py index d533808..3c79846 100644 --- a/chitose/tools/ozone/moderation/query_statuses.py +++ b/chitose/tools/ozone/moderation/query_statuses.py @@ -4,10 +4,14 @@ import chitose import typing -def _query_statuses(call: chitose.xrpc.XrpcCall, 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: +def _query_statuses(call: chitose.xrpc.XrpcCall, include_all_user_records: typing.Optional[bool]=None, 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 include_all_user_records: All subjects belonging to the account specified in the 'subject' param will be returned. + + :param subject: The subject to get the status for. + :param comment: Search subjects by keyword from comments :param reported_after: Search subjects reported after a given timestamp @@ -30,4 +34,4 @@ def _query_statuses(call: chitose.xrpc.XrpcCall, subject: typing.Optional[str]=N :param appealed: Get subjects in unresolved appealed status """ - return call('tools.ozone.moderation.queryStatuses', [('subject', subject), ('comment', comment), ('reportedAfter', reported_after), ('reportedBefore', reported_before), ('reviewedAfter', reviewed_after), ('reviewedBefore', reviewed_before), ('includeMuted', include_muted), ('onlyMuted', only_muted), ('reviewState', review_state), ('ignoreSubjects', ignore_subjects), ('lastReviewedBy', last_reviewed_by), ('sortField', sort_field), ('sortDirection', sort_direction), ('takendown', takendown), ('appealed', appealed), ('limit', limit), ('tags', tags), ('excludeTags', exclude_tags), ('cursor', cursor)], None, {}) \ No newline at end of file + return call('tools.ozone.moderation.queryStatuses', [('includeAllUserRecords', include_all_user_records), ('subject', subject), ('comment', comment), ('reportedAfter', reported_after), ('reportedBefore', reported_before), ('reviewedAfter', reviewed_after), ('reviewedBefore', reviewed_before), ('includeMuted', include_muted), ('onlyMuted', only_muted), ('reviewState', review_state), ('ignoreSubjects', ignore_subjects), ('lastReviewedBy', last_reviewed_by), ('sortField', sort_field), ('sortDirection', sort_direction), ('takendown', takendown), ('appealed', appealed), ('limit', limit), ('tags', tags), ('excludeTags', exclude_tags), ('cursor', cursor)], None, {}) \ No newline at end of file