psnawp_api.models.search.games_search module#
Implements the endpoints to search games.
- class UniversalDomainSearchIterator(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, search_query: str, search_domain: SearchDomain, next_cursor: str)[source]#
Bases:
PaginationIterator[GameSearchResultItem]Iterator for paginating over universal search results within a specific domain.
This iterator handles the pagination logic for querying the PlayStation Network’s universal search API, which can be used to search across different domains (e.g., games, add-ons, users). It allows for iterating over search results based on the provided search query and domain.
- Variables:
search_query (str) – The search query string used to query the universal search endpoint.
search_domain (SearchDomain) – The specific domain within which the search is performed (e.g., games, add-ons, users).
next_cursor (str) – The cursor used for paginating to the next set of results.
Note
This class is intended to be used via UniversalSearch. See
UniversalSearch.Initializes the UniversalDomainSearchIterator with the provided parameters.
This iterator fetches search results from the PlayStation universal search API and manages pagination.
- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
url – The URL of the universal search endpoint.
pagination_args – Pagination-specific arguments, such as page size and limit, passed to the endpoint.
search_query – The search query string to search for specific content.
search_domain – The domain to search within (e.g., games, add-ons, users).
next_cursor – The cursor for fetching the next page of results.
- __init__(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, search_query: str, search_domain: SearchDomain, next_cursor: str) None[source]#
Initializes the UniversalDomainSearchIterator with the provided parameters.
This iterator fetches search results from the PlayStation universal search API and manages pagination.
- Parameters:
authenticator – The Authenticator instance used for making authenticated requests to the API.
url – The URL of the universal search endpoint.
pagination_args – Pagination-specific arguments, such as page size and limit, passed to the endpoint.
search_query – The search query string to search for specific content.
search_domain – The domain to search within (e.g., games, add-ons, users).
next_cursor – The cursor for fetching the next page of results.
- fetch_next_page() Generator[GameSearchResultItem, None, None][source]#
Fetches the next page of Search Result objects from the API.
- Yield:
A generator yielding Result objects.
- classmethod fetch_results(authenticator: Authenticator, pagination_args: PaginationArguments, search_query: str, search_domain: SearchDomain) Generator[GameSearchResultItem, None, None][source]#
Initiates a game search and yields results based on the specified search domain.
This method uses two endpoints: - The first retrieves a mix of full games and add-ons. - The second iterates over paginated results in the selected domain.
- Parameters:
authenticator – Instance of
Authenticatorused for authenticated API requests.pagination_args – Pagination control including current offset and limit.
search_query – The query string to search for content.
search_domain – The content domain to search within (e.g., full games or add-ons).
- Yield:
Yields individual
GameSearchResultItemobjects until the limit is reached. If more results are available, continues yielding from the appropriate paginated endpoint.
- classmethod from_endpoint(authenticator: Authenticator, pagination_args: PaginationArguments, search_query: str, search_domain: SearchDomain, next_cursor: str) Self[source]#
Creates an instance of
UniversalDomainSearchIteratorfrom api endpoint.