Skip to content

Commit

Permalink
Merge pull request #7 from mnogu/create-pull-request/patch
Browse files Browse the repository at this point in the history
Update atproto
  • Loading branch information
mnogu authored Sep 14, 2024
2 parents c886104 + 3c3e8c0 commit d781b03
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion atproto
Submodule atproto updated 104 files
27 changes: 24 additions & 3 deletions chitose/app/bsky/actor/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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'}
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'}
8 changes: 6 additions & 2 deletions chitose/tools/ozone/moderation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions chitose/tools/ozone/moderation/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions chitose/tools/ozone/moderation/query_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, {})
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, {})

0 comments on commit d781b03

Please sign in to comment.