Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-e0b226d400563e77eb480ed532a4a42e6594f2932d030a906147c2917595af05.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/arcade-ai%2Farcade-engine-d4269d3e7013741eeb30221bb022d65c5d81d7ed0edc06980eccf7c83fcb48a9.yml
openapi_spec_hash: 5661031e615bccd01256d82705ae27cc
config_hash: d86655f9af7ae4c4c444d9a16685a7c5
2 changes: 1 addition & 1 deletion src/arcadepy/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
setattr(typ, "__pydantic_config__", config) # noqa: B010


# our use of subclasssing here causes weirdness for type checkers,
# our use of subclassing here causes weirdness for type checkers,
# so we just pretend that we don't subclass
if TYPE_CHECKING:
GenericModel = BaseModel
Expand Down
2 changes: 1 addition & 1 deletion src/arcadepy/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None:
def _maybe_transform_key(key: str, type_: type) -> str:
"""Transform the given `data` based on the annotations provided in `type_`.

Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata.
Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata.
"""
annotated_type = _get_annotated_type(type_)
if annotated_type is None:
Expand Down
16 changes: 14 additions & 2 deletions src/arcadepy/resources/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def create(
self,
*,
id: str,
enabled: bool,
type: str,
enabled: bool | NotGiven = NOT_GIVEN,
http: worker_create_params.HTTP | NotGiven = NOT_GIVEN,
mcp: worker_create_params.Mcp | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -77,8 +79,10 @@ def create(
body=maybe_transform(
{
"id": id,
"type": type,
"enabled": enabled,
"http": http,
"mcp": mcp,
},
worker_create_params.WorkerCreateParams,
),
Expand All @@ -94,6 +98,7 @@ def update(
*,
enabled: bool | NotGiven = NOT_GIVEN,
http: worker_update_params.HTTP | NotGiven = NOT_GIVEN,
mcp: worker_update_params.Mcp | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -121,6 +126,7 @@ def update(
{
"enabled": enabled,
"http": http,
"mcp": mcp,
},
worker_update_params.WorkerUpdateParams,
),
Expand Down Expand Up @@ -352,8 +358,10 @@ async def create(
self,
*,
id: str,
enabled: bool,
type: str,
enabled: bool | NotGiven = NOT_GIVEN,
http: worker_create_params.HTTP | NotGiven = NOT_GIVEN,
mcp: worker_create_params.Mcp | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -378,8 +386,10 @@ async def create(
body=await async_maybe_transform(
{
"id": id,
"type": type,
"enabled": enabled,
"http": http,
"mcp": mcp,
},
worker_create_params.WorkerCreateParams,
),
Expand All @@ -395,6 +405,7 @@ async def update(
*,
enabled: bool | NotGiven = NOT_GIVEN,
http: worker_update_params.HTTP | NotGiven = NOT_GIVEN,
mcp: worker_update_params.Mcp | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -422,6 +433,7 @@ async def update(
{
"enabled": enabled,
"http": http,
"mcp": mcp,
},
worker_update_params.WorkerUpdateParams,
),
Expand Down
16 changes: 14 additions & 2 deletions src/arcadepy/types/worker_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@

from typing_extensions import Required, TypedDict

__all__ = ["WorkerCreateParams", "HTTP"]
__all__ = ["WorkerCreateParams", "HTTP", "Mcp"]


class WorkerCreateParams(TypedDict, total=False):
id: Required[str]

enabled: Required[bool]
type: Required[str]

enabled: bool

http: HTTP

mcp: Mcp


class HTTP(TypedDict, total=False):
retry: Required[int]
Expand All @@ -23,3 +27,11 @@ class HTTP(TypedDict, total=False):
timeout: Required[int]

uri: Required[str]


class Mcp(TypedDict, total=False):
retry: Required[int]

timeout: Required[int]

uri: Required[str]
36 changes: 34 additions & 2 deletions src/arcadepy/types/worker_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from .._models import BaseModel

__all__ = ["WorkerResponse", "HTTP", "HTTPSecret"]
__all__ = ["WorkerResponse", "HTTP", "HTTPSecret", "Mcp", "Oxp", "OxpSecret"]


class HTTPSecret(BaseModel):
Expand All @@ -30,11 +30,43 @@ class HTTP(BaseModel):
uri: Optional[str] = None


class Mcp(BaseModel):
retry: Optional[int] = None

timeout: Optional[int] = None

uri: Optional[str] = None


class OxpSecret(BaseModel):
binding: Optional[Literal["static", "tenant", "organization", "account"]] = None

editable: Optional[bool] = None

exists: Optional[bool] = None

hint: Optional[str] = None

value: Optional[str] = None


class Oxp(BaseModel):
retry: Optional[int] = None

secret: Optional[OxpSecret] = None

timeout: Optional[int] = None

uri: Optional[str] = None


class WorkerResponse(BaseModel):
id: Optional[str] = None

enabled: Optional[bool] = None

http: Optional[HTTP] = None

type: Optional[str] = None
mcp: Optional[Mcp] = None

oxp: Optional[Oxp] = None
12 changes: 11 additions & 1 deletion src/arcadepy/types/worker_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

from typing_extensions import TypedDict

__all__ = ["WorkerUpdateParams", "HTTP"]
__all__ = ["WorkerUpdateParams", "HTTP", "Mcp"]


class WorkerUpdateParams(TypedDict, total=False):
enabled: bool

http: HTTP

mcp: Mcp


class HTTP(TypedDict, total=False):
retry: int
Expand All @@ -21,3 +23,11 @@ class HTTP(TypedDict, total=False):
timeout: int

uri: str


class Mcp(TypedDict, total=False):
retry: int

timeout: int

uri: str
34 changes: 28 additions & 6 deletions tests/api_resources/test_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,35 @@ class TestWorkers:
def test_method_create(self, client: Arcade) -> None:
worker = client.workers.create(
id="id",
enabled=True,
type="type",
)
assert_matches_type(WorkerResponse, worker, path=["response"])

@parametrize
def test_method_create_with_all_params(self, client: Arcade) -> None:
worker = client.workers.create(
id="id",
type="type",
enabled=True,
http={
"retry": 0,
"secret": "secret",
"timeout": 1,
"uri": "uri",
},
mcp={
"retry": 0,
"timeout": 1,
"uri": "uri",
},
)
assert_matches_type(WorkerResponse, worker, path=["response"])

@parametrize
def test_raw_response_create(self, client: Arcade) -> None:
response = client.workers.with_raw_response.create(
id="id",
enabled=True,
type="type",
)

assert response.is_closed is True
Expand All @@ -60,7 +66,7 @@ def test_raw_response_create(self, client: Arcade) -> None:
def test_streaming_response_create(self, client: Arcade) -> None:
with client.workers.with_streaming_response.create(
id="id",
enabled=True,
type="type",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -88,6 +94,11 @@ def test_method_update_with_all_params(self, client: Arcade) -> None:
"timeout": 1,
"uri": "uri",
},
mcp={
"retry": 0,
"timeout": 1,
"uri": "uri",
},
)
assert_matches_type(WorkerResponse, worker, path=["response"])

Expand Down Expand Up @@ -324,29 +335,35 @@ class TestAsyncWorkers:
async def test_method_create(self, async_client: AsyncArcade) -> None:
worker = await async_client.workers.create(
id="id",
enabled=True,
type="type",
)
assert_matches_type(WorkerResponse, worker, path=["response"])

@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncArcade) -> None:
worker = await async_client.workers.create(
id="id",
type="type",
enabled=True,
http={
"retry": 0,
"secret": "secret",
"timeout": 1,
"uri": "uri",
},
mcp={
"retry": 0,
"timeout": 1,
"uri": "uri",
},
)
assert_matches_type(WorkerResponse, worker, path=["response"])

@parametrize
async def test_raw_response_create(self, async_client: AsyncArcade) -> None:
response = await async_client.workers.with_raw_response.create(
id="id",
enabled=True,
type="type",
)

assert response.is_closed is True
Expand All @@ -358,7 +375,7 @@ async def test_raw_response_create(self, async_client: AsyncArcade) -> None:
async def test_streaming_response_create(self, async_client: AsyncArcade) -> None:
async with async_client.workers.with_streaming_response.create(
id="id",
enabled=True,
type="type",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -386,6 +403,11 @@ async def test_method_update_with_all_params(self, async_client: AsyncArcade) ->
"timeout": 1,
"uri": "uri",
},
mcp={
"retry": 0,
"timeout": 1,
"uri": "uri",
},
)
assert_matches_type(WorkerResponse, worker, path=["response"])

Expand Down