Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vocametrix/_generated/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Auto-generated � do not edit. Run `python tasks.py regenerate` to update.
"""A client library for accessing Vocametrix API"""

""" A client library for accessing Vocametrix API """
from .client import AuthenticatedClient, Client

__all__ = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
from http import HTTPStatus
from typing import Any, cast

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.get_calculate_csid_response_200 import GetCalculateCsidResponse200
from ...types import UNSET, Response


def _get_kwargs(
*,
cs_file_id: str,
) -> dict[str, Any]:

params: dict[str, Any] = {}

params["csFileId"] = cs_file_id

params = {k: v for k, v in params.items() if v is not UNSET and v is not None}

_kwargs: dict[str, Any] = {
"method": "get",
"url": "/api/calculate-csid",
"params": params,
}

return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Any | GetCalculateCsidResponse200 | None:
if response.status_code == 200:
response_200 = GetCalculateCsidResponse200.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = cast(Any, None)
return response_400

if response.status_code == 401:
response_401 = cast(Any, None)
return response_401

if response.status_code == 429:
response_429 = cast(Any, None)
return response_429

if response.status_code == 500:
response_500 = cast(Any, None)
return response_500

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[Any | GetCalculateCsidResponse200]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
cs_file_id: str,
) -> Response[Any | GetCalculateCsidResponse200]:
"""Calculate the Cepstral Spectral Index of Dysphonia (CSID) from a connected speech recording pre-
uploaded via POST /ap…

Args:
cs_file_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | GetCalculateCsidResponse200]
"""

kwargs = _get_kwargs(
cs_file_id=cs_file_id,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
cs_file_id: str,
) -> Any | GetCalculateCsidResponse200 | None:
"""Calculate the Cepstral Spectral Index of Dysphonia (CSID) from a connected speech recording pre-
uploaded via POST /ap…

Args:
cs_file_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | GetCalculateCsidResponse200
"""

return sync_detailed(
client=client,
cs_file_id=cs_file_id,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
cs_file_id: str,
) -> Response[Any | GetCalculateCsidResponse200]:
"""Calculate the Cepstral Spectral Index of Dysphonia (CSID) from a connected speech recording pre-
uploaded via POST /ap…

Args:
cs_file_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | GetCalculateCsidResponse200]
"""

kwargs = _get_kwargs(
cs_file_id=cs_file_id,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
cs_file_id: str,
) -> Any | GetCalculateCsidResponse200 | None:
"""Calculate the Cepstral Spectral Index of Dysphonia (CSID) from a connected speech recording pre-
uploaded via POST /ap…

Args:
cs_file_id (str):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | GetCalculateCsidResponse200
"""

return (
await asyncio_detailed(
client=client,
cs_file_id=cs_file_id,
)
).parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
from http import HTTPStatus
from typing import Any, cast

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.post_estimate_formants_body import PostEstimateFormantsBody
from ...models.post_estimate_formants_response_200 import PostEstimateFormantsResponse200
from ...types import Response


def _get_kwargs(
*,
body: PostEstimateFormantsBody,
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: dict[str, Any] = {
"method": "post",
"url": "/api/estimate_formants",
}

_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Any | PostEstimateFormantsResponse200 | None:
if response.status_code == 200:
response_200 = PostEstimateFormantsResponse200.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = cast(Any, None)
return response_400

if response.status_code == 401:
response_401 = cast(Any, None)
return response_401

if response.status_code == 429:
response_429 = cast(Any, None)
return response_429

if response.status_code == 500:
response_500 = cast(Any, None)
return response_500

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[Any | PostEstimateFormantsResponse200]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
body: PostEstimateFormantsBody,
) -> Response[Any | PostEstimateFormantsResponse200]:
"""Estimate F1-F3 quickly, with the vowel position on the IPA chart, from a file pre-uploaded via POST
/api/assignFileId…

Args:
body (PostEstimateFormantsBody):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | PostEstimateFormantsResponse200]
"""

kwargs = _get_kwargs(
body=body,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
body: PostEstimateFormantsBody,
) -> Any | PostEstimateFormantsResponse200 | None:
"""Estimate F1-F3 quickly, with the vowel position on the IPA chart, from a file pre-uploaded via POST
/api/assignFileId…

Args:
body (PostEstimateFormantsBody):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | PostEstimateFormantsResponse200
"""

return sync_detailed(
client=client,
body=body,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: PostEstimateFormantsBody,
) -> Response[Any | PostEstimateFormantsResponse200]:
"""Estimate F1-F3 quickly, with the vowel position on the IPA chart, from a file pre-uploaded via POST
/api/assignFileId…

Args:
body (PostEstimateFormantsBody):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Any | PostEstimateFormantsResponse200]
"""

kwargs = _get_kwargs(
body=body,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
body: PostEstimateFormantsBody,
) -> Any | PostEstimateFormantsResponse200 | None:
"""Estimate F1-F3 quickly, with the vowel position on the IPA chart, from a file pre-uploaded via POST
/api/assignFileId…

Args:
body (PostEstimateFormantsBody):

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Any | PostEstimateFormantsResponse200
"""

return (
await asyncio_detailed(
client=client,
body=body,
)
).parsed
Loading