Call for Proposals

Manager for interacting with call for proposals resources.

class gpp_client.managers.call_for_proposals.CallForProposalsManager(client: GPPClient)[source]

Bases: BaseManager

Manager for interacting with call for proposals resources.

async create(*, properties: CallForProposalsPropertiesInput | None = None, from_json: str | Path | dict[str, Any] | None = None) dict[str, Any][source]

Create a new call for proposals.

Parameters:
  • properties (CallForProposalsPropertiesInput, optional) – Full definition of the call for proposals to create. This or from_json must be supplied.

  • from_json (str | Path | dict[str, Any], optional) – JSON representation of the properties. May be a path-like object (str or Path) to a JSON file, or a dict already containing the JSON data.

Returns:

The created call for proposals.

Return type:

dict[str, Any]

Raises:

Notes

Exactly one of properties or from_json must be supplied. Supplying both or neither raises GPPValidationError.

async delete_by_id(call_for_proposals_id: str) dict[str, Any][source]

Soft-delete a call for proposals.

Parameters:

call_for_proposals_id (str) – Unique identifier of the call for proposals.

Returns:

The deleted call for proposals payload.

Return type:

dict[str, Any]

Raises:
async get_all(*, include_deleted: bool = False, where: WhereCallForProposals | None = None, offset: int | None = None, limit: int | None = None) dict[str, Any][source]

Fetch all calls for proposals with optional filters and pagination.

Parameters:
  • include_deleted (bool, default=False) – Whether to include deleted entries.

  • where (WhereCallForProposals, optional) – Optional filtering clause.

  • offset (int, optional) – Pagination offset.

  • limit (int, optional) – Maximum number of results.

Returns:

Dictionary with matches and hasMore.

Return type:

dict[str, Any]

Raises:

GPPClientError – If an unexpected error occurs unpacking the response.

async get_by_id(call_for_proposals_id: str, *, include_deleted: bool = False) dict[str, Any][source]

Fetch a single call for proposals by its ID.

Parameters:
  • call_for_proposals_id (str) – Unique identifier of the call for proposals.

  • include_deleted (bool, default=False) – Whether to include deleted entries in the lookup.

Returns:

Retrieved call for proposals.

Return type:

dict[str, Any]

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:
  • result (dict[str, Any] | None) – The full GraphQL result.

  • operation_name (str | None, optional) – The name of the operation to extract. If None, and the result contains exactly one top-level key, that key is used.

Returns:

The extracted payload for the specified operation.

Return type:

dict[str, Any]

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:
  • payload (dict[str, Any]) – The GraphQL payload containing the field.

  • key (str) – The key of the field to extract.

Returns:

The single item extracted from the field.

Return type:

dict[str, Any]

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:
  • properties (T, optional) – Preconstructed properties instance. Returned unchanged when provided.

  • from_json (str | Path | dict[str, Any], optional) – Path to a JSON file or a dictionary containing the JSON data.

  • cls (type[T]) – Concrete PropertiesInput class for validation. Required.

Returns:

Instance of cls representing 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.

Parameters:
  • exc_class (type[GPPError]) – The exception class to raise (must accept a string message).

  • exc (Exception) – The original exception to wrap.

  • include_traceback (bool, default=False) – Whether to include the original traceback using from exc.

Raises:

type[GPPError] – The raised exception of the specified type.

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:
  • response (aiohttp.ClientResponse) – The HTTP response to check.

  • ok_statuses (set[int]) – Set of acceptable HTTP status codes.

  • default_message (str, default="Request failed") – Default error message if the response has no content.

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:
  • file_path (str | Path | None) – Path to a local file. If provided, it must exist and be a file.

  • content (bytes | None) – Raw bytes content.

Returns:

The resolved content bytes.

Return type:

bytes

Raises:
  • GPPValidationError – If both or neither of file_path and content are provided, or if file_path is invalid.

  • GPPClientError – If reading the file fails due to an unexpected I/O error.

async restore_by_id(call_for_proposals_id: str) dict[str, Any][source]

Restore a soft-deleted call for proposals.

Parameters:

call_for_proposals_id (str) – Unique identifier of the call for proposals.

Returns:

The restored call for proposals.

Return type:

dict[str, Any]

Raises:
async update_all(*, properties: CallForProposalsPropertiesInput | None = None, from_json: str | Path | dict[str, Any] | None = None, where: WhereCallForProposals | None = None, limit: int | None = None, include_deleted: bool = False) dict[str, Any][source]

Update multiple calls for proposals matching the given filter.

Parameters:
  • properties (CallForProposalsPropertiesInput, optional) – Values to set on the matching calls for proposals. This or from_json must be supplied.

  • from_json (str | Path | dict[str, Any], optional) – JSON representation of the properties. May be a path-like object (str or Path) to a JSON file, or a dict already containing the JSON data.

  • where (WhereProgram, optional) – Filter to determine which calls for proposals to update.

  • limit (int, optional) – Maximum number of calls for proposals to update.

  • include_deleted (bool, default=False) – Whether to include soft-deleted calls for proposals.

Returns:

Update result and updated calls for proposals.

Return type:

dict[str, Any]

Raises:

Notes

Exactly one of properties or from_json must be supplied. Supplying both or neither raises GPPValidationError.

async update_by_id(call_for_proposals_id: str, *, properties: CallForProposalsPropertiesInput | None = None, from_json: str | Path | dict[str, Any] | None = None, include_deleted: bool = False) dict[str, Any][source]

Update a single call for proposals by its ID.

Parameters:
  • call_for_proposals_id (str) – Unique identifier of the call for proposals to update.

  • properties (CallForProposalsPropertiesInput, optional) – New values to apply. This or from_json must be supplied.

  • from_json (str | Path | dict[str, Any], optional) – JSON representation of the properties. May be a path-like object (str or Path) to a JSON file, or a dict already containing the JSON data.

  • include_deleted (bool, default=False) – Whether to include soft-deleted calls for proposals in the update.

Returns:

The updated call for proposals.

Return type:

dict[str, Any]

Raises:

Notes

Exactly one of properties or from_json must be supplied. Supplying both or neither raises GPPValidationError.

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.