update autogenerated client sdk (#2010)
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
from ..core.client_wrapper import SyncClientWrapper
|
||||
import typing
|
||||
from ..core.client_wrapper import SyncClientWrapper
|
||||
from ..core.request_options import RequestOptions
|
||||
from ..core.pydantic_utilities import parse_obj_as
|
||||
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
||||
from ..types.http_validation_error import HttpValidationError
|
||||
from json.decoder import JSONDecodeError
|
||||
from ..core.api_error import ApiError
|
||||
from ..types.get_organizations_response import GetOrganizationsResponse
|
||||
from ..types.organization import Organization
|
||||
from ..types.get_organization_api_keys_response import GetOrganizationApiKeysResponse
|
||||
from ..core.jsonable_encoder import jsonable_encoder
|
||||
from .. import core
|
||||
from ..core.client_wrapper import AsyncClientWrapper
|
||||
|
||||
# this is used as the default value for optional parameters
|
||||
OMIT = typing.cast(typing.Any, ...)
|
||||
|
||||
|
||||
class ServerClient:
|
||||
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
||||
@@ -39,9 +47,12 @@ class ServerClient:
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyverndocs import Skyvern
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern()
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.webhook()
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
@@ -77,7 +88,7 @@ class ServerClient:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
def check_status(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
|
||||
def heartbeat(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Optional[typing.Any]:
|
||||
"""
|
||||
Check if the server is running.
|
||||
|
||||
@@ -93,10 +104,13 @@ class ServerClient:
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyverndocs import Skyvern
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern()
|
||||
client.server.check_status()
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.heartbeat()
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"api/v1/heartbeat",
|
||||
@@ -117,6 +131,237 @@ class ServerClient:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
def get_organizations(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetOrganizationsResponse:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
GetOrganizationsResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.get_organizations()
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"api/v1/organizations",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
GetOrganizationsResponse,
|
||||
parse_obj_as(
|
||||
type_=GetOrganizationsResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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_organization(
|
||||
self, *, max_steps_per_run: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> Organization:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
max_steps_per_run : typing.Optional[int]
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Organization
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.update_organization()
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"api/v1/organizations",
|
||||
method="PUT",
|
||||
json={
|
||||
"max_steps_per_run": max_steps_per_run,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Organization,
|
||||
parse_obj_as(
|
||||
type_=Organization, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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 get_api_keys(
|
||||
self, organization_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> GetOrganizationApiKeysResponse:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
organization_id : str
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
GetOrganizationApiKeysResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.get_api_keys(
|
||||
organization_id="organization_id",
|
||||
)
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"api/v1/organizations/{jsonable_encoder(organization_id)}/apikeys/",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
GetOrganizationApiKeysResponse,
|
||||
parse_obj_as(
|
||||
type_=GetOrganizationApiKeysResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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 upload_file(
|
||||
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> typing.Optional[typing.Any]:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
file : core.File
|
||||
See core.File for more documentation
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.Optional[typing.Any]
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
client.server.upload_file()
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"api/v1/upload_file",
|
||||
method="POST",
|
||||
data={},
|
||||
files={
|
||||
"file": file,
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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 AsyncServerClient:
|
||||
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
||||
@@ -148,9 +393,12 @@ class AsyncServerClient:
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyverndocs import AsyncSkyvern
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern()
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
@@ -192,7 +440,7 @@ class AsyncServerClient:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
async def check_status(
|
||||
async def heartbeat(
|
||||
self, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> typing.Optional[typing.Any]:
|
||||
"""
|
||||
@@ -212,13 +460,16 @@ class AsyncServerClient:
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyverndocs import AsyncSkyvern
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern()
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.server.check_status()
|
||||
await client.server.heartbeat()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
@@ -241,3 +492,268 @@ class AsyncServerClient:
|
||||
except JSONDecodeError:
|
||||
raise ApiError(status_code=_response.status_code, body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, body=_response_json)
|
||||
|
||||
async def get_organizations(
|
||||
self, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> GetOrganizationsResponse:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
GetOrganizationsResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.server.get_organizations()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"api/v1/organizations",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
GetOrganizationsResponse,
|
||||
parse_obj_as(
|
||||
type_=GetOrganizationsResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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_organization(
|
||||
self, *, max_steps_per_run: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> Organization:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
max_steps_per_run : typing.Optional[int]
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Organization
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.server.update_organization()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"api/v1/organizations",
|
||||
method="PUT",
|
||||
json={
|
||||
"max_steps_per_run": max_steps_per_run,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
Organization,
|
||||
parse_obj_as(
|
||||
type_=Organization, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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 get_api_keys(
|
||||
self, organization_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> GetOrganizationApiKeysResponse:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
organization_id : str
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
GetOrganizationApiKeysResponse
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.server.get_api_keys(
|
||||
organization_id="organization_id",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"api/v1/organizations/{jsonable_encoder(organization_id)}/apikeys/",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
GetOrganizationApiKeysResponse,
|
||||
parse_obj_as(
|
||||
type_=GetOrganizationApiKeysResponse, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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 upload_file(
|
||||
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> typing.Optional[typing.Any]:
|
||||
"""
|
||||
Parameters
|
||||
----------
|
||||
file : core.File
|
||||
See core.File for more documentation
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.Optional[typing.Any]
|
||||
Successful Response
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
authorization="YOUR_AUTHORIZATION",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.server.upload_file()
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"api/v1/upload_file",
|
||||
method="POST",
|
||||
data={},
|
||||
files={
|
||||
"file": file,
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
return typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 422:
|
||||
raise UnprocessableEntityError(
|
||||
typing.cast(
|
||||
HttpValidationError,
|
||||
parse_obj_as(
|
||||
type_=HttpValidationError, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
)
|
||||
_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)
|
||||
|
||||
Reference in New Issue
Block a user