diff --git a/docs/source/aliases_db.py b/docs/source/aliases_db.py index cfb6686c..32b82844 100644 --- a/docs/source/aliases_db.py +++ b/docs/source/aliases_db.py @@ -133,6 +133,7 @@ 'models.ComAtprotoLabelDefs': 'atproto_client.models.com.atproto.label.defs', 'models.ComAtprotoLabelQueryLabels': 'atproto_client.models.com.atproto.label.query_labels', 'models.ComAtprotoLabelSubscribeLabels': 'atproto_client.models.com.atproto.label.subscribe_labels', + 'models.ComAtprotoLexiconSchema': 'atproto_client.models.com.atproto.lexicon.schema', 'models.ComAtprotoModerationCreateReport': 'atproto_client.models.com.atproto.moderation.create_report', 'models.ComAtprotoModerationDefs': 'atproto_client.models.com.atproto.moderation.defs', 'models.ComAtprotoRepoApplyWrites': 'atproto_client.models.com.atproto.repo.apply_writes', diff --git a/docs/source/atproto/atproto_client.models.com.atproto.lexicon.rst b/docs/source/atproto/atproto_client.models.com.atproto.lexicon.rst new file mode 100644 index 00000000..08d156c9 --- /dev/null +++ b/docs/source/atproto/atproto_client.models.com.atproto.lexicon.rst @@ -0,0 +1,15 @@ +com.atproto.lexicon +========================================== + +.. automodule:: atproto_client.models.com.atproto.lexicon + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + atproto_client.models.com.atproto.lexicon.schema diff --git a/docs/source/atproto/atproto_client.models.com.atproto.lexicon.schema.rst b/docs/source/atproto/atproto_client.models.com.atproto.lexicon.schema.rst new file mode 100644 index 00000000..a37a0cad --- /dev/null +++ b/docs/source/atproto/atproto_client.models.com.atproto.lexicon.schema.rst @@ -0,0 +1,7 @@ +com.atproto.lexicon.schema +================================================= + +.. automodule:: atproto_client.models.com.atproto.lexicon.schema + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/atproto/atproto_client.models.com.atproto.rst b/docs/source/atproto/atproto_client.models.com.atproto.rst index 918ffe54..2628871f 100644 --- a/docs/source/atproto/atproto_client.models.com.atproto.rst +++ b/docs/source/atproto/atproto_client.models.com.atproto.rst @@ -15,6 +15,7 @@ Subpackages atproto_client.models.com.atproto.admin atproto_client.models.com.atproto.identity atproto_client.models.com.atproto.label + atproto_client.models.com.atproto.lexicon atproto_client.models.com.atproto.moderation atproto_client.models.com.atproto.repo atproto_client.models.com.atproto.server diff --git a/lexicons/app.bsky.actor.getSuggestions.json b/lexicons/app.bsky.actor.getSuggestions.json index 2004ae6f..31e52652 100644 --- a/lexicons/app.bsky.actor.getSuggestions.json +++ b/lexicons/app.bsky.actor.getSuggestions.json @@ -30,6 +30,10 @@ "type": "ref", "ref": "app.bsky.actor.defs#profileView" } + }, + "recId": { + "type": "integer", + "description": "Snowflake for this recommendation, use when submitting recommendation events." } } } diff --git a/lexicons/app.bsky.feed.defs.json b/lexicons/app.bsky.feed.defs.json index 341f7fbd..8aca402f 100644 --- a/lexicons/app.bsky.feed.defs.json +++ b/lexicons/app.bsky.feed.defs.json @@ -162,6 +162,13 @@ "items": { "type": "ref", "ref": "com.atproto.label.defs#label" } }, "viewer": { "type": "ref", "ref": "#generatorViewerState" }, + "contentMode": { + "type": "string", + "knownValues": [ + "app.bsky.feed.defs#contentModeUnspecified", + "app.bsky.feed.defs#contentModeVideo" + ] + }, "indexedAt": { "type": "string", "format": "datetime" } } }, @@ -262,6 +269,14 @@ "type": "token", "description": "User clicked through to the embedded content of the feed item" }, + "contentModeUnspecified": { + "type": "token", + "description": "Declares the feed generator returns any types of posts." + }, + "contentModeVideo": { + "type": "token", + "description": "Declares the feed generator returns posts containing app.bsky.embed.video embeds." + }, "interactionSeen": { "type": "token", "description": "Feed item was seen by user" diff --git a/lexicons/app.bsky.feed.generator.json b/lexicons/app.bsky.feed.generator.json index 1406d542..fec0c0fa 100644 --- a/lexicons/app.bsky.feed.generator.json +++ b/lexicons/app.bsky.feed.generator.json @@ -39,6 +39,13 @@ "description": "Self-label values", "refs": ["com.atproto.label.defs#selfLabels"] }, + "contentMode": { + "type": "string", + "knownValues": [ + "app.bsky.feed.defs#contentModeUnspecified", + "app.bsky.feed.defs#contentModeVideo" + ] + }, "createdAt": { "type": "string", "format": "datetime" } } } diff --git a/lexicons/app.bsky.graph.getSuggestedFollowsByActor.json b/lexicons/app.bsky.graph.getSuggestedFollowsByActor.json index 49d6a0b2..454de154 100644 --- a/lexicons/app.bsky.graph.getSuggestedFollowsByActor.json +++ b/lexicons/app.bsky.graph.getSuggestedFollowsByActor.json @@ -29,6 +29,10 @@ "type": "boolean", "description": "If true, response has fallen-back to generic results, and is not scoped using relativeToDid", "default": false + }, + "recId": { + "type": "integer", + "description": "Snowflake for this recommendation, use when submitting recommendation events." } } } diff --git a/lexicons/app.bsky.unspecced.getSuggestionsSkeleton.json b/lexicons/app.bsky.unspecced.getSuggestionsSkeleton.json index 42edf3af..658f2a11 100644 --- a/lexicons/app.bsky.unspecced.getSuggestionsSkeleton.json +++ b/lexicons/app.bsky.unspecced.getSuggestionsSkeleton.json @@ -45,6 +45,10 @@ "type": "string", "format": "did", "description": "DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer." + }, + "recId": { + "type": "integer", + "description": "Snowflake for this recommendation, use when submitting recommendation events." } } } diff --git a/lexicons/com.atproto.lexicon.schema.json b/lexicons/com.atproto.lexicon.schema.json new file mode 100644 index 00000000..e79337ba --- /dev/null +++ b/lexicons/com.atproto.lexicon.schema.json @@ -0,0 +1,21 @@ +{ + "lexicon": 1, + "id": "com.atproto.lexicon.schema", + "defs": { + "main": { + "type": "record", + "description": "Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc).", + "key": "nsid", + "record": { + "type": "object", + "required": ["lexicon"], + "properties": { + "lexicon": { + "type": "integer", + "description": "Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system." + } + } + } + } + } +} diff --git a/lexicons/tools.ozone.moderation.defs.json b/lexicons/tools.ozone.moderation.defs.json index 7c590cdd..23bba198 100644 --- a/lexicons/tools.ozone.moderation.defs.json +++ b/lexicons/tools.ozone.moderation.defs.json @@ -182,6 +182,80 @@ "tags": { "type": "array", "items": { "type": "string" } + }, + "accountStats": { + "description": "Statistics related to the account subject", + "type": "ref", + "ref": "#accountStats" + }, + "recordsStats": { + "description": "Statistics related to the record subjects authored by the subject's account", + "type": "ref", + "ref": "#recordsStats" + } + } + }, + "accountStats": { + "description": "Statistics about a particular account subject", + "type": "object", + "properties": { + "reportCount": { + "description": "Total number of reports on the account", + "type": "integer" + }, + "appealCount": { + "description": "Total number of appeals against a moderation action on the account", + "type": "integer" + }, + "suspendCount": { + "description": "Number of times the account was suspended", + "type": "integer" + }, + "escalateCount": { + "description": "Number of times the account was escalated", + "type": "integer" + }, + "takedownCount": { + "description": "Number of times the account was taken down", + "type": "integer" + } + } + }, + "recordsStats": { + "description": "Statistics about a set of record subject items", + "type": "object", + "properties": { + "totalReports": { + "description": "Cumulative sum of the number of reports on the items in the set", + "type": "integer" + }, + "reportedCount": { + "description": "Number of items that were reported at least once", + "type": "integer" + }, + "escalatedCount": { + "description": "Number of items that were escalated at least once", + "type": "integer" + }, + "appealedCount": { + "description": "Number of items that were appealed at least once", + "type": "integer" + }, + "subjectCount": { + "description": "Total number of item in the set", + "type": "integer" + }, + "pendingCount": { + "description": "Number of item currently in \"reviewOpen\" or \"reviewEscalated\" state", + "type": "integer" + }, + "processedCount": { + "description": "Number of item currently in \"reviewNone\" or \"reviewClosed\" state", + "type": "integer" + }, + "takendownCount": { + "description": "Number of item currently taken down", + "type": "integer" } } }, diff --git a/lexicons/tools.ozone.moderation.queryStatuses.json b/lexicons/tools.ozone.moderation.queryStatuses.json index a8ff110d..c280b2ed 100644 --- a/lexicons/tools.ozone.moderation.queryStatuses.json +++ b/lexicons/tools.ozone.moderation.queryStatuses.json @@ -107,7 +107,12 @@ "sortField": { "type": "string", "default": "lastReportedAt", - "enum": ["lastReviewedAt", "lastReportedAt"] + "enum": [ + "lastReviewedAt", + "lastReportedAt", + "reportedRecordsCount", + "takendownRecordsCount" + ] }, "sortDirection": { "type": "string", @@ -158,6 +163,18 @@ "type": "string", "description": "If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored.", "knownValues": ["account", "record"] + }, + "minAccountSuspendCount": { + "type": "integer", + "description": "If specified, only subjects that belong to an account that has at least this many suspensions will be returned." + }, + "minReportedRecordsCount": { + "type": "integer", + "description": "If specified, only subjects that belong to an account that has at least this many reported records will be returned." + }, + "minTakendownRecordsCount": { + "type": "integer", + "description": "If specified, only subjects that belong to an account that has at least this many taken down records will be returned." } } }, diff --git a/packages/atproto_client/models/__init__.py b/packages/atproto_client/models/__init__.py index 9783f1c9..4509bb2e 100644 --- a/packages/atproto_client/models/__init__.py +++ b/packages/atproto_client/models/__init__.py @@ -142,6 +142,7 @@ from atproto_client.models.com.atproto.label import defs as ComAtprotoLabelDefs from atproto_client.models.com.atproto.label import query_labels as ComAtprotoLabelQueryLabels from atproto_client.models.com.atproto.label import subscribe_labels as ComAtprotoLabelSubscribeLabels +from atproto_client.models.com.atproto.lexicon import schema as ComAtprotoLexiconSchema from atproto_client.models.com.atproto.moderation import create_report as ComAtprotoModerationCreateReport from atproto_client.models.com.atproto.moderation import defs as ComAtprotoModerationDefs from atproto_client.models.com.atproto.repo import apply_writes as ComAtprotoRepoApplyWrites @@ -382,6 +383,7 @@ class _Ids: ComAtprotoLabelDefs: str = 'com.atproto.label.defs' ComAtprotoLabelQueryLabels: str = 'com.atproto.label.queryLabels' ComAtprotoLabelSubscribeLabels: str = 'com.atproto.label.subscribeLabels' + ComAtprotoLexiconSchema: str = 'com.atproto.lexicon.schema' ComAtprotoModerationCreateReport: str = 'com.atproto.moderation.createReport' ComAtprotoModerationDefs: str = 'com.atproto.moderation.defs' ComAtprotoRepoApplyWrites: str = 'com.atproto.repo.applyWrites' diff --git a/packages/atproto_client/models/app/bsky/actor/get_suggestions.py b/packages/atproto_client/models/app/bsky/actor/get_suggestions.py index bf8851c7..acfce8b5 100644 --- a/packages/atproto_client/models/app/bsky/actor/get_suggestions.py +++ b/packages/atproto_client/models/app/bsky/actor/get_suggestions.py @@ -32,3 +32,4 @@ class Response(base.ResponseModelBase): actors: t.List['models.AppBskyActorDefs.ProfileView'] #: Actors. cursor: t.Optional[str] = None #: Cursor. + rec_id: t.Optional[int] = None #: Snowflake for this recommendation, use when submitting recommendation events. diff --git a/packages/atproto_client/models/app/bsky/feed/defs.py b/packages/atproto_client/models/app/bsky/feed/defs.py index 402f392a..a02cec2c 100644 --- a/packages/atproto_client/models/app/bsky/feed/defs.py +++ b/packages/atproto_client/models/app/bsky/feed/defs.py @@ -210,6 +210,9 @@ class GeneratorView(base.ModelBase): uri: string_formats.AtUri #: Uri. accepts_interactions: t.Optional[bool] = None #: Accepts interactions. avatar: t.Optional[string_formats.Uri] = None #: Avatar. + content_mode: t.Optional[ + t.Union['models.AppBskyFeedDefs.ContentModeUnspecified', 'models.AppBskyFeedDefs.ContentModeVideo', str] + ] = None #: Content mode. description: t.Optional[str] = Field(default=None, max_length=3000) #: Description. description_facets: t.Optional[t.List['models.AppBskyRichtextFacet.Main']] = None #: Description facets. labels: t.Optional[t.List['models.ComAtprotoLabelDefs.Label']] = None #: Labels. @@ -333,6 +336,14 @@ class Interaction(base.ModelBase): 'app.bsky.feed.defs#clickthroughEmbed' ] #: User clicked through to the embedded content of the feed item +ContentModeUnspecified = t.Literal[ + 'app.bsky.feed.defs#contentModeUnspecified' +] #: Declares the feed generator returns any types of posts. + +ContentModeVideo = t.Literal[ + 'app.bsky.feed.defs#contentModeVideo' +] #: Declares the feed generator returns posts containing app.bsky.embed.video embeds. + InteractionSeen = t.Literal['app.bsky.feed.defs#interactionSeen'] #: Feed item was seen by user InteractionLike = t.Literal['app.bsky.feed.defs#interactionLike'] #: User liked the feed item diff --git a/packages/atproto_client/models/app/bsky/feed/generator.py b/packages/atproto_client/models/app/bsky/feed/generator.py index 8dd900f1..63bb2013 100644 --- a/packages/atproto_client/models/app/bsky/feed/generator.py +++ b/packages/atproto_client/models/app/bsky/feed/generator.py @@ -28,6 +28,9 @@ class Record(base.RecordModelBase): None #: Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions. ) avatar: t.Optional['BlobRef'] = None #: Avatar. + content_mode: t.Optional[ + t.Union['models.AppBskyFeedDefs.ContentModeUnspecified', 'models.AppBskyFeedDefs.ContentModeVideo', str] + ] = None #: Content mode. description: t.Optional[str] = Field(default=None, max_length=3000) #: Description. description_facets: t.Optional[t.List['models.AppBskyRichtextFacet.Main']] = None #: Description facets. labels: t.Optional[ diff --git a/packages/atproto_client/models/app/bsky/graph/get_suggested_follows_by_actor.py b/packages/atproto_client/models/app/bsky/graph/get_suggested_follows_by_actor.py index fd7a4dc2..9bf2a2de 100644 --- a/packages/atproto_client/models/app/bsky/graph/get_suggested_follows_by_actor.py +++ b/packages/atproto_client/models/app/bsky/graph/get_suggested_follows_by_actor.py @@ -31,3 +31,4 @@ class Response(base.ResponseModelBase): is_fallback: t.Optional[bool] = ( False #: If true, response has fallen-back to generic results, and is not scoped using relativeToDid. ) + rec_id: t.Optional[int] = None #: Snowflake for this recommendation, use when submitting recommendation events. diff --git a/packages/atproto_client/models/app/bsky/unspecced/get_suggestions_skeleton.py b/packages/atproto_client/models/app/bsky/unspecced/get_suggestions_skeleton.py index 4d8979a4..fbad3e92 100644 --- a/packages/atproto_client/models/app/bsky/unspecced/get_suggestions_skeleton.py +++ b/packages/atproto_client/models/app/bsky/unspecced/get_suggestions_skeleton.py @@ -46,6 +46,7 @@ class Response(base.ResponseModelBase): actors: t.List['models.AppBskyUnspeccedDefs.SkeletonSearchActor'] #: Actors. cursor: t.Optional[str] = None #: Cursor. + rec_id: t.Optional[int] = None #: Snowflake for this recommendation, use when submitting recommendation events. relative_to_did: t.Optional[string_formats.Did] = ( None #: DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer. ) diff --git a/packages/atproto_client/models/com/atproto/lexicon/__init__.py b/packages/atproto_client/models/com/atproto/lexicon/__init__.py new file mode 100644 index 00000000..ca92af6a --- /dev/null +++ b/packages/atproto_client/models/com/atproto/lexicon/__init__.py @@ -0,0 +1,6 @@ +################################################################## +# THIS IS THE AUTO-GENERATED CODE. DON'T EDIT IT BY HANDS! +# Copyright (C) 2024 Ilya (Marshal) . +# This file is part of Python atproto SDK. Licenced under MIT. +################################################################## + diff --git a/packages/atproto_client/models/com/atproto/lexicon/schema.py b/packages/atproto_client/models/com/atproto/lexicon/schema.py new file mode 100644 index 00000000..e58e9dbe --- /dev/null +++ b/packages/atproto_client/models/com/atproto/lexicon/schema.py @@ -0,0 +1,46 @@ +################################################################## +# THIS IS THE AUTO-GENERATED CODE. DON'T EDIT IT BY HANDS! +# Copyright (C) 2024 Ilya (Marshal) . +# This file is part of Python atproto SDK. Licenced under MIT. +################################################################## + + +import typing as t + +from pydantic import Field + +if t.TYPE_CHECKING: + from atproto_client import models +from atproto_client.models import base + + +class Record(base.RecordModelBase): + """Record model for :obj:`com.atproto.lexicon.schema`.""" + + lexicon: int #: Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system. + + py_type: t.Literal['com.atproto.lexicon.schema'] = Field( + default='com.atproto.lexicon.schema', alias='$type', frozen=True + ) + + +class GetRecordResponse(base.SugarResponseModelBase): + """Get record response for :obj:`models.ComAtprotoLexiconSchema.Record`.""" + + uri: str #: The URI of the record. + value: 'models.ComAtprotoLexiconSchema.Record' #: The record. + cid: t.Optional[str] = None #: The CID of the record. + + +class ListRecordsResponse(base.SugarResponseModelBase): + """List records response for :obj:`models.ComAtprotoLexiconSchema.Record`.""" + + records: t.Dict[str, 'models.ComAtprotoLexiconSchema.Record'] #: Map of URIs to records. + cursor: t.Optional[str] = None #: Next page cursor. + + +class CreateRecordResponse(base.SugarResponseModelBase): + """Create record response for :obj:`models.ComAtprotoLexiconSchema.Record`.""" + + uri: str #: The URI of the record. + cid: str #: The CID of the record. diff --git a/packages/atproto_client/models/tools/ozone/moderation/defs.py b/packages/atproto_client/models/tools/ozone/moderation/defs.py index dbd5f32a..0672670e 100644 --- a/packages/atproto_client/models/tools/ozone/moderation/defs.py +++ b/packages/atproto_client/models/tools/ozone/moderation/defs.py @@ -124,6 +124,9 @@ class SubjectStatusView(base.ModelBase): updated_at: ( string_formats.DateTime ) #: Timestamp referencing when the last update was made to the moderation status of the subject. + account_stats: t.Optional['models.ToolsOzoneModerationDefs.AccountStats'] = ( + None #: Statistics related to the account subject. + ) appealed: t.Optional[bool] = ( None #: True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. ) @@ -142,6 +145,9 @@ class SubjectStatusView(base.ModelBase): last_reviewed_by: t.Optional[string_formats.Did] = None #: Last reviewed by. mute_reporting_until: t.Optional[string_formats.DateTime] = None #: Mute reporting until. mute_until: t.Optional[string_formats.DateTime] = None #: Mute until. + records_stats: t.Optional['models.ToolsOzoneModerationDefs.RecordsStats'] = ( + None #: Statistics related to the record subjects authored by the subject's account. + ) subject_blob_cids: t.Optional[t.List[string_formats.Cid]] = None #: Subject blob cids. subject_repo_handle: t.Optional[str] = None #: Subject repo handle. suspend_until: t.Optional[string_formats.DateTime] = None #: Suspend until. @@ -153,6 +159,37 @@ class SubjectStatusView(base.ModelBase): ) +class AccountStats(base.ModelBase): + """Definition model for :obj:`tools.ozone.moderation.defs`. Statistics about a particular account subject.""" + + appeal_count: t.Optional[int] = None #: Total number of appeals against a moderation action on the account. + escalate_count: t.Optional[int] = None #: Number of times the account was escalated. + report_count: t.Optional[int] = None #: Total number of reports on the account. + suspend_count: t.Optional[int] = None #: Number of times the account was suspended. + takedown_count: t.Optional[int] = None #: Number of times the account was taken down. + + py_type: t.Literal['tools.ozone.moderation.defs#accountStats'] = Field( + default='tools.ozone.moderation.defs#accountStats', alias='$type', frozen=True + ) + + +class RecordsStats(base.ModelBase): + """Definition model for :obj:`tools.ozone.moderation.defs`. Statistics about a set of record subject items.""" + + appealed_count: t.Optional[int] = None #: Number of items that were appealed at least once. + escalated_count: t.Optional[int] = None #: Number of items that were escalated at least once. + pending_count: t.Optional[int] = None #: Number of item currently in "reviewOpen" or "reviewEscalated" state. + processed_count: t.Optional[int] = None #: Number of item currently in "reviewNone" or "reviewClosed" state. + reported_count: t.Optional[int] = None #: Number of items that were reported at least once. + subject_count: t.Optional[int] = None #: Total number of item in the set. + takendown_count: t.Optional[int] = None #: Number of item currently taken down. + total_reports: t.Optional[int] = None #: Cumulative sum of the number of reports on the items in the set. + + py_type: t.Literal['tools.ozone.moderation.defs#recordsStats'] = Field( + default='tools.ozone.moderation.defs#recordsStats', alias='$type', frozen=True + ) + + SubjectReviewState = t.Union[ 'models.ToolsOzoneModerationDefs.ReviewOpen', 'models.ToolsOzoneModerationDefs.ReviewEscalated', diff --git a/packages/atproto_client/models/tools/ozone/moderation/query_statuses.py b/packages/atproto_client/models/tools/ozone/moderation/query_statuses.py index b468d25f..b55471af 100644 --- a/packages/atproto_client/models/tools/ozone/moderation/query_statuses.py +++ b/packages/atproto_client/models/tools/ozone/moderation/query_statuses.py @@ -51,6 +51,15 @@ class Params(base.ParamsModelBase): None #: Get all subject statuses that were reviewed by a specific moderator. ) limit: t.Optional[int] = Field(default=50, ge=1, le=100) #: Limit. + min_account_suspend_count: t.Optional[int] = ( + None #: If specified, only subjects that belong to an account that has at least this many suspensions will be returned. + ) + min_reported_records_count: t.Optional[int] = ( + None #: If specified, only subjects that belong to an account that has at least this many reported records will be returned. + ) + min_takendown_records_count: t.Optional[int] = ( + None #: If specified, only subjects that belong to an account that has at least this many taken down records will be returned. + ) only_muted: t.Optional[bool] = None #: When set to true, only muted subjects and reporters will be returned. queue_count: t.Optional[int] = ( None #: Number of queues being used by moderators. Subjects will be split among all queues. @@ -65,9 +74,14 @@ class Params(base.ParamsModelBase): reviewed_after: t.Optional[string_formats.DateTime] = None #: Search subjects reviewed after a given timestamp. reviewed_before: t.Optional[string_formats.DateTime] = None #: Search subjects reviewed before a given timestamp. sort_direction: t.Optional[t.Union[t.Literal['asc'], t.Literal['desc']]] = 'desc' #: Sort direction. - sort_field: t.Optional[t.Union[t.Literal['lastReviewedAt'], t.Literal['lastReportedAt']]] = ( - 'lastReportedAt' #: Sort field. - ) + sort_field: t.Optional[ + t.Union[ + t.Literal['lastReviewedAt'], + t.Literal['lastReportedAt'], + t.Literal['reportedRecordsCount'], + t.Literal['takendownRecordsCount'], + ] + ] = 'lastReportedAt' #: Sort field. subject: t.Optional[string_formats.Uri] = None #: The subject to get the status for. subject_type: t.Optional[t.Union[t.Literal['account'], t.Literal['record'], str]] = ( None #: If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. @@ -110,6 +124,15 @@ class ParamsDict(t.TypedDict): t.Optional[string_formats.Did] ] #: Get all subject statuses that were reviewed by a specific moderator. limit: te.NotRequired[t.Optional[int]] #: Limit. + min_account_suspend_count: te.NotRequired[ + t.Optional[int] + ] #: If specified, only subjects that belong to an account that has at least this many suspensions will be returned. + min_reported_records_count: te.NotRequired[ + t.Optional[int] + ] #: If specified, only subjects that belong to an account that has at least this many reported records will be returned. + min_takendown_records_count: te.NotRequired[ + t.Optional[int] + ] #: If specified, only subjects that belong to an account that has at least this many taken down records will be returned. only_muted: te.NotRequired[ t.Optional[bool] ] #: When set to true, only muted subjects and reporters will be returned. @@ -135,7 +158,14 @@ class ParamsDict(t.TypedDict): ] #: Search subjects reviewed before a given timestamp. sort_direction: te.NotRequired[t.Optional[t.Union[t.Literal['asc'], t.Literal['desc']]]] #: Sort direction. sort_field: te.NotRequired[ - t.Optional[t.Union[t.Literal['lastReviewedAt'], t.Literal['lastReportedAt']]] + t.Optional[ + t.Union[ + t.Literal['lastReviewedAt'], + t.Literal['lastReportedAt'], + t.Literal['reportedRecordsCount'], + t.Literal['takendownRecordsCount'], + ] + ] ] #: Sort field. subject: te.NotRequired[t.Optional[string_formats.Uri]] #: The subject to get the status for. subject_type: te.NotRequired[ diff --git a/packages/atproto_client/models/type_conversion.py b/packages/atproto_client/models/type_conversion.py index 6b47627b..198fbb4b 100644 --- a/packages/atproto_client/models/type_conversion.py +++ b/packages/atproto_client/models/type_conversion.py @@ -16,4 +16,5 @@ 'app.bsky.graph.starterpack': models.AppBskyGraphStarterpack.Record, 'app.bsky.labeler.service': models.AppBskyLabelerService.Record, 'chat.bsky.actor.declaration': models.ChatBskyActorDeclaration.Record, + 'com.atproto.lexicon.schema': models.ComAtprotoLexiconSchema.Record, } diff --git a/packages/atproto_client/models/unknown_type.py b/packages/atproto_client/models/unknown_type.py index 1c74afdb..af7f0232 100644 --- a/packages/atproto_client/models/unknown_type.py +++ b/packages/atproto_client/models/unknown_type.py @@ -23,6 +23,7 @@ 'models.AppBskyGraphStarterpack.Record', 'models.AppBskyLabelerService.Record', 'models.ChatBskyActorDeclaration.Record', + 'models.ComAtprotoLexiconSchema.Record', ] UnknownRecordTypePydantic = te.Annotated[ t.Union[ @@ -41,6 +42,7 @@ 'models.AppBskyGraphStarterpack.Record', 'models.AppBskyLabelerService.Record', 'models.ChatBskyActorDeclaration.Record', + 'models.ComAtprotoLexiconSchema.Record', ], Field(discriminator='py_type'), ] diff --git a/packages/atproto_client/namespaces/async_ns.py b/packages/atproto_client/namespaces/async_ns.py index 6dd6feac..e199ecc3 100644 --- a/packages/atproto_client/namespaces/async_ns.py +++ b/packages/atproto_client/namespaces/async_ns.py @@ -4467,6 +4467,7 @@ def __init__(self, client: 'AsyncClientRaw') -> None: self.admin = ComAtprotoAdminNamespace(self._client) self.identity = ComAtprotoIdentityNamespace(self._client) self.label = ComAtprotoLabelNamespace(self._client) + self.lexicon = ComAtprotoLexiconNamespace(self._client) self.moderation = ComAtprotoModerationNamespace(self._client) self.repo = ComAtprotoRepoNamespace(self._client) self.server = ComAtprotoServerNamespace(self._client) @@ -5041,6 +5042,164 @@ async def query_labels( return get_response_model(response, models.ComAtprotoLabelQueryLabels.Response) +class ComAtprotoLexiconSchemaRecord(AsyncRecordBase): + async def get( + self, repo: str, rkey: str, cid: t.Optional[str] = None, **kwargs: t.Any + ) -> 'models.ComAtprotoLexiconSchema.GetRecordResponse': + """Get a record. + + Args: + repo: The repository (DID). + rkey: The record key (TID). + cid: The CID of the record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.GetRecordResponse`: Get record response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = models.ComAtprotoRepoGetRecord.Params( + collection='com.atproto.lexicon.schema', repo=repo, rkey=rkey, cid=cid + ) + response = await self._client.invoke_query( + 'com.atproto.repo.getRecord', params=params_model, output_encoding='application/json', **kwargs + ) + response_model = get_response_model(response, models.ComAtprotoRepoGetRecord.Response) + return models.ComAtprotoLexiconSchema.GetRecordResponse( + uri=response_model.uri, + cid=response_model.cid, + value=t.cast('models.ComAtprotoLexiconSchema.Record', response_model.value), + ) + + async def list( + self, + repo: str, + cursor: t.Optional[str] = None, + limit: t.Optional[int] = None, + reverse: t.Optional[bool] = None, + **kwargs: t.Any, + ) -> 'models.ComAtprotoLexiconSchema.ListRecordsResponse': + """List a range of records in a collection. + + Args: + repo: The repository (DID). + cursor: The cursor. + limit: The limit. + reverse: Whether to reverse the order. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.ListRecordsResponse`: List records response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = models.ComAtprotoRepoListRecords.Params( + collection='com.atproto.lexicon.schema', + repo=repo, + cursor=cursor, + limit=limit, + reverse=reverse, + ) + response = await self._client.invoke_query( + 'com.atproto.repo.listRecords', params=params_model, output_encoding='application/json', **kwargs + ) + response_model = get_response_model(response, models.ComAtprotoRepoListRecords.Response) + return models.ComAtprotoLexiconSchema.ListRecordsResponse( + records={ + record.uri: t.cast('models.ComAtprotoLexiconSchema.Record', record.value) + for record in response_model.records + }, + cursor=response_model.cursor, + ) + + async def create( + self, + repo: str, + record: 'models.ComAtprotoLexiconSchema.Record', + rkey: t.Optional[str] = None, + swap_commit: t.Optional[str] = None, + validate: t.Optional[bool] = True, + **kwargs: t.Any, + ) -> 'models.ComAtprotoLexiconSchema.CreateRecordResponse': + """Create a new record. + + Args: + repo: The repository (DID). + record: The record. + rkey: The record key (TID). + swap_commit: The swap commit. + validate: Whether to validate the record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.CreateRecordResponse`: Create record response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + data_model = models.ComAtprotoRepoCreateRecord.Data( + collection='com.atproto.lexicon.schema', + repo=repo, + record=record, + rkey=rkey, + swap_commit=swap_commit, + validate_=validate, + ) + response = await self._client.invoke_procedure( + 'com.atproto.repo.createRecord', + data=data_model, + input_encoding='application/json', + output_encoding='application/json', + **kwargs, + ) + response_model = get_response_model(response, models.ComAtprotoRepoCreateRecord.Response) + return models.ComAtprotoLexiconSchema.CreateRecordResponse(uri=response_model.uri, cid=response_model.cid) + + async def delete( + self, + repo: str, + rkey: str, + swap_commit: t.Optional[str] = None, + swap_record: t.Optional[str] = None, + **kwargs: t.Any, + ) -> bool: + """Delete a record, or ensure it doesn't exist. + + Args: + repo: The repository (DID). + rkey: The record key (TID). + swap_commit: The swap commit. + swap_record: The swap record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`bool`: Success status. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + data_model = models.ComAtprotoRepoDeleteRecord.Data( + collection='com.atproto.lexicon.schema', + repo=repo, + rkey=rkey, + swap_commit=swap_commit, + swap_record=swap_record, + ) + response = await self._client.invoke_procedure( + 'com.atproto.repo.deleteRecord', data=data_model, input_encoding='application/json', **kwargs + ) + return get_response_model(response, bool) + + +class ComAtprotoLexiconNamespace(AsyncNamespaceBase): + def __init__(self, client: 'AsyncClientRaw') -> None: + super().__init__(client) + self.schema = ComAtprotoLexiconSchemaRecord(self._client) + + class ComAtprotoModerationNamespace(AsyncNamespaceBase): async def create_report( self, diff --git a/packages/atproto_client/namespaces/sync_ns.py b/packages/atproto_client/namespaces/sync_ns.py index a1e93e49..b1ce38fe 100644 --- a/packages/atproto_client/namespaces/sync_ns.py +++ b/packages/atproto_client/namespaces/sync_ns.py @@ -4467,6 +4467,7 @@ def __init__(self, client: 'ClientRaw') -> None: self.admin = ComAtprotoAdminNamespace(self._client) self.identity = ComAtprotoIdentityNamespace(self._client) self.label = ComAtprotoLabelNamespace(self._client) + self.lexicon = ComAtprotoLexiconNamespace(self._client) self.moderation = ComAtprotoModerationNamespace(self._client) self.repo = ComAtprotoRepoNamespace(self._client) self.server = ComAtprotoServerNamespace(self._client) @@ -5041,6 +5042,164 @@ def query_labels( return get_response_model(response, models.ComAtprotoLabelQueryLabels.Response) +class ComAtprotoLexiconSchemaRecord(RecordBase): + def get( + self, repo: str, rkey: str, cid: t.Optional[str] = None, **kwargs: t.Any + ) -> 'models.ComAtprotoLexiconSchema.GetRecordResponse': + """Get a record. + + Args: + repo: The repository (DID). + rkey: The record key (TID). + cid: The CID of the record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.GetRecordResponse`: Get record response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = models.ComAtprotoRepoGetRecord.Params( + collection='com.atproto.lexicon.schema', repo=repo, rkey=rkey, cid=cid + ) + response = self._client.invoke_query( + 'com.atproto.repo.getRecord', params=params_model, output_encoding='application/json', **kwargs + ) + response_model = get_response_model(response, models.ComAtprotoRepoGetRecord.Response) + return models.ComAtprotoLexiconSchema.GetRecordResponse( + uri=response_model.uri, + cid=response_model.cid, + value=t.cast('models.ComAtprotoLexiconSchema.Record', response_model.value), + ) + + def list( + self, + repo: str, + cursor: t.Optional[str] = None, + limit: t.Optional[int] = None, + reverse: t.Optional[bool] = None, + **kwargs: t.Any, + ) -> 'models.ComAtprotoLexiconSchema.ListRecordsResponse': + """List a range of records in a collection. + + Args: + repo: The repository (DID). + cursor: The cursor. + limit: The limit. + reverse: Whether to reverse the order. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.ListRecordsResponse`: List records response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = models.ComAtprotoRepoListRecords.Params( + collection='com.atproto.lexicon.schema', + repo=repo, + cursor=cursor, + limit=limit, + reverse=reverse, + ) + response = self._client.invoke_query( + 'com.atproto.repo.listRecords', params=params_model, output_encoding='application/json', **kwargs + ) + response_model = get_response_model(response, models.ComAtprotoRepoListRecords.Response) + return models.ComAtprotoLexiconSchema.ListRecordsResponse( + records={ + record.uri: t.cast('models.ComAtprotoLexiconSchema.Record', record.value) + for record in response_model.records + }, + cursor=response_model.cursor, + ) + + def create( + self, + repo: str, + record: 'models.ComAtprotoLexiconSchema.Record', + rkey: t.Optional[str] = None, + swap_commit: t.Optional[str] = None, + validate: t.Optional[bool] = True, + **kwargs: t.Any, + ) -> 'models.ComAtprotoLexiconSchema.CreateRecordResponse': + """Create a new record. + + Args: + repo: The repository (DID). + record: The record. + rkey: The record key (TID). + swap_commit: The swap commit. + validate: Whether to validate the record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.ComAtprotoLexiconSchema.CreateRecordResponse`: Create record response. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + data_model = models.ComAtprotoRepoCreateRecord.Data( + collection='com.atproto.lexicon.schema', + repo=repo, + record=record, + rkey=rkey, + swap_commit=swap_commit, + validate_=validate, + ) + response = self._client.invoke_procedure( + 'com.atproto.repo.createRecord', + data=data_model, + input_encoding='application/json', + output_encoding='application/json', + **kwargs, + ) + response_model = get_response_model(response, models.ComAtprotoRepoCreateRecord.Response) + return models.ComAtprotoLexiconSchema.CreateRecordResponse(uri=response_model.uri, cid=response_model.cid) + + def delete( + self, + repo: str, + rkey: str, + swap_commit: t.Optional[str] = None, + swap_record: t.Optional[str] = None, + **kwargs: t.Any, + ) -> bool: + """Delete a record, or ensure it doesn't exist. + + Args: + repo: The repository (DID). + rkey: The record key (TID). + swap_commit: The swap commit. + swap_record: The swap record. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`bool`: Success status. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + data_model = models.ComAtprotoRepoDeleteRecord.Data( + collection='com.atproto.lexicon.schema', + repo=repo, + rkey=rkey, + swap_commit=swap_commit, + swap_record=swap_record, + ) + response = self._client.invoke_procedure( + 'com.atproto.repo.deleteRecord', data=data_model, input_encoding='application/json', **kwargs + ) + return get_response_model(response, bool) + + +class ComAtprotoLexiconNamespace(NamespaceBase): + def __init__(self, client: 'ClientRaw') -> None: + super().__init__(client) + self.schema = ComAtprotoLexiconSchemaRecord(self._client) + + class ComAtprotoModerationNamespace(NamespaceBase): def create_report( self,