Press-Spec

Specs client module.

peak.press.specs.get_client(session=None)

Returns a Spec client.

Parameters:

session (Optional[Session]) – A Session Object. If no session is provided, a default session is used.

Returns:

the Spec client object

Return type:

Spec

Press-Spec Client

class peak.press.specs.Spec(session=None)

Client class for interacting with Specs.

Parameters:

session (Session) –

list_spec_release_deployments(spec_id: str, version: str | None, status: List[str] | None = None, name: str | None = None, title: str | None = None, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
list_spec_release_deployments(spec_id: str, version: str | None, status: List[str] | None = None, name: str | None = None, title: str | None = None, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]

Get all deployments of a App or Block spec release (ordered by most recently created to oldest).

REFERENCE:

🔗 API Documentation

Parameters:
  • spec_id (str) – The ID of the App or Block spec.

  • version (str | None) – The release version of the spec in valid semantic versioning format. If not provided, all deployments are returned.

  • status (List[str] | None) – List of statuses to filter deployments. Valid values are deleting, delete_failed, deployed, deploying, failed, platform_resource_error, redeploying, rollback, rollback_complete, rollback_failed and warning.

  • name (str | None) – String to filter deployments by name.

  • title (str | None) – String to filter deployments by title.

  • sort (List[str] | None) – List of fields with desired ordering in the format [<field>:<order>, …], where order is one of [‘asc’, ‘desc’] and field is an ordered parameter within the response. Valid fields are createdAt, createdBy and name.

  • page_size (int | None) – Number of specs to include per page.

  • page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.

  • return_iterator (bool) – Whether to return an iterator object or list of specs for a specified page number, defaults to True.

Returns:

an iterator object which returns an element per iteration, until there are no more elements to return. If return_iterator is set to False, a dictionary containing the list and pagination details is returned instead.

Set return_iterator to True if you want automatic client-side pagination, or False if you want server-side pagination.

Return type:

Iterator[Dict[str, Any] | Dict[str, Any]

Raises:
  • BadRequestException – The given parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • NotFoundException – The given spec does not exist.

  • InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.

list_specs(status: List[str] | None = None, featured: bool | None = None, kind: str | None = None, term: str | None = None, sort: List[str] | None = None, scope: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
list_specs(status: List[str] | None = None, featured: bool | None = None, kind: str | None = None, term: str | None = None, sort: List[str] | None = None, scope: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]

List all published App & Block Specs ordered by creation date. Returns info on the latest release of each spec.

REFERENCE:

🔗 API Documentation

Parameters:
  • status (List[str] | None) – List of statuses to filter specs. Valid values are available, unavailable and archived.

  • featured (bool | None) – Whether to only return featured specs.

  • kind (str | None) – Return specs of the kind specified.

  • term (str | None) – Return specs containing the specified term in name, title, description and summary.

  • sort (List[str] | None) – List of fields with desired ordering in the format [<field>:<order>, …], where order is one of [‘asc’, ‘desc’] and field is an ordered parameter within the response, defaults to []. Valid fields are createdAt, createdBy, name and title.

  • scope (List[str] | None) – List of scopes to only return specs of those scopes. Valid values are private, public and shared.

  • page_size (int | None) – Number of specs to include per page.

  • page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.

  • return_iterator (bool) – Whether to return an iterator object or list of specs for a specified page number, defaults to True.

Returns:

An iterator object which returns an element per iteration, until there are no more elements to return. If return_iterator is set to False, a dictionary containing the list and pagination details is returned instead.

Set return_iterator to True if you want automatic client-side pagination, or False if you want server-side pagination.

Return type:

Iterator[Dict[str, Any]] | Dict[str, Any]

Raises:
  • BadRequestException – The given parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.

  • StopIteration – There are no more pages to list.