-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c64aabf
commit 13d63d8
Showing
23 changed files
with
1,275 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from .api_error import ApiError | ||
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper | ||
from .datetime_utils import serialize_datetime | ||
from .jsonable_encoder import jsonable_encoder | ||
from .remove_none_from_headers import remove_none_from_headers | ||
from .remove_none_from_dict import remove_none_from_dict | ||
|
||
__all__ = ["ApiError", "jsonable_encoder", "remove_none_from_headers", "serialize_datetime"] | ||
__all__ = [ | ||
"ApiError", | ||
"AsyncClientWrapper", | ||
"BaseClientWrapper", | ||
"SyncClientWrapper", | ||
"jsonable_encoder", | ||
"remove_none_from_dict", | ||
"serialize_datetime", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import typing | ||
|
||
import httpx | ||
|
||
|
||
class BaseClientWrapper: | ||
def __init__(self, *, token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, base_url: str): | ||
self._token = token | ||
self._base_url = base_url | ||
|
||
def get_headers(self) -> typing.Dict[str, str]: | ||
headers: typing.Dict[str, str] = { | ||
"X-Fern-Language": "Python", | ||
"X-Fern-SDK-Name": "superagent-py", | ||
"X-Fern-SDK-Version": "v0.0.54", | ||
} | ||
token = self._get_token() | ||
if token is not None: | ||
headers["Authorization"] = f"Bearer {token}" | ||
return headers | ||
|
||
def _get_token(self) -> typing.Optional[str]: | ||
if isinstance(self._token, str) or self._token is None: | ||
return self._token | ||
else: | ||
return self._token() | ||
|
||
def get_base_url(self) -> str: | ||
return self._base_url | ||
|
||
|
||
class SyncClientWrapper(BaseClientWrapper): | ||
def __init__( | ||
self, | ||
*, | ||
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, | ||
base_url: str, | ||
httpx_client: httpx.Client, | ||
): | ||
super().__init__(token=token, base_url=base_url) | ||
self.httpx_client = httpx_client | ||
|
||
|
||
class AsyncClientWrapper(BaseClientWrapper): | ||
def __init__( | ||
self, | ||
*, | ||
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, | ||
base_url: str, | ||
httpx_client: httpx.AsyncClient, | ||
): | ||
super().__init__(token=token, base_url=base_url) | ||
self.httpx_client = httpx_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from typing import Any, Dict, Optional | ||
|
||
|
||
def remove_none_from_dict(original: Dict[str, Optional[Any]]) -> Dict[str, Any]: | ||
new: Dict[str, Any] = {} | ||
for key, value in original.items(): | ||
if value is not None: | ||
new[key] = value | ||
return new |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.