diff --git a/docs/source/aliases_db.py b/docs/source/aliases_db.py index dd870d17..cfb6686c 100644 --- a/docs/source/aliases_db.py +++ b/docs/source/aliases_db.py @@ -81,6 +81,7 @@ 'models.AppBskyUnspeccedGetPopularFeedGenerators': 'atproto_client.models.app.bsky.unspecced.get_popular_feed_generators', 'models.AppBskyUnspeccedGetSuggestionsSkeleton': 'atproto_client.models.app.bsky.unspecced.get_suggestions_skeleton', 'models.AppBskyUnspeccedGetTaggedSuggestions': 'atproto_client.models.app.bsky.unspecced.get_tagged_suggestions', + 'models.AppBskyUnspeccedGetTrendingTopics': 'atproto_client.models.app.bsky.unspecced.get_trending_topics', 'models.AppBskyUnspeccedSearchActorsSkeleton': 'atproto_client.models.app.bsky.unspecced.search_actors_skeleton', 'models.AppBskyUnspeccedSearchPostsSkeleton': 'atproto_client.models.app.bsky.unspecced.search_posts_skeleton', 'models.AppBskyUnspeccedSearchStarterPacksSkeleton': 'atproto_client.models.app.bsky.unspecced.search_starter_packs_skeleton', diff --git a/docs/source/atproto/atproto_client.models.app.bsky.unspecced.get_trending_topics.rst b/docs/source/atproto/atproto_client.models.app.bsky.unspecced.get_trending_topics.rst new file mode 100644 index 00000000..a0a1704f --- /dev/null +++ b/docs/source/atproto/atproto_client.models.app.bsky.unspecced.get_trending_topics.rst @@ -0,0 +1,7 @@ +app.bsky.unspecced.get\_trending\_topics +=============================================================== + +.. automodule:: atproto_client.models.app.bsky.unspecced.get_trending_topics + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/atproto/atproto_client.models.app.bsky.unspecced.rst b/docs/source/atproto/atproto_client.models.app.bsky.unspecced.rst index db94f50b..e40c6a1e 100644 --- a/docs/source/atproto/atproto_client.models.app.bsky.unspecced.rst +++ b/docs/source/atproto/atproto_client.models.app.bsky.unspecced.rst @@ -17,6 +17,7 @@ Submodules atproto_client.models.app.bsky.unspecced.get_popular_feed_generators atproto_client.models.app.bsky.unspecced.get_suggestions_skeleton atproto_client.models.app.bsky.unspecced.get_tagged_suggestions + atproto_client.models.app.bsky.unspecced.get_trending_topics atproto_client.models.app.bsky.unspecced.search_actors_skeleton atproto_client.models.app.bsky.unspecced.search_posts_skeleton atproto_client.models.app.bsky.unspecced.search_starter_packs_skeleton diff --git a/lexicons/app.bsky.unspecced.defs.json b/lexicons/app.bsky.unspecced.defs.json index 2391181d..d8bdd6c6 100644 --- a/lexicons/app.bsky.unspecced.defs.json +++ b/lexicons/app.bsky.unspecced.defs.json @@ -22,6 +22,16 @@ "properties": { "uri": { "type": "string", "format": "at-uri" } } + }, + "trendingTopic": { + "type": "object", + "required": ["topic", "link"], + "properties": { + "topic": { "type": "string" }, + "displayName": { "type": "string" }, + "description": { "type": "string" }, + "link": { "type": "string" } + } } } } diff --git a/lexicons/app.bsky.unspecced.getTrendingTopics.json b/lexicons/app.bsky.unspecced.getTrendingTopics.json new file mode 100644 index 00000000..097dc1c5 --- /dev/null +++ b/lexicons/app.bsky.unspecced.getTrendingTopics.json @@ -0,0 +1,49 @@ +{ + "lexicon": 1, + "id": "app.bsky.unspecced.getTrendingTopics", + "defs": { + "main": { + "type": "query", + "description": "Get a list of trending topics", + "parameters": { + "type": "params", + "properties": { + "viewer": { + "type": "string", + "format": "did", + "description": "DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking." + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 25, + "default": 10 + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["topics", "suggested"], + "properties": { + "topics": { + "type": "array", + "items": { + "type": "ref", + "ref": "app.bsky.unspecced.defs#trendingTopic" + } + }, + "suggested": { + "type": "array", + "items": { + "type": "ref", + "ref": "app.bsky.unspecced.defs#trendingTopic" + } + } + } + } + } + } + } +} diff --git a/packages/atproto_client/models/__init__.py b/packages/atproto_client/models/__init__.py index 0fb885f5..9783f1c9 100644 --- a/packages/atproto_client/models/__init__.py +++ b/packages/atproto_client/models/__init__.py @@ -84,6 +84,7 @@ ) from atproto_client.models.app.bsky.unspecced import get_suggestions_skeleton as AppBskyUnspeccedGetSuggestionsSkeleton from atproto_client.models.app.bsky.unspecced import get_tagged_suggestions as AppBskyUnspeccedGetTaggedSuggestions +from atproto_client.models.app.bsky.unspecced import get_trending_topics as AppBskyUnspeccedGetTrendingTopics from atproto_client.models.app.bsky.unspecced import search_actors_skeleton as AppBskyUnspeccedSearchActorsSkeleton from atproto_client.models.app.bsky.unspecced import search_posts_skeleton as AppBskyUnspeccedSearchPostsSkeleton from atproto_client.models.app.bsky.unspecced import ( @@ -329,6 +330,7 @@ class _Ids: AppBskyUnspeccedGetPopularFeedGenerators: str = 'app.bsky.unspecced.getPopularFeedGenerators' AppBskyUnspeccedGetSuggestionsSkeleton: str = 'app.bsky.unspecced.getSuggestionsSkeleton' AppBskyUnspeccedGetTaggedSuggestions: str = 'app.bsky.unspecced.getTaggedSuggestions' + AppBskyUnspeccedGetTrendingTopics: str = 'app.bsky.unspecced.getTrendingTopics' AppBskyUnspeccedSearchActorsSkeleton: str = 'app.bsky.unspecced.searchActorsSkeleton' AppBskyUnspeccedSearchPostsSkeleton: str = 'app.bsky.unspecced.searchPostsSkeleton' AppBskyUnspeccedSearchStarterPacksSkeleton: str = 'app.bsky.unspecced.searchStarterPacksSkeleton' diff --git a/packages/atproto_client/models/app/bsky/unspecced/defs.py b/packages/atproto_client/models/app/bsky/unspecced/defs.py index 8f6e4efc..cef06ae7 100644 --- a/packages/atproto_client/models/app/bsky/unspecced/defs.py +++ b/packages/atproto_client/models/app/bsky/unspecced/defs.py @@ -40,3 +40,16 @@ class SkeletonSearchStarterPack(base.ModelBase): py_type: t.Literal['app.bsky.unspecced.defs#skeletonSearchStarterPack'] = Field( default='app.bsky.unspecced.defs#skeletonSearchStarterPack', alias='$type', frozen=True ) + + +class TrendingTopic(base.ModelBase): + """Definition model for :obj:`app.bsky.unspecced.defs`.""" + + link: str #: Link. + topic: str #: Topic. + description: t.Optional[str] = None #: Description. + display_name: t.Optional[str] = None #: Display name. + + py_type: t.Literal['app.bsky.unspecced.defs#trendingTopic'] = Field( + default='app.bsky.unspecced.defs#trendingTopic', alias='$type', frozen=True + ) diff --git a/packages/atproto_client/models/app/bsky/unspecced/get_trending_topics.py b/packages/atproto_client/models/app/bsky/unspecced/get_trending_topics.py new file mode 100644 index 00000000..1b7f28b5 --- /dev/null +++ b/packages/atproto_client/models/app/bsky/unspecced/get_trending_topics.py @@ -0,0 +1,40 @@ +################################################################## +# 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 + +import typing_extensions as te +from pydantic import Field + +from atproto_client.models import string_formats + +if t.TYPE_CHECKING: + from atproto_client import models +from atproto_client.models import base + + +class Params(base.ParamsModelBase): + """Parameters model for :obj:`app.bsky.unspecced.getTrendingTopics`.""" + + limit: t.Optional[int] = Field(default=10, ge=1, le=25) #: Limit. + viewer: t.Optional[string_formats.Did] = ( + None #: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. + ) + + +class ParamsDict(t.TypedDict): + limit: te.NotRequired[t.Optional[int]] #: Limit. + viewer: te.NotRequired[ + t.Optional[string_formats.Did] + ] #: DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking. + + +class Response(base.ResponseModelBase): + """Output data model for :obj:`app.bsky.unspecced.getTrendingTopics`.""" + + suggested: t.List['models.AppBskyUnspeccedDefs.TrendingTopic'] #: Suggested. + topics: t.List['models.AppBskyUnspeccedDefs.TrendingTopic'] #: Topics. diff --git a/packages/atproto_client/namespaces/async_ns.py b/packages/atproto_client/namespaces/async_ns.py index 0528782e..6dd6feac 100644 --- a/packages/atproto_client/namespaces/async_ns.py +++ b/packages/atproto_client/namespaces/async_ns.py @@ -3642,6 +3642,36 @@ async def get_tagged_suggestions( ) return get_response_model(response, models.AppBskyUnspeccedGetTaggedSuggestions.Response) + async def get_trending_topics( + self, + params: t.Optional[ + t.Union[ + models.AppBskyUnspeccedGetTrendingTopics.Params, models.AppBskyUnspeccedGetTrendingTopics.ParamsDict + ] + ] = None, + **kwargs: t.Any, + ) -> 'models.AppBskyUnspeccedGetTrendingTopics.Response': + """Get a list of trending topics. + + Args: + params: Parameters. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.AppBskyUnspeccedGetTrendingTopics.Response`: Output model. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = t.cast( + 'models.AppBskyUnspeccedGetTrendingTopics.Params', + get_or_create(params, models.AppBskyUnspeccedGetTrendingTopics.Params), + ) + response = await self._client.invoke_query( + 'app.bsky.unspecced.getTrendingTopics', params=params_model, output_encoding='application/json', **kwargs + ) + return get_response_model(response, models.AppBskyUnspeccedGetTrendingTopics.Response) + async def search_actors_skeleton( self, params: t.Union[ diff --git a/packages/atproto_client/namespaces/sync_ns.py b/packages/atproto_client/namespaces/sync_ns.py index 8b35c295..a1e93e49 100644 --- a/packages/atproto_client/namespaces/sync_ns.py +++ b/packages/atproto_client/namespaces/sync_ns.py @@ -3642,6 +3642,36 @@ def get_tagged_suggestions( ) return get_response_model(response, models.AppBskyUnspeccedGetTaggedSuggestions.Response) + def get_trending_topics( + self, + params: t.Optional[ + t.Union[ + models.AppBskyUnspeccedGetTrendingTopics.Params, models.AppBskyUnspeccedGetTrendingTopics.ParamsDict + ] + ] = None, + **kwargs: t.Any, + ) -> 'models.AppBskyUnspeccedGetTrendingTopics.Response': + """Get a list of trending topics. + + Args: + params: Parameters. + **kwargs: Arbitrary arguments to HTTP request. + + Returns: + :obj:`models.AppBskyUnspeccedGetTrendingTopics.Response`: Output model. + + Raises: + :class:`atproto.exceptions.AtProtocolError`: Base exception. + """ + params_model = t.cast( + 'models.AppBskyUnspeccedGetTrendingTopics.Params', + get_or_create(params, models.AppBskyUnspeccedGetTrendingTopics.Params), + ) + response = self._client.invoke_query( + 'app.bsky.unspecced.getTrendingTopics', params=params_model, output_encoding='application/json', **kwargs + ) + return get_response_model(response, models.AppBskyUnspeccedGetTrendingTopics.Response) + def search_actors_skeleton( self, params: t.Union[