benchling_sdk.services.v2.stable.api_service module

class ApiService

Bases: benchling_sdk.services.v2.base_service.BaseService

A service for making raw API calls to Benchling using an authenticated client.

This is generally useful for using the SDK to call API endpoints which may not be supported in the SDK yet.

delete_modeled(url: str, target_type: Type[benchling_sdk.services.v2.stable.api_service.D] = DeserializableModelNoContent, additional_headers: Optional[Dict[str, Any]] = None) Optional[benchling_sdk.services.v2.stable.api_service.D]

Return a deserialized model as specified by target_type.

Automatically retries errors as configured in RetryStrategy.

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param

target_type: A class type of DeserializableModel to deserialize from the response JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The deserialized modeled response :rtype: D

delete_response(url: str, additional_headers: Optional[Dict[str, Any]] = None) benchling_api_client.v2.types.Response[Dict[str, Any]]

Call the API with HTTP DELETE. Returns a Response with JSON deserialized as Dict[str, Any].

get_modeled(url: str, target_type: Type[benchling_sdk.services.v2.stable.api_service.D], additional_headers: Optional[Dict[str, Any]] = None) benchling_sdk.services.v2.stable.api_service.D

Return a deserialized model as specified by target_type.

Automatically retries errors as configured in RetryStrategy.

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param

target_type: A class type of DeserializableModel to deserialize from the response JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The deserialized modeled response :rtype: D

get_response(url: str, additional_headers: Optional[Dict[str, Any]] = None) benchling_api_client.v2.types.Response[Dict[str, Any]]

Call the API with HTTP GET. Return a Response with JSON deserialized as Dict[str, Any].

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param

additional_headers: A dict of key/values to add to the request as HTTP headers :return: The raw HTTP Response :rtype: Response[Dict[str, Any]]

patch_modeled(url: str, target_type: Type[benchling_sdk.services.v2.stable.api_service.D], body: Optional[benchling_sdk.services.v2.stable.api_service.S] = None, additional_headers: Optional[Dict[str, Any]] = None) Optional[benchling_sdk.services.v2.stable.api_service.D]

Return a deserialized model as specified by target_type.

Automatically retries errors as configured in RetryStrategy.

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param

target_type: A class type of DeserializableModel to deserialize from the response JSON :param body: Body of the PATCH request as a class implementing SerializableModel. Will be serialized to JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The deserialized modeled response :rtype: D

patch_response(url: str, body: Optional[Dict[str, Any]] = None, additional_headers: Optional[Dict[str, Any]] = None) benchling_api_client.v2.types.Response[Dict[str, Any]]

Call the API with HTTP PATCH. Returns a Response with JSON deserialized as Dict[str, Any].

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param body: Body

of the PATCH request, which will be serialized to JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The raw HTTP Response :rtype: Response[Dict[str, Any]]

post_modeled(url: str, target_type: Type[benchling_sdk.services.v2.stable.api_service.D], body: Optional[benchling_sdk.services.v2.stable.api_service.S] = None, additional_headers: Optional[Dict[str, Any]] = None) Optional[benchling_sdk.services.v2.stable.api_service.D]

Return a deserialized model as specified by target_type.

Automatically retries errors as configured in RetryStrategy.

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param

target_type: A class type of DeserializableModel to deserialize from the response JSON :param body: Body of the POST request as a class implementing SerializableModel. Will be serialized to JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The deserialized modeled response :rtype: D

post_response(url: str, body: Optional[Dict[str, Any]] = None, additional_headers: Optional[Dict[str, Any]] = None) benchling_api_client.v2.types.Response[Dict[str, Any]]

Call the API with HTTP POST. Return a Response with JSON deserialized as Dict[str, Any].

Parameters

url – A relative URL path excluding host and scheme (e.g., /api/v2-alpha/some-endpoint) :param body: Body

of the POST request, which will be serialized to JSON :param additional_headers: A dict of key/values to add to the request as HTTP headers :return: The raw HTTP Response :rtype: Response[Dict[str, Any]]

build_json_response(response: httpx.Response) benchling_api_client.v2.types.Response[Dict[str, Any]]

Create a Response object which corresponds to the usual code generated response.

This assumes a JSON return payload but will structure a little more than the raw HTTPX response.