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 1, 2024
1 parent 7f4aeab commit 0e7b81c
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 143 deletions.
224 changes: 112 additions & 112 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "trycourier"
version = "v6.0.2"
version = "v6.0.3"
description = ""
readme = "README.md"
authors = []
Expand Down
9 changes: 6 additions & 3 deletions src/courier/commons/types/user_tenant_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@


class UserTenantAssociation(pydantic_v1.BaseModel):
user_id: str = pydantic_v1.Field()
user_id: typing.Optional[str] = pydantic_v1.Field(default=None)
"""
User ID for the assocation between tenant and user
"""

type: typing.Literal["user"]
type: typing.Optional[typing.Literal["user"]] = None
tenant_id: str = pydantic_v1.Field()
"""
Tenant ID for the assocation between tenant and user
"""

profile: typing.Dict[str, typing.Any]
profile: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None)
"""
Additional metadata to be applied to a user profile when used in a tenant context
"""

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
2 changes: 1 addition & 1 deletion src/courier/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "trycourier",
"X-Fern-SDK-Version": "v6.0.2",
"X-Fern-SDK-Version": "v6.0.3",
}
headers["Authorization"] = f"Bearer {self._get_authorization_token()}"
return headers
Expand Down
2 changes: 1 addition & 1 deletion src/courier/tenants/types/default_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class DefaultPreferences(pydantic_v1.BaseModel):
items: typing.List[SubscriptionTopic]
items: typing.Optional[typing.List[SubscriptionTopic]] = None

def json(self, **kwargs: typing.Any) -> str:
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
Expand Down
41 changes: 16 additions & 25 deletions src/courier/users/tenants/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ...core.pydantic_utilities import pydantic_v1
from ...core.remove_none_from_dict import remove_none_from_dict
from ...core.request_options import RequestOptions
from .types.add_user_to_single_tenants_params_profile import AddUserToSingleTenantsParamsProfile
from .types.list_tenants_for_user_response import ListTenantsForUserResponse

# this is used as the default value for optional parameters
Expand Down Expand Up @@ -102,7 +101,7 @@ def add(
user_id: str,
tenant_id: str,
*,
profile: AddUserToSingleTenantsParamsProfile,
profile: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
Expand All @@ -117,28 +116,24 @@ def add(
- tenant_id: str. Id of the tenant the user should be added to.
- profile: AddUserToSingleTenantsParamsProfile.
- profile: typing.Optional[typing.Dict[str, typing.Any]].
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from courier.client import Courier
from courier.users import AddUserToSingleTenantsParamsProfile
client = Courier(
authorization_token="YOUR_AUTHORIZATION_TOKEN",
)
client.users.tenants.add(
user_id="string",
tenant_id="string",
profile=AddUserToSingleTenantsParamsProfile(
title="string",
email="string",
phone_number="string",
locale="string",
additional_fields={"string": {"key": "value"}},
),
profile={"string": {"key": "value"}},
)
"""
_request: typing.Dict[str, typing.Any] = {}
if profile is not OMIT:
_request["profile"] = profile
_response = self._client_wrapper.httpx_client.request(
"PUT",
urllib.parse.urljoin(
Expand All @@ -148,10 +143,10 @@ def add(
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
json=jsonable_encoder({"profile": profile})
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
else {
**jsonable_encoder({"profile": profile}),
**jsonable_encoder(_request),
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
},
headers=jsonable_encoder(
Expand Down Expand Up @@ -432,7 +427,7 @@ async def add(
user_id: str,
tenant_id: str,
*,
profile: AddUserToSingleTenantsParamsProfile,
profile: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
Expand All @@ -447,28 +442,24 @@ async def add(
- tenant_id: str. Id of the tenant the user should be added to.
- profile: AddUserToSingleTenantsParamsProfile.
- profile: typing.Optional[typing.Dict[str, typing.Any]].
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
---
from courier.client import AsyncCourier
from courier.users import AddUserToSingleTenantsParamsProfile
client = AsyncCourier(
authorization_token="YOUR_AUTHORIZATION_TOKEN",
)
await client.users.tenants.add(
user_id="string",
tenant_id="string",
profile=AddUserToSingleTenantsParamsProfile(
title="string",
email="string",
phone_number="string",
locale="string",
additional_fields={"string": {"key": "value"}},
),
profile={"string": {"key": "value"}},
)
"""
_request: typing.Dict[str, typing.Any] = {}
if profile is not OMIT:
_request["profile"] = profile
_response = await self._client_wrapper.httpx_client.request(
"PUT",
urllib.parse.urljoin(
Expand All @@ -478,10 +469,10 @@ async def add(
params=jsonable_encoder(
request_options.get("additional_query_parameters") if request_options is not None else None
),
json=jsonable_encoder({"profile": profile})
json=jsonable_encoder(_request)
if request_options is None or request_options.get("additional_body_parameters") is None
else {
**jsonable_encoder({"profile": profile}),
**jsonable_encoder(_request),
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
},
headers=jsonable_encoder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@


class AddUserToSingleTenantsParamsProfile(pydantic_v1.BaseModel):
"""
AddUserToSingleTenantsParamsProfile is no longer used for Add a User to a Single Tenant
"""

title: str
email: str = pydantic_v1.Field()
"""
Expand Down

0 comments on commit 0e7b81c

Please sign in to comment.