Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed May 23, 2024
1 parent 28893a8 commit 01d7ead
Show file tree
Hide file tree
Showing 252 changed files with 3,934 additions and 1,671 deletions.
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
[tool.poetry]
name = "trycourier"
version = "v6.0.5"
version = "v6.1.0"
description = ""
readme = "README.md"
authors = []
keywords = []

classifiers = [
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed"
]
packages = [
{ include = "courier", from = "src"}
]

[project.urls]
Repository = 'https://github.com/trycourier/courier-python'

[tool.poetry.dependencies]
python = "^3.8"
httpx = ">=0.21.2"
Expand Down
2 changes: 2 additions & 0 deletions src/courier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
DefaultPreferences,
ListUsersForTenantResponse,
SubscriptionTopic,
SubscriptionTopicNew,
SubscriptionTopicStatus,
TemplateProperty,
Tenant,
Expand Down Expand Up @@ -580,6 +581,7 @@
"SubscribeToListsRequestListObject",
"SubscribeToListsResponse",
"SubscriptionTopic",
"SubscriptionTopicNew",
"SubscriptionTopicStatus",
"Tag",
"TagData",
Expand Down
165 changes: 100 additions & 65 deletions src/courier/audiences/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import pydantic_v1
from ..core.query_encoder import encode_query
from ..core.remove_none_from_dict import remove_none_from_dict
from ..core.request_options import RequestOptions
from ..core.unchecked_base_model import construct_type
from .types.audience import Audience
from .types.audience_list_response import AudienceListResponse
from .types.audience_member_list_response import AudienceMemberListResponse
Expand Down Expand Up @@ -58,8 +59,10 @@ def get(self, audience_id: str, *, request_options: typing.Optional[RequestOptio
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
headers=jsonable_encoder(
remove_none_from_dict(
Expand All @@ -76,7 +79,7 @@ def get(self, audience_id: str, *, request_options: typing.Optional[RequestOptio
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(Audience, _response.json()) # type: ignore
return typing.cast(Audience, construct_type(type_=Audience, object_=_response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -146,8 +149,10 @@ def update(
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
Expand All @@ -170,7 +175,7 @@ def update(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceUpdateResponse, _response.json()) # type: ignore
return typing.cast(AudienceUpdateResponse, construct_type(type_=AudienceUpdateResponse, object_=_response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -209,9 +214,14 @@ def delete(self, audience_id: str, *, request_options: typing.Optional[RequestOp
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
if request_options is not None
else None,
headers=jsonable_encoder(
remove_none_from_dict(
{
Expand Down Expand Up @@ -276,16 +286,18 @@ def list_members(
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}/members"
),
params=jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
params=encode_query(
jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
)
)
),
headers=jsonable_encoder(
Expand All @@ -303,9 +315,11 @@ def list_members(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceMemberListResponse, _response.json()) # type: ignore
return typing.cast(AudienceMemberListResponse, construct_type(type_=AudienceMemberListResponse, object_=_response.json())) # type: ignore
if _response.status_code == 400:
raise BadRequestError(pydantic_v1.parse_obj_as(BadRequest, _response.json())) # type: ignore
raise BadRequestError(
typing.cast(BadRequest, construct_type(type_=BadRequest, object_=_response.json())) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -344,16 +358,18 @@ def list_audiences(
_response = self._client_wrapper.httpx_client.request(
method="GET",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"),
params=jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
params=encode_query(
jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
)
)
),
headers=jsonable_encoder(
Expand All @@ -371,9 +387,11 @@ def list_audiences(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceListResponse, _response.json()) # type: ignore
return typing.cast(AudienceListResponse, construct_type(type_=AudienceListResponse, object_=_response.json())) # type: ignore
if _response.status_code == 400:
raise BadRequestError(pydantic_v1.parse_obj_as(BadRequest, _response.json())) # type: ignore
raise BadRequestError(
typing.cast(BadRequest, construct_type(type_=BadRequest, object_=_response.json())) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -417,8 +435,10 @@ async def get(self, audience_id: str, *, request_options: typing.Optional[Reques
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
headers=jsonable_encoder(
remove_none_from_dict(
Expand All @@ -435,7 +455,7 @@ async def get(self, audience_id: str, *, request_options: typing.Optional[Reques
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(Audience, _response.json()) # type: ignore
return typing.cast(Audience, construct_type(type_=Audience, object_=_response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -505,8 +525,10 @@ async def update(
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
Expand All @@ -529,7 +551,7 @@ async def update(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceUpdateResponse, _response.json()) # type: ignore
return typing.cast(AudienceUpdateResponse, construct_type(type_=AudienceUpdateResponse, object_=_response.json())) # type: ignore
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -568,9 +590,14 @@ async def delete(self, audience_id: str, *, request_options: typing.Optional[Req
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}"
),
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
params=encode_query(
jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
)
),
json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
if request_options is not None
else None,
headers=jsonable_encoder(
remove_none_from_dict(
{
Expand Down Expand Up @@ -635,16 +662,18 @@ async def list_members(
url=urllib.parse.urljoin(
f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}/members"
),
params=jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
params=encode_query(
jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
)
)
),
headers=jsonable_encoder(
Expand All @@ -662,9 +691,11 @@ async def list_members(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceMemberListResponse, _response.json()) # type: ignore
return typing.cast(AudienceMemberListResponse, construct_type(type_=AudienceMemberListResponse, object_=_response.json())) # type: ignore
if _response.status_code == 400:
raise BadRequestError(pydantic_v1.parse_obj_as(BadRequest, _response.json())) # type: ignore
raise BadRequestError(
typing.cast(BadRequest, construct_type(type_=BadRequest, object_=_response.json())) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down Expand Up @@ -703,16 +734,18 @@ async def list_audiences(
_response = await self._client_wrapper.httpx_client.request(
method="GET",
url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"),
params=jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
params=encode_query(
jsonable_encoder(
remove_none_from_dict(
{
"cursor": cursor,
**(
request_options.get("additional_query_parameters", {})
if request_options is not None
else {}
),
}
)
)
),
headers=jsonable_encoder(
Expand All @@ -730,9 +763,11 @@ async def list_audiences(
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
)
if 200 <= _response.status_code < 300:
return pydantic_v1.parse_obj_as(AudienceListResponse, _response.json()) # type: ignore
return typing.cast(AudienceListResponse, construct_type(type_=AudienceListResponse, object_=_response.json())) # type: ignore
if _response.status_code == 400:
raise BadRequestError(pydantic_v1.parse_obj_as(BadRequest, _response.json())) # type: ignore
raise BadRequestError(
typing.cast(BadRequest, construct_type(type_=BadRequest, object_=_response.json())) # type: ignore
)
try:
_response_json = _response.json()
except JSONDecodeError:
Expand Down
Loading

0 comments on commit 01d7ead

Please sign in to comment.