psnawp_api.models.search.users_search module#
Implements the endpoints to search users.
- class UniversalUsersSearchIterator(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, search_query: str, next_cursor: str)[source]#
Bases:
PaginationIterator[UserSearchResultItem]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:
authenticator (Authenticator) – Instance of Authenticator class. Used to make authenticated HTTPs request to playstation server.
search_query (str) – The search query string used to query the universal search endpoint.
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 UniversalUsersSearchIterator 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.
next_cursor – The cursor for fetching the next page of results.
next_cursor – The cursor for fetching the next page of results.
- __init__(authenticator: Authenticator, url: str, pagination_args: PaginationArguments, search_query: str, next_cursor: str) None[source]#
Initializes the UniversalUsersSearchIterator 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.
next_cursor – The cursor for fetching the next page of results.
next_cursor – The cursor for fetching the next page of results.
- fetch_next_page() Generator[UserSearchResultItem, 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) Generator[UserSearchResultItem, None, None][source]#
Initiates a user search and yields results based on the specified search domain.
This method uses two endpoints:
The first retrieves a initial result for users.
The second iterates over paginated results.
- 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
SearchResultobjects 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, next_cursor: str) Self[source]#
Creates an instance of
UniversalUsersSearchIteratorfrom api endpoint.