Skip to content

Commit

Permalink
Release v0.2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 29, 2024
1 parent 0a9e690 commit 39b391e
Show file tree
Hide file tree
Showing 15 changed files with 467 additions and 5 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 = "superagent-py"
version = "v0.2.11"
version = "v0.2.12"
description = ""
readme = "README.md"
authors = []
Expand Down
15 changes: 14 additions & 1 deletion src/superagent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
AgentList,
AgentToolList,
AgentType,
ApiKeyCreate,
ApiKeyCreateModel,
ApiKeyList,
AppModelsRequestApiKey,
AppModelsRequestApiUser,
AppModelsRequestDatasource,
AppModelsRequestLlm,
Expand All @@ -13,6 +17,7 @@
AppModelsRequestWorkflowStep,
AppModelsResponseAgent,
AppModelsResponseAgentInvoke,
AppModelsResponseApiKey,
AppModelsResponseApiUser,
AppModelsResponseDatasource,
AppModelsResponseLlm,
Expand All @@ -38,6 +43,7 @@
PrismaModelsAgentDatasource,
PrismaModelsAgentLlm,
PrismaModelsAgentTool,
PrismaModelsApiKey,
PrismaModelsApiUser,
PrismaModelsDatasource,
PrismaModelsLlm,
Expand All @@ -59,14 +65,18 @@
WorkflowStepList,
)
from .errors import UnprocessableEntityError
from .resources import agent, api_user, datasource, llm, tool, vector_database, workflow, workflow_config
from .resources import agent, api_key, api_user, datasource, llm, tool, vector_database, workflow, workflow_config
from .environment import SuperagentEnvironment

__all__ = [
"AgentDatasosurceList",
"AgentList",
"AgentToolList",
"AgentType",
"ApiKeyCreate",
"ApiKeyCreateModel",
"ApiKeyList",
"AppModelsRequestApiKey",
"AppModelsRequestApiUser",
"AppModelsRequestDatasource",
"AppModelsRequestLlm",
Expand All @@ -75,6 +85,7 @@
"AppModelsRequestWorkflowStep",
"AppModelsResponseAgent",
"AppModelsResponseAgentInvoke",
"AppModelsResponseApiKey",
"AppModelsResponseApiUser",
"AppModelsResponseDatasource",
"AppModelsResponseLlm",
Expand All @@ -100,6 +111,7 @@
"PrismaModelsAgentDatasource",
"PrismaModelsAgentLlm",
"PrismaModelsAgentTool",
"PrismaModelsApiKey",
"PrismaModelsApiUser",
"PrismaModelsDatasource",
"PrismaModelsLlm",
Expand All @@ -122,6 +134,7 @@
"WorkflowList",
"WorkflowStepList",
"agent",
"api_key",
"api_user",
"datasource",
"llm",
Expand Down
3 changes: 3 additions & 0 deletions src/superagent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .environment import SuperagentEnvironment
from .resources.agent.client import AgentClient, AsyncAgentClient
from .resources.api_key.client import ApiKeyClient, AsyncApiKeyClient
from .resources.api_user.client import ApiUserClient, AsyncApiUserClient
from .resources.datasource.client import AsyncDatasourceClient, DatasourceClient
from .resources.llm.client import AsyncLlmClient, LlmClient
Expand Down Expand Up @@ -34,6 +35,7 @@ def __init__(
self.agent = AgentClient(client_wrapper=self._client_wrapper)
self.llm = LlmClient(client_wrapper=self._client_wrapper)
self.api_user = ApiUserClient(client_wrapper=self._client_wrapper)
self.api_key = ApiKeyClient(client_wrapper=self._client_wrapper)
self.datasource = DatasourceClient(client_wrapper=self._client_wrapper)
self.tool = ToolClient(client_wrapper=self._client_wrapper)
self.workflow = WorkflowClient(client_wrapper=self._client_wrapper)
Expand All @@ -59,6 +61,7 @@ def __init__(
self.agent = AsyncAgentClient(client_wrapper=self._client_wrapper)
self.llm = AsyncLlmClient(client_wrapper=self._client_wrapper)
self.api_user = AsyncApiUserClient(client_wrapper=self._client_wrapper)
self.api_key = AsyncApiKeyClient(client_wrapper=self._client_wrapper)
self.datasource = AsyncDatasourceClient(client_wrapper=self._client_wrapper)
self.tool = AsyncToolClient(client_wrapper=self._client_wrapper)
self.workflow = AsyncWorkflowClient(client_wrapper=self._client_wrapper)
Expand Down
2 changes: 1 addition & 1 deletion src/superagent/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.2.11",
"X-Fern-SDK-Version": "v0.2.12",
}
token = self._get_token()
if token is not None:
Expand Down
14 changes: 12 additions & 2 deletions src/superagent/resources/__init__.py
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",
]
2 changes: 2 additions & 0 deletions src/superagent/resources/api_key/__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.

215 changes: 215 additions & 0 deletions src/superagent/resources/api_key/client.py
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)
Loading

0 comments on commit 39b391e

Please sign in to comment.