Skip to content

Commit

Permalink
Python SDK release v0.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
romainbou committed May 28, 2024
1 parent 66a2403 commit e1bec47
Show file tree
Hide file tree
Showing 215 changed files with 8,296 additions and 5,581 deletions.
4 changes: 2 additions & 2 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Metadata-Version: 2.1
Name: tuneinsight
Version: 0.9.2
Summary: Diapason is the official Python SDK for the Tune Insight API. Version 0.6.2 targets the API v0.8.0.
Version: 0.10.2
Summary: Diapason is the official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API.
License: Apache-2.0
Author: Tune Insight SA
Requires-Python: >=3.8,<3.12
Expand Down
14 changes: 10 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "tuneinsight"
version = "0.9.2"
description = "Diapason is the official Python SDK for the Tune Insight API. Version 0.6.2 targets the API v0.8.0."
version = "0.10.2"
description = "Diapason is the official Python SDK for the Tune Insight API. The current version is compatible with the same version of the API."
authors = ["Tune Insight SA"]
license = "Apache-2.0"
include = [
Expand All @@ -12,6 +12,12 @@ include = [
]
readme = "src/tuneinsight/README.md"

[tool.poetry-dynamic-versioning]
enable = false
style = "pep440"
pattern = "^v(?P<base>\\d+\\.\\d+\\.\\d+)"
format = "{base}"

[tool.poetry.dependencies]
python = ">= 3.8,<3.12"
python-keycloak = "^3.9.0"
Expand All @@ -38,8 +44,8 @@ pyvcf3 = "^1.0.3" # For GWAS .vcf file parsing
pytest = "^8.1.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.black]
include = '\.pyi?$'
Expand Down
2 changes: 1 addition & 1 deletion src/tuneinsight/api/api-checksum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1543c5968e0e568095cb5eeb44a3c7ab3179d6491f270932e268ab579c8d5948
dcb50c2cb9eac6743b41006a2e73a209bea8c9697c526f31a608a0aa602ec4de
162 changes: 162 additions & 0 deletions src/tuneinsight/api/sdk/api/api_admin/get_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import httpx

from ... import errors
from ...client import Client
from ...models.error import Error
from ...models.instance_configuration import InstanceConfiguration
from ...types import Response


def _get_kwargs(
*,
client: Client,
) -> Dict[str, Any]:
url = "{}/config".format(client.base_url)

headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "get",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
}


def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Error, InstanceConfiguration]]:
if response.status_code == HTTPStatus.OK:
response_200 = InstanceConfiguration.from_dict(response.json())

return response_200
if response.status_code == HTTPStatus.UNAUTHORIZED:
response_401 = Error.from_dict(response.json())

return response_401
if response.status_code == HTTPStatus.FORBIDDEN:
response_403 = Error.from_dict(response.json())

return response_403
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
response_500 = Error.from_dict(response.json())

return response_500
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
else:
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Error, InstanceConfiguration]]:
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: Client,
) -> Response[Union[Error, InstanceConfiguration]]:
"""get information about the instance's configuration (requires administrative privileges)
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[Union[Error, InstanceConfiguration]]
"""

kwargs = _get_kwargs(
client=client,
)

response = httpx.request(
verify=client.verify_ssl,
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: Client,
) -> Optional[Union[Error, InstanceConfiguration]]:
"""get information about the instance's configuration (requires administrative privileges)
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[Union[Error, InstanceConfiguration]]
"""

return sync_detailed(
client=client,
).parsed


async def asyncio_detailed(
*,
client: Client,
) -> Response[Union[Error, InstanceConfiguration]]:
"""get information about the instance's configuration (requires administrative privileges)
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[Union[Error, InstanceConfiguration]]
"""

kwargs = _get_kwargs(
client=client,
)

async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
response = await _client.request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: Client,
) -> Optional[Union[Error, InstanceConfiguration]]:
"""get information about the instance's configuration (requires administrative privileges)
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[Union[Error, InstanceConfiguration]]
"""

return (
await asyncio_detailed(
client=client,
)
).parsed
12 changes: 12 additions & 0 deletions src/tuneinsight/api/sdk/api/api_admin/get_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ def _get_kwargs(
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "get",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
}


Expand Down
12 changes: 12 additions & 0 deletions src/tuneinsight/api/sdk/api/api_admin/patch_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,24 @@ def _get_kwargs(

json_json_body = json_body.to_dict()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "patch",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
"json": json_json_body,
}

Expand Down
12 changes: 12 additions & 0 deletions src/tuneinsight/api/sdk/api/api_admin/post_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,24 @@ def _get_kwargs(

json_json_body = json_body.to_dict()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "post",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
"json": json_json_body,
}

Expand Down
12 changes: 12 additions & 0 deletions src/tuneinsight/api/sdk/api/api_computations/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,24 @@ def _get_kwargs(
else:
json_json_body = json_body.to_dict()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "post",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
"json": json_json_body,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ def _get_kwargs(
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "delete",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
}


Expand Down
12 changes: 12 additions & 0 deletions src/tuneinsight/api/sdk/api/api_computations/delete_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ def _get_kwargs(
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "delete",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ def _get_kwargs(
headers: Dict[str, str] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

# Set the proxies if the client has proxies set.
proxies = None
if hasattr(client, "proxies") and client.proxies is not None:
https_proxy = client.proxies.get("https")
if https_proxy:
proxies = https_proxy
else:
http_proxy = client.proxies.get("http")
if http_proxy:
proxies = http_proxy

return {
"method": "delete",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.get_timeout(),
"proxies": proxies,
}


Expand Down
Loading

0 comments on commit e1bec47

Please sign in to comment.