sinch.domains.voice.api.v2.services_apis module

class sinch.domains.voice.api.v2.services_apis.Services(sinch)[source]

Bases: BaseVoice

list(
filter: str | None = None,
is_default: bool | None = None,
page_size: int | None = None,
page: int | None = None,
**kwargs,
) Paginator[ListServicesResponse, ServiceShortResponse][source]

List and filter the services configured for a project.

Parameters:
  • filter (Optional[str]) – (optional) Filter services by name or description. Returns all services where either the name or description contains the specified value (case-insensitive partial match).

  • is_default (Optional[bool]) – (optional) Return only the default service.

  • page_size (Optional[int]) – (optional) Number of items to be returned on each page.

  • page (Optional[int]) – (optional) Page number (1-based).

  • **kwargs

    Additional parameters for the request.

Returns:

LinkBasedPaginator with ServiceShortResponse items

Return type:

Paginator[ListServicesResponse,ServiceShortResponse]

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

create(
name: str,
description: str | None | Unset = <sinch.core.sentinel.Unset object>,
is_default: bool | None | Unset = <sinch.core.sentinel.Unset object>,
call_behavior: StaticCallBehaviorDict,
FieldInfo(annotation=NoneType,
required=True,
discriminator='type')] | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>,
idempotency_key: str | None | Unset = <sinch.core.sentinel.Unset object>,
**kwargs,
) ServiceResponse[source]

Creates a new voice service.

Parameters:
  • name (str) – (required) The name of the service. Must be 1-64 characters, with no leading, trailing, or repeated whitespace. Regex pattern: ^S+(s+S+)*$.

  • description (UnsetOr[Optional[str]]) – (optional) A description of the service. Must be at most 255 characters, with no leading, trailing, or repeated whitespace. Regex pattern: ^S+(s+S+)*$.

  • is_default (UnsetOr[Optional[bool]]) – (optional) Whether this service is the project default. The default service is used when no specific service is specified in API requests

  • call_behavior (UnsetOr[Optional[CallBehaviorDict]]) – (optional) Defines how calls are handled for this service.

  • idempotency_key (UnsetOr[Optional[str]]) – (optional) Client-generated idempotency key to safely retry requests. If a request with the same key is received within 10 minutes, the cached response from the original request is returned. Using a random UUID (v4) is strongly recommended.

  • **kwargs

    Additional parameters for the request.

Returns:

The created service.

Return type:

ServiceResponse

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

get(
service_id: str,
**kwargs,
) ServiceResponse[source]

Retrieve detailed information about a specific service using its unique identifier.

Parameters:
  • service_id (str) – (required) The ID of the service.

  • **kwargs

    Additional parameters for the request.

Returns:

The service details.

Return type:

ServiceResponse

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

update(
service_id: str,
name: str | None | Unset = <sinch.core.sentinel.Unset object>,
description: str | None | Unset = <sinch.core.sentinel.Unset object>,
is_default: Literal[True] | None | Unset = <sinch.core.sentinel.Unset object>,
call_behavior: StaticCallBehaviorDict,
FieldInfo(annotation=NoneType,
required=True,
discriminator='type')] | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>,
idempotency_key: str | None | Unset = <sinch.core.sentinel.Unset object>,
**kwargs,
) ServiceResponse[source]

Updates an existing service resource with the provided properties. Only the fields included in the request body will be modified; omitted fields remain unchanged.

To set a service as the default for the project, include is_default=True. Note that each project can have only one default service. Setting a new default will automatically remove the default status from the previously designated service.

Parameters:
  • service_id (str) – (required) The ID of the service.

  • name (str) – (optional) The name of the service. Must be 1-64 characters, with no leading, trailing, or repeated whitespace. Regex pattern: ^S+(s+S+)*$.

  • description (UnsetOr[Optional[str]]) – (optional) A description of the service. Must be at most 255 characters, with no leading, trailing, or repeated whitespace. Regex pattern: ^S+(s+S+)*$.

  • is_default (UnsetOr[Optional[Literal[True]]]) – (optional) Whether this service is the project default. Setting this to false is invalid.

  • call_behavior (UnsetOr[Optional[CallBehaviorDict]]) – (optional) Defines how calls are handled for this service.

  • idempotency_key (UnsetOr[Optional[str]]) – (optional) Client-generated idempotency key to safely retry requests. If a request with the same key is received within 10 minutes, the cached response from the original request is returned. Using a random UUID (v4) is strongly recommended.

  • **kwargs

    Additional parameters for the request.

Returns:

The updated service.

Return type:

ServiceResponse

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

delete(service_id: str, **kwargs) None[source]

Deletes a service permanently.

Important: The default service cannot be deleted. To delete the current default service, a different service must first be designated as the default using the PATCH endpoint.

Parameters:
  • service_id (str) – (required) The ID of the service.

  • **kwargs

    Additional parameters for the request.

Returns:

None

Return type:

None

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.