-
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
0a9e690
commit 39b391e
Showing
15 changed files
with
467 additions
and
5 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,5 +1,15 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
from . import agent, api_user, datasource, llm, tool, vector_database, workflow, workflow_config | ||
from . import agent, api_key, api_user, datasource, llm, tool, vector_database, workflow, workflow_config | ||
|
||
__all__ = ["agent", "api_user", "datasource", "llm", "tool", "vector_database", "workflow", "workflow_config"] | ||
__all__ = [ | ||
"agent", | ||
"api_key", | ||
"api_user", | ||
"datasource", | ||
"llm", | ||
"tool", | ||
"vector_database", | ||
"workflow", | ||
"workflow_config", | ||
] |
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,2 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
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,215 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import typing | ||
import urllib.parse | ||
from json.decoder import JSONDecodeError | ||
|
||
from ...core.api_error import ApiError | ||
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper | ||
from ...core.jsonable_encoder import jsonable_encoder | ||
from ...errors.unprocessable_entity_error import UnprocessableEntityError | ||
from ...types.api_key_create import ApiKeyCreate | ||
from ...types.api_key_list import ApiKeyList | ||
from ...types.app_models_request_api_key import AppModelsRequestApiKey | ||
from ...types.app_models_response_api_key import AppModelsResponseApiKey | ||
from ...types.http_validation_error import HttpValidationError | ||
|
||
try: | ||
import pydantic.v1 as pydantic # type: ignore | ||
except ImportError: | ||
import pydantic # type: ignore | ||
|
||
# this is used as the default value for optional parameters | ||
OMIT = typing.cast(typing.Any, ...) | ||
|
||
|
||
class ApiKeyClient: | ||
def __init__(self, *, client_wrapper: SyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
def list(self) -> ApiKeyList: | ||
""" | ||
List API keys | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(ApiKeyList, _response.json()) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
def create(self, *, request: AppModelsRequestApiKey) -> ApiKeyCreate: | ||
""" | ||
Create a new API key | ||
Parameters: | ||
- request: AppModelsRequestApiKey. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(ApiKeyCreate, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
def delete(self, id: str) -> AppModelsResponseApiKey: | ||
""" | ||
Delete an API key | ||
Parameters: | ||
- id: str. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"DELETE", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{id}"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseApiKey, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
def update(self, id: str, *, request: AppModelsRequestApiKey) -> AppModelsResponseApiKey: | ||
""" | ||
Update an API key | ||
Parameters: | ||
- id: str. | ||
- request: AppModelsRequestApiKey. | ||
""" | ||
_response = self._client_wrapper.httpx_client.request( | ||
"PATCH", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{id}"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseApiKey, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
|
||
class AsyncApiKeyClient: | ||
def __init__(self, *, client_wrapper: AsyncClientWrapper): | ||
self._client_wrapper = client_wrapper | ||
|
||
async def list(self) -> ApiKeyList: | ||
""" | ||
List API keys | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"GET", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(ApiKeyList, _response.json()) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
async def create(self, *, request: AppModelsRequestApiKey) -> ApiKeyCreate: | ||
""" | ||
Create a new API key | ||
Parameters: | ||
- request: AppModelsRequestApiKey. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"POST", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/api-keys"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(ApiKeyCreate, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
async def delete(self, id: str) -> AppModelsResponseApiKey: | ||
""" | ||
Delete an API key | ||
Parameters: | ||
- id: str. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"DELETE", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{id}"), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseApiKey, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) | ||
|
||
async def update(self, id: str, *, request: AppModelsRequestApiKey) -> AppModelsResponseApiKey: | ||
""" | ||
Update an API key | ||
Parameters: | ||
- id: str. | ||
- request: AppModelsRequestApiKey. | ||
""" | ||
_response = await self._client_wrapper.httpx_client.request( | ||
"PATCH", | ||
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/api-keys/{id}"), | ||
json=jsonable_encoder(request), | ||
headers=self._client_wrapper.get_headers(), | ||
timeout=60, | ||
) | ||
if 200 <= _response.status_code < 300: | ||
return pydantic.parse_obj_as(AppModelsResponseApiKey, _response.json()) # type: ignore | ||
if _response.status_code == 422: | ||
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore | ||
try: | ||
_response_json = _response.json() | ||
except JSONDecodeError: | ||
raise ApiError(status_code=_response.status_code, body=_response.text) | ||
raise ApiError(status_code=_response.status_code, body=_response_json) |
Oops, something went wrong.