Skip to content

Commit

Permalink
Release v0.25.0 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed Apr 9, 2024
1 parent 12a8417 commit 8195a79
Show file tree
Hide file tree
Showing 129 changed files with 3,847 additions and 2,787 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ style-check:

.PHONY: test
test:
poetry run pytest -x tests
poetry install
poetry run pytest tests

.PHONY: docs
docs:
Expand Down
554 changes: 250 additions & 304 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qcs-api-client"
version = "0.24.1"
version = "0.25.0"
description = "A client library for accessing the Rigetti QCS API"
license = "Apache-2.0"
repository = "https://github.com/rigetti/qcs-api-client-python"
Expand All @@ -17,17 +17,19 @@ include = ["CHANGELOG.md", "qcs_api_client/py.typed"]
attrs = ">=21.3.0"
httpx = "^0.23.0"
iso8601 = "^1.0.2"
pydantic = "^1.7.2"
python = "^3.7"
pydantic = "^2.6.3"
python = ">=3.8,<4.0"
python-dateutil = "^2.8.1"
retrying = "^1.3.3"
rfc3339 = "^6.2"
toml = "^0.10.2"
PyJWT = "^2.4.0"
pydantic-settings = "^2.2.1"


[tool.poetry.dev-dependencies]
black = "20.8b1"
black = "^24.2.0"
click = "8.0.2"
flake8 = "^3.8.4"
pytest = "^6.1.2"
respx = "^0.20.0"
Expand Down
2 changes: 1 addition & 1 deletion qcs_api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" """
"""A client library for accessing Rigetti QCS API"""
2 changes: 1 addition & 1 deletion qcs_api_client/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Contains methods for accessing the API """
"""Contains methods for accessing the API"""
108 changes: 51 additions & 57 deletions qcs_api_client/api/account/add_group_user.py
Original file line number Diff line number Diff line change
@@ -1,77 +1,76 @@
from typing import Any, Dict, cast
from http import HTTPStatus
from typing import Any, Dict, Union, cast

import httpx
from retrying import retry

from ...models.add_group_user_request import AddGroupUserRequest
from ...types import Response
from ...util.errors import QCSHTTPStatusError, raise_for_status
from ...util.errors import QCSHTTPStatusError
from ...util.retry import DEFAULT_RETRY_ARGUMENTS

from ...models.error import Error
from ...models.add_group_user_request import AddGroupUserRequest


def _get_kwargs(
*,
client: httpx.Client,
json_body: AddGroupUserRequest,
body: AddGroupUserRequest,
) -> Dict[str, Any]:
url = "{}/v1/groups:addUser".format(client.base_url)

headers = {k: v for (k, v) in client.headers.items()}
cookies = {k: v for (k, v) in client.cookies}

json_json_body = json_body.to_dict()
headers: Dict[str, Any] = {}

return {
_kwargs: Dict[str, Any] = {
"method": "post",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.timeout,
"json": json_json_body,
"url": "/v1/groups:addUser",
}

_body = body.to_dict()

def _parse_response(*, response: httpx.Response) -> Any:
raise_for_status(response)
if response.status_code == 204:
_kwargs["json"] = _body
headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(*, response: httpx.Response) -> Union[Any, Error]:
if response.status_code == HTTPStatus.NO_CONTENT:
response_204 = cast(Any, None)
return response_204
else:
raise QCSHTTPStatusError(
f"Unexpected response: status code {response.status_code}", response=response, error=None
)
raise QCSHTTPStatusError(f"Unexpected response: status code {response.status_code}")


def _build_response(*, response: httpx.Response) -> Response[Any]:
"""
Construct the Response class from the raw ``httpx.Response``.
"""
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Error]]:
"""Construct the Response class from the raw ``httpx.Response``."""
return Response.build_from_httpx_response(response=response, parse_function=_parse_response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
def sync(
*,
client: httpx.Client,
json_body: AddGroupUserRequest,
body: AddGroupUserRequest,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
) -> Response[Union[Any, Error]]:
"""Add user to a group
Add a user to a group. Note, group membership may take several minutes to update within our identity
provider. After adding a user to a group, please allow up to 60 minutes for changes to be reflected.
Args:
json_body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId`
or `groupName`.
body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` or
`groupName`.
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]
Response[Union[Any, Error]]
"""

kwargs = _get_kwargs(
client=client,
json_body=json_body,
body=body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
Expand All @@ -85,70 +84,65 @@ def sync(
def sync_from_dict(
*,
client: httpx.Client,
json_body_dict: Dict,
body: Dict,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
json_body = AddGroupUserRequest.from_dict(json_body_dict)

) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
client=client,
json_body=json_body,
body=body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
**kwargs,
)

return _build_response(response=response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
async def asyncio(
*,
client: httpx.AsyncClient,
json_body: AddGroupUserRequest,
body: AddGroupUserRequest,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
) -> Response[Union[Any, Error]]:
"""Add user to a group
Add a user to a group. Note, group membership may take several minutes to update within our identity
provider. After adding a user to a group, please allow up to 60 minutes for changes to be reflected.
Args:
json_body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId`
or `groupName`.
body (AddGroupUserRequest): Must provide either `userId` or `userEmail` and `groupId` or
`groupName`.
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]
Response[Union[Any, Error]]
"""

kwargs = _get_kwargs(
client=client,
json_body=json_body,
body=body,
)
kwargs.update(httpx_request_kwargs)
response = await client.request(
**kwargs,
)

response = await client.request(**kwargs)
return _build_response(response=response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
async def asyncio_from_dict(
*,
client: httpx.AsyncClient,
json_body_dict: Dict,
body: Dict,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
json_body = AddGroupUserRequest.from_dict(json_body_dict)

) -> Response[Union[Any, Error]]:
kwargs = _get_kwargs(
client=client,
json_body=json_body,
body=body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
response = await client.request(
**kwargs,
)

Expand Down
Loading

0 comments on commit 8195a79

Please sign in to comment.