Configuration Request¶
Manager for interacting with configuration request resources.
- class gpp_client.managers.configuration_request.ConfigurationRequestManager(client: GPPClient)[source]¶
Bases:
BaseManagerManager for interacting with configuration request resources.
- async get_all(*, program_id: str | None = None, status: ConfigurationRequestStatus | None = None, where: WhereConfigurationRequest | None = None, offset: int | None = None, limit: int | None = None) dict[str, Any][source]¶
Retrieve all configuration requests with optional filters.
- Parameters:
program_id (str, optional) – Program ID to filter by.
status (ConfigurationRequestStatus, optional) – Status to filter by.
where (WhereConfigurationRequest, optional) – Filter criteria.
offset (int, optional) – Cursor offset (by ID).
limit (int, optional) – Maximum number of items.
- Returns:
A dictionary with the results.
- Return type:
- Raises:
GPPClientError – If an unexpected error occurs unpacking the response.
- async get_all_approved_by_program_id(*, program_id: str, where: WhereConfigurationRequest | None = None, offset: int | None = None, limit: int | None = None) dict[str, Any][source]¶
Convenience method for getting approved configuration requests by program ID.
- Parameters:
program_id (str, optional) – Program ID to filter by.
where (WhereConfigurationRequest, optional) – Filter criteria.
offset (int, optional) – Cursor offset (by ID).
limit (int, optional) – Maximum number of items.
- Returns:
A dictionary with the results.
- Return type:
- Raises:
GPPClientError – If an unexpected error occurs unpacking the response.
- get_result(result: dict[str, Any] | None, operation_name: str | None = None) dict[str, Any]¶
Extract the payload for a given GraphQL operation.
- Parameters:
- Returns:
The extracted payload for the specified operation.
- Return type:
- Raises:
GPPClientError – If the result is empty or invalid, or if the specified operation name is not found in the result.
- get_single_result(payload: dict[str, Any], key: str) dict[str, Any]¶
Extract exactly one item from a list-valued field in a GraphQL payload.
- Parameters:
- Returns:
The single item extracted from the field.
- Return type:
- Raises:
GPPClientError – If the specified field is missing from the payload, is not a list, or does not contain exactly one item.
- load_properties(*, properties: Any | None, from_json: str | Path | dict[str, Any] | None, cls: type[T]) T¶
Return a validated properties object from exactly one data source.
- Parameters:
- Returns:
Instance of
clsrepresenting the validated properties.- Return type:
T
- Raises:
GPPValidationError – If validation fails or an error occurs loading the properties.
- raise_error(exc_class: type[GPPError], exc: Exception, *, include_traceback: bool = False) NoReturn¶
Raise a structured exception with contextual information.
- async raise_for_status(response, *, ok_statuses: set[int], default_message: str = 'Request failed') None¶
Raise an exception if the HTTP response status is not OK.
- Parameters:
- Raises:
GPPResponseError – If the response status is not in
ok_statuses.
- resolve_content(*, file_path: str | Path | None, content: bytes | None) bytes¶
Resolve upload content bytes from exactly one source.
- Parameters:
- Returns:
The resolved content bytes.
- Return type:
- Raises:
GPPValidationError – If both or neither of
file_pathandcontentare provided, or iffile_pathis invalid.GPPClientError – If reading the file fails due to an unexpected I/O error.
- validate_single_identifier(**kwargs) None¶
Validate that exactly one identifier is provided.
This helper checks that exactly one of the provided keyword arguments is non-None. It raises a ValueError otherwise.
- Parameters:
**kwargs (dict[str, Optional[str]]) – A dictionary of identifier keyword arguments to validate.
- Raises:
GPPValidationError – If none or more than one identifiers are provided.