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 Aug 16, 2024
1 parent f079761 commit 5aaf56a
Show file tree
Hide file tree
Showing 32 changed files with 2,991 additions and 11 deletions.
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 = "ssoready"
version = "1.0.1"
version = "1.1.0"
description = ""
readme = "README.md"
authors = []
Expand Down
37 changes: 36 additions & 1 deletion src/ssoready/__init__.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,69 @@
# This file was auto-generated by Fern from our API Definition.

from .types import (
CreateOrganizationResponse,
CreateSamlConnectionResponse,
CreateScimDirectoryResponse,
CreateSetupUrlResponse,
GetOrganizationResponse,
GetSamlConnectionResponse,
GetSamlRedirectUrlResponse,
GetScimDirectoryResponse,
GetScimGroupResponse,
GetScimUserResponse,
GoogleProtobufAny,
ListOrganizationsResponse,
ListSamlConnectionsResponse,
ListScimDirectoriesResponse,
ListScimGroupsResponse,
ListScimUsersResponse,
Organization,
RedeemSamlAccessCodeResponse,
RotateScimDirectoryBearerTokenResponse,
SamlConnection,
ScimDirectory,
ScimGroup,
ScimUser,
Status,
UpdateOrganizationResponse,
UpdateSamlConnectionResponse,
UpdateScimDirectoryResponse,
)
from . import saml, scim
from . import management, saml, scim
from .environment import SSOReadyEnvironment
from .version import __version__

__all__ = [
"CreateOrganizationResponse",
"CreateSamlConnectionResponse",
"CreateScimDirectoryResponse",
"CreateSetupUrlResponse",
"GetOrganizationResponse",
"GetSamlConnectionResponse",
"GetSamlRedirectUrlResponse",
"GetScimDirectoryResponse",
"GetScimGroupResponse",
"GetScimUserResponse",
"GoogleProtobufAny",
"ListOrganizationsResponse",
"ListSamlConnectionsResponse",
"ListScimDirectoriesResponse",
"ListScimGroupsResponse",
"ListScimUsersResponse",
"Organization",
"RedeemSamlAccessCodeResponse",
"RotateScimDirectoryBearerTokenResponse",
"SSOReadyEnvironment",
"SamlConnection",
"ScimDirectory",
"ScimGroup",
"ScimUser",
"Status",
"UpdateOrganizationResponse",
"UpdateSamlConnectionResponse",
"UpdateScimDirectoryResponse",
"__version__",
"management",
"saml",
"scim",
]
12 changes: 12 additions & 0 deletions src/ssoready/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import httpx

from .core.api_error import ApiError
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import SSOReadyEnvironment
from .management.client import AsyncManagementClient, ManagementClient
from .saml.client import AsyncSamlClient, SamlClient
from .scim.client import AsyncScimClient, ScimClient

Expand Down Expand Up @@ -59,6 +61,10 @@ def __init__(
httpx_client: typing.Optional[httpx.Client] = None
):
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
if api_key is None:
raise ApiError(
body="The client must be instantiated be either passing in api_key or setting SSOREADY_API_KEY"
)
self._client_wrapper = SyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
api_key=api_key,
Expand All @@ -69,6 +75,7 @@ def __init__(
else httpx.Client(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.management = ManagementClient(client_wrapper=self._client_wrapper)
self.saml = SamlClient(client_wrapper=self._client_wrapper)
self.scim = ScimClient(client_wrapper=self._client_wrapper)

Expand Down Expand Up @@ -121,6 +128,10 @@ def __init__(
httpx_client: typing.Optional[httpx.AsyncClient] = None
):
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
if api_key is None:
raise ApiError(
body="The client must be instantiated be either passing in api_key or setting SSOREADY_API_KEY"
)
self._client_wrapper = AsyncClientWrapper(
base_url=_get_base_url(base_url=base_url, environment=environment),
api_key=api_key,
Expand All @@ -131,6 +142,7 @@ def __init__(
else httpx.AsyncClient(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.management = AsyncManagementClient(client_wrapper=self._client_wrapper)
self.saml = AsyncSamlClient(client_wrapper=self._client_wrapper)
self.scim = AsyncScimClient(client_wrapper=self._client_wrapper)

Expand Down
16 changes: 7 additions & 9 deletions src/ssoready/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BaseClientWrapper:
def __init__(
self,
*,
api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
api_key: typing.Union[str, typing.Callable[[], str]],
base_url: str,
timeout: typing.Optional[float] = None,
):
Expand All @@ -23,15 +23,13 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "ssoready",
"X-Fern-SDK-Version": "1.0.1",
"X-Fern-SDK-Version": "1.1.0",
}
api_key = self._get_api_key()
if api_key is not None:
headers["Authorization"] = f"Bearer {api_key}"
headers["Authorization"] = f"Bearer {self._get_api_key()}"
return headers

def _get_api_key(self) -> typing.Optional[str]:
if isinstance(self._api_key, str) or self._api_key is None:
def _get_api_key(self) -> str:
if isinstance(self._api_key, str):
return self._api_key
else:
return self._api_key()
Expand All @@ -47,7 +45,7 @@ class SyncClientWrapper(BaseClientWrapper):
def __init__(
self,
*,
api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
api_key: typing.Union[str, typing.Callable[[], str]],
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.Client,
Expand All @@ -60,7 +58,7 @@ class AsyncClientWrapper(BaseClientWrapper):
def __init__(
self,
*,
api_key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
api_key: typing.Union[str, typing.Callable[[], str]],
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.AsyncClient,
Expand Down
5 changes: 5 additions & 0 deletions src/ssoready/management/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from . import organizations, saml_connections, scim_directories, setup_urls

__all__ = ["organizations", "saml_connections", "scim_directories", "setup_urls"]
25 changes: 25 additions & 0 deletions src/ssoready/management/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file was auto-generated by Fern from our API Definition.

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .organizations.client import AsyncOrganizationsClient, OrganizationsClient
from .saml_connections.client import AsyncSamlConnectionsClient, SamlConnectionsClient
from .scim_directories.client import AsyncScimDirectoriesClient, ScimDirectoriesClient
from .setup_urls.client import AsyncSetupUrlsClient, SetupUrlsClient


class ManagementClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
self.organizations = OrganizationsClient(client_wrapper=self._client_wrapper)
self.saml_connections = SamlConnectionsClient(client_wrapper=self._client_wrapper)
self.scim_directories = ScimDirectoriesClient(client_wrapper=self._client_wrapper)
self.setup_urls = SetupUrlsClient(client_wrapper=self._client_wrapper)


class AsyncManagementClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
self.organizations = AsyncOrganizationsClient(client_wrapper=self._client_wrapper)
self.saml_connections = AsyncSamlConnectionsClient(client_wrapper=self._client_wrapper)
self.scim_directories = AsyncScimDirectoriesClient(client_wrapper=self._client_wrapper)
self.setup_urls = AsyncSetupUrlsClient(client_wrapper=self._client_wrapper)
2 changes: 2 additions & 0 deletions src/ssoready/management/organizations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file was auto-generated by Fern from our API Definition.

Loading

0 comments on commit 5aaf56a

Please sign in to comment.