Skip to content

Commit 68ce162

Browse files
feat(api): api update
1 parent d3b0ab9 commit 68ce162

File tree

9 files changed

+432
-4
lines changed

9 files changed

+432
-4
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 92
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gbox%2Fgbox-sdk-f72fd628309315699dfb7b043b36760cdb7c68a286d8fb98aa499ec7673efd9c.yml
3-
openapi_spec_hash: 7d8ebfdffa9c12148bddffb303940fac
4-
config_hash: 0bac971f90a4ab4bc488c14246cc5f1a
1+
configured_endpoints: 93
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gbox%2Fgbox-sdk-94f652aed9166bb5cc03ef1a61a01a58537d1005c6c8af981cb5f0d2d60f0042.yml
3+
openapi_spec_hash: 9b1f6fd60387247c33622af8ad4687ab
4+
config_hash: 09531a3b47b37eecfb541e383d99e62c

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ Methods:
1414
- <code title="get /devices/{deviceId}">client.v1.devices.<a href="./src/gbox_sdk/resources/v1/devices.py">get</a>(device_id) -> <a href="./src/gbox_sdk/types/v1/device_info.py">DeviceInfo</a></code>
1515
- <code title="post /devices/{deviceId}/box">client.v1.devices.<a href="./src/gbox_sdk/resources/v1/devices.py">to_box</a>(device_id, \*\*<a href="src/gbox_sdk/types/v1/device_to_box_params.py">params</a>) -> str</code>
1616

17+
## Models
18+
19+
Types:
20+
21+
```python
22+
from gbox_sdk.types.v1 import ModelCallResponse
23+
```
24+
25+
Methods:
26+
27+
- <code title="post /model">client.v1.models.<a href="./src/gbox_sdk/resources/v1/models.py">call</a>(\*\*<a href="src/gbox_sdk/types/v1/model_call_params.py">params</a>) -> <a href="./src/gbox_sdk/types/v1/model_call_response.py">ModelCallResponse</a></code>
28+
1729
## Boxes
1830

1931
Types:

src/gbox_sdk/resources/v1/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
BoxesResourceWithStreamingResponse,
1717
AsyncBoxesResourceWithStreamingResponse,
1818
)
19+
from .models import (
20+
ModelsResource,
21+
AsyncModelsResource,
22+
ModelsResourceWithRawResponse,
23+
AsyncModelsResourceWithRawResponse,
24+
ModelsResourceWithStreamingResponse,
25+
AsyncModelsResourceWithStreamingResponse,
26+
)
1927
from .devices import (
2028
DevicesResource,
2129
AsyncDevicesResource,
@@ -32,6 +40,12 @@
3240
"AsyncDevicesResourceWithRawResponse",
3341
"DevicesResourceWithStreamingResponse",
3442
"AsyncDevicesResourceWithStreamingResponse",
43+
"ModelsResource",
44+
"AsyncModelsResource",
45+
"ModelsResourceWithRawResponse",
46+
"AsyncModelsResourceWithRawResponse",
47+
"ModelsResourceWithStreamingResponse",
48+
"AsyncModelsResourceWithStreamingResponse",
3549
"BoxesResource",
3650
"AsyncBoxesResource",
3751
"BoxesResourceWithRawResponse",
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal
6+
7+
import httpx
8+
9+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10+
from ..._utils import maybe_transform, async_maybe_transform
11+
from ..._compat import cached_property
12+
from ...types.v1 import model_call_params
13+
from ..._resource import SyncAPIResource, AsyncAPIResource
14+
from ..._response import (
15+
to_raw_response_wrapper,
16+
to_streamed_response_wrapper,
17+
async_to_raw_response_wrapper,
18+
async_to_streamed_response_wrapper,
19+
)
20+
from ..._base_client import make_request_options
21+
from ...types.v1.model_call_response import ModelCallResponse
22+
23+
__all__ = ["ModelsResource", "AsyncModelsResource"]
24+
25+
26+
class ModelsResource(SyncAPIResource):
27+
@cached_property
28+
def with_raw_response(self) -> ModelsResourceWithRawResponse:
29+
"""
30+
This property can be used as a prefix for any HTTP method call to return
31+
the raw response object instead of the parsed content.
32+
33+
For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers
34+
"""
35+
return ModelsResourceWithRawResponse(self)
36+
37+
@cached_property
38+
def with_streaming_response(self) -> ModelsResourceWithStreamingResponse:
39+
"""
40+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41+
42+
For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response
43+
"""
44+
return ModelsResourceWithStreamingResponse(self)
45+
46+
def call(
47+
self,
48+
*,
49+
action: object,
50+
screenshot: str,
51+
model: Literal["gbox-handy-1"] | Omit = omit,
52+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
53+
# The extra values given here take precedence over values defined on the client or passed to this method.
54+
extra_headers: Headers | None = None,
55+
extra_query: Query | None = None,
56+
extra_body: Body | None = None,
57+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
58+
) -> ModelCallResponse:
59+
"""
60+
Generate coordinates for a model
61+
62+
Args:
63+
action: Structured action object (click or drag)
64+
65+
screenshot: HTTP(S) URL to screenshot image
66+
67+
model: Model to use
68+
69+
extra_headers: Send extra headers
70+
71+
extra_query: Add additional query parameters to the request
72+
73+
extra_body: Add additional JSON properties to the request
74+
75+
timeout: Override the client-level default timeout for this request, in seconds
76+
"""
77+
return self._post(
78+
"/model",
79+
body=maybe_transform(
80+
{
81+
"action": action,
82+
"screenshot": screenshot,
83+
"model": model,
84+
},
85+
model_call_params.ModelCallParams,
86+
),
87+
options=make_request_options(
88+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
89+
),
90+
cast_to=ModelCallResponse,
91+
)
92+
93+
94+
class AsyncModelsResource(AsyncAPIResource):
95+
@cached_property
96+
def with_raw_response(self) -> AsyncModelsResourceWithRawResponse:
97+
"""
98+
This property can be used as a prefix for any HTTP method call to return
99+
the raw response object instead of the parsed content.
100+
101+
For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers
102+
"""
103+
return AsyncModelsResourceWithRawResponse(self)
104+
105+
@cached_property
106+
def with_streaming_response(self) -> AsyncModelsResourceWithStreamingResponse:
107+
"""
108+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
109+
110+
For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response
111+
"""
112+
return AsyncModelsResourceWithStreamingResponse(self)
113+
114+
async def call(
115+
self,
116+
*,
117+
action: object,
118+
screenshot: str,
119+
model: Literal["gbox-handy-1"] | Omit = omit,
120+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
121+
# The extra values given here take precedence over values defined on the client or passed to this method.
122+
extra_headers: Headers | None = None,
123+
extra_query: Query | None = None,
124+
extra_body: Body | None = None,
125+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
126+
) -> ModelCallResponse:
127+
"""
128+
Generate coordinates for a model
129+
130+
Args:
131+
action: Structured action object (click or drag)
132+
133+
screenshot: HTTP(S) URL to screenshot image
134+
135+
model: Model to use
136+
137+
extra_headers: Send extra headers
138+
139+
extra_query: Add additional query parameters to the request
140+
141+
extra_body: Add additional JSON properties to the request
142+
143+
timeout: Override the client-level default timeout for this request, in seconds
144+
"""
145+
return await self._post(
146+
"/model",
147+
body=await async_maybe_transform(
148+
{
149+
"action": action,
150+
"screenshot": screenshot,
151+
"model": model,
152+
},
153+
model_call_params.ModelCallParams,
154+
),
155+
options=make_request_options(
156+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
157+
),
158+
cast_to=ModelCallResponse,
159+
)
160+
161+
162+
class ModelsResourceWithRawResponse:
163+
def __init__(self, models: ModelsResource) -> None:
164+
self._models = models
165+
166+
self.call = to_raw_response_wrapper(
167+
models.call,
168+
)
169+
170+
171+
class AsyncModelsResourceWithRawResponse:
172+
def __init__(self, models: AsyncModelsResource) -> None:
173+
self._models = models
174+
175+
self.call = async_to_raw_response_wrapper(
176+
models.call,
177+
)
178+
179+
180+
class ModelsResourceWithStreamingResponse:
181+
def __init__(self, models: ModelsResource) -> None:
182+
self._models = models
183+
184+
self.call = to_streamed_response_wrapper(
185+
models.call,
186+
)
187+
188+
189+
class AsyncModelsResourceWithStreamingResponse:
190+
def __init__(self, models: AsyncModelsResource) -> None:
191+
self._models = models
192+
193+
self.call = async_to_streamed_response_wrapper(
194+
models.call,
195+
)

src/gbox_sdk/resources/v1/v1.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
from __future__ import annotations
44

5+
from .models import (
6+
ModelsResource,
7+
AsyncModelsResource,
8+
ModelsResourceWithRawResponse,
9+
AsyncModelsResourceWithRawResponse,
10+
ModelsResourceWithStreamingResponse,
11+
AsyncModelsResourceWithStreamingResponse,
12+
)
513
from .devices import (
614
DevicesResource,
715
AsyncDevicesResource,
@@ -29,6 +37,10 @@ class V1Resource(SyncAPIResource):
2937
def devices(self) -> DevicesResource:
3038
return DevicesResource(self._client)
3139

40+
@cached_property
41+
def models(self) -> ModelsResource:
42+
return ModelsResource(self._client)
43+
3244
@cached_property
3345
def boxes(self) -> BoxesResource:
3446
return BoxesResource(self._client)
@@ -58,6 +70,10 @@ class AsyncV1Resource(AsyncAPIResource):
5870
def devices(self) -> AsyncDevicesResource:
5971
return AsyncDevicesResource(self._client)
6072

73+
@cached_property
74+
def models(self) -> AsyncModelsResource:
75+
return AsyncModelsResource(self._client)
76+
6177
@cached_property
6278
def boxes(self) -> AsyncBoxesResource:
6379
return AsyncBoxesResource(self._client)
@@ -90,6 +106,10 @@ def __init__(self, v1: V1Resource) -> None:
90106
def devices(self) -> DevicesResourceWithRawResponse:
91107
return DevicesResourceWithRawResponse(self._v1.devices)
92108

109+
@cached_property
110+
def models(self) -> ModelsResourceWithRawResponse:
111+
return ModelsResourceWithRawResponse(self._v1.models)
112+
93113
@cached_property
94114
def boxes(self) -> BoxesResourceWithRawResponse:
95115
return BoxesResourceWithRawResponse(self._v1.boxes)
@@ -103,6 +123,10 @@ def __init__(self, v1: AsyncV1Resource) -> None:
103123
def devices(self) -> AsyncDevicesResourceWithRawResponse:
104124
return AsyncDevicesResourceWithRawResponse(self._v1.devices)
105125

126+
@cached_property
127+
def models(self) -> AsyncModelsResourceWithRawResponse:
128+
return AsyncModelsResourceWithRawResponse(self._v1.models)
129+
106130
@cached_property
107131
def boxes(self) -> AsyncBoxesResourceWithRawResponse:
108132
return AsyncBoxesResourceWithRawResponse(self._v1.boxes)
@@ -116,6 +140,10 @@ def __init__(self, v1: V1Resource) -> None:
116140
def devices(self) -> DevicesResourceWithStreamingResponse:
117141
return DevicesResourceWithStreamingResponse(self._v1.devices)
118142

143+
@cached_property
144+
def models(self) -> ModelsResourceWithStreamingResponse:
145+
return ModelsResourceWithStreamingResponse(self._v1.models)
146+
119147
@cached_property
120148
def boxes(self) -> BoxesResourceWithStreamingResponse:
121149
return BoxesResourceWithStreamingResponse(self._v1.boxes)
@@ -129,6 +157,10 @@ def __init__(self, v1: AsyncV1Resource) -> None:
129157
def devices(self) -> AsyncDevicesResourceWithStreamingResponse:
130158
return AsyncDevicesResourceWithStreamingResponse(self._v1.devices)
131159

160+
@cached_property
161+
def models(self) -> AsyncModelsResourceWithStreamingResponse:
162+
return AsyncModelsResourceWithStreamingResponse(self._v1.models)
163+
132164
@cached_property
133165
def boxes(self) -> AsyncBoxesResourceWithStreamingResponse:
134166
return AsyncBoxesResourceWithStreamingResponse(self._v1.boxes)

src/gbox_sdk/types/v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
from .box_start_params import BoxStartParams as BoxStartParams
1111
from .box_list_response import BoxListResponse as BoxListResponse
1212
from .box_stop_response import BoxStopResponse as BoxStopResponse
13+
from .model_call_params import ModelCallParams as ModelCallParams
1314
from .box_start_response import BoxStartResponse as BoxStartResponse
1415
from .device_list_params import DeviceListParams as DeviceListParams
1516
from .box_run_code_params import BoxRunCodeParams as BoxRunCodeParams
17+
from .model_call_response import ModelCallResponse as ModelCallResponse
1618
from .box_display_response import BoxDisplayResponse as BoxDisplayResponse
1719
from .box_terminate_params import BoxTerminateParams as BoxTerminateParams
1820
from .device_to_box_params import DeviceToBoxParams as DeviceToBoxParams
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["ModelCallParams"]
8+
9+
10+
class ModelCallParams(TypedDict, total=False):
11+
action: Required[object]
12+
"""Structured action object (click or drag)"""
13+
14+
screenshot: Required[str]
15+
"""HTTP(S) URL to screenshot image"""
16+
17+
model: Literal["gbox-handy-1"]
18+
"""Model to use"""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from ..._models import BaseModel
4+
5+
__all__ = ["ModelCallResponse"]
6+
7+
8+
class ModelCallResponse(BaseModel):
9+
id: str
10+
"""Unique ID of this request, can be used for issue reporting and feedback"""
11+
12+
response: object
13+
"""Model response data"""

0 commit comments

Comments
 (0)