Skip to content

Commit f0ba58f

Browse files
feat(api): manual updates
1 parent 9c92875 commit f0ba58f

10 files changed

Lines changed: 112 additions & 109 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-be7a4aeebb1605262935b4b3ab446a95b1fad8a7d18098943dd548c8a486ef13.yml
3-
openapi_spec_hash: 1c950a109f80140711e7ae2cf87fddad
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-43f4549d7362ccad24d8f6124e73023a6cd5b62dab9c48cf3173435ca2f23155.yml
3+
openapi_spec_hash: 920add25d34d7a858dad464ea558ce48
44
config_hash: b3ca4ec5b02e5333af51ebc2e9fdef1b

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ from browserbase import Browserbase
135135
client = Browserbase()
136136

137137
session = client.sessions.create(
138-
project_id="projectId",
139138
browser_settings={},
140139
)
141140
print(session.browser_settings)

src/browserbase/resources/contexts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import httpx
66

77
from ..types import context_create_params
8-
from .._types import Body, Query, Headers, NotGiven, not_given
8+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
99
from .._utils import maybe_transform, async_maybe_transform
1010
from .._compat import cached_property
1111
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -46,7 +46,7 @@ def with_streaming_response(self) -> ContextsResourceWithStreamingResponse:
4646
def create(
4747
self,
4848
*,
49-
project_id: str,
49+
project_id: str | Omit = omit,
5050
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5151
# The extra values given here take precedence over values defined on the client or passed to this method.
5252
extra_headers: Headers | None = None,
@@ -169,7 +169,7 @@ def with_streaming_response(self) -> AsyncContextsResourceWithStreamingResponse:
169169
async def create(
170170
self,
171171
*,
172-
project_id: str,
172+
project_id: str | Omit = omit,
173173
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
174174
# The extra values given here take precedence over values defined on the client or passed to this method.
175175
extra_headers: Headers | None = None,

src/browserbase/resources/sessions/sessions.py

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ def with_streaming_response(self) -> SessionsResourceWithStreamingResponse:
9999
def create(
100100
self,
101101
*,
102-
project_id: str,
103102
browser_settings: session_create_params.BrowserSettings | Omit = omit,
104103
extension_id: str | Omit = omit,
105104
keep_alive: bool | Omit = omit,
105+
project_id: str | Omit = omit,
106106
proxies: Union[Iterable[session_create_params.ProxiesUnionMember0], bool] | Omit = omit,
107107
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | Omit = omit,
108108
api_timeout: int | Omit = omit,
@@ -117,17 +117,17 @@ def create(
117117
"""Create a Session
118118
119119
Args:
120-
project_id: The Project ID.
120+
extension_id: The uploaded Extension ID.
121121
122-
Can be found in
123-
[Settings](https://www.browserbase.com/settings).
124-
125-
extension_id: The uploaded Extension ID. See
122+
See
126123
[Upload Extension](/reference/api/upload-an-extension).
127124
128125
keep_alive: Set to true to keep the session alive even after disconnections. Available on
129126
the Hobby Plan and above.
130127
128+
project_id: The Project ID. Can be found in
129+
[Settings](https://www.browserbase.com/settings).
130+
131131
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
132132
configurations.
133133
@@ -151,10 +151,10 @@ def create(
151151
"/v1/sessions",
152152
body=maybe_transform(
153153
{
154-
"project_id": project_id,
155154
"browser_settings": browser_settings,
156155
"extension_id": extension_id,
157156
"keep_alive": keep_alive,
157+
"project_id": project_id,
158158
"proxies": proxies,
159159
"region": region,
160160
"api_timeout": api_timeout,
@@ -205,26 +205,25 @@ def update(
205205
self,
206206
id: str,
207207
*,
208-
project_id: str,
209208
status: Literal["REQUEST_RELEASE"],
209+
project_id: str | Omit = omit,
210210
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211211
# The extra values given here take precedence over values defined on the client or passed to this method.
212212
extra_headers: Headers | None = None,
213213
extra_query: Query | None = None,
214214
extra_body: Body | None = None,
215215
timeout: float | httpx.Timeout | None | NotGiven = not_given,
216216
) -> SessionUpdateResponse:
217-
"""Update a Session
217+
"""
218+
Update a Session
218219
219220
Args:
220-
project_id: The Project ID.
221-
222-
Can be found in
223-
[Settings](https://www.browserbase.com/settings).
224-
225221
status: Set to `REQUEST_RELEASE` to request that the session complete. Use before
226222
session's timeout to avoid additional charges.
227223
224+
project_id: The Project ID. Can be found in
225+
[Settings](https://www.browserbase.com/settings).
226+
228227
extra_headers: Send extra headers
229228
230229
extra_query: Add additional query parameters to the request
@@ -239,8 +238,8 @@ def update(
239238
f"/v1/sessions/{id}",
240239
body=maybe_transform(
241240
{
242-
"project_id": project_id,
243241
"status": status,
242+
"project_id": project_id,
244243
},
245244
session_update_params.SessionUpdateParams,
246245
),
@@ -370,10 +369,10 @@ def with_streaming_response(self) -> AsyncSessionsResourceWithStreamingResponse:
370369
async def create(
371370
self,
372371
*,
373-
project_id: str,
374372
browser_settings: session_create_params.BrowserSettings | Omit = omit,
375373
extension_id: str | Omit = omit,
376374
keep_alive: bool | Omit = omit,
375+
project_id: str | Omit = omit,
377376
proxies: Union[Iterable[session_create_params.ProxiesUnionMember0], bool] | Omit = omit,
378377
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | Omit = omit,
379378
api_timeout: int | Omit = omit,
@@ -388,17 +387,17 @@ async def create(
388387
"""Create a Session
389388
390389
Args:
391-
project_id: The Project ID.
390+
extension_id: The uploaded Extension ID.
392391
393-
Can be found in
394-
[Settings](https://www.browserbase.com/settings).
395-
396-
extension_id: The uploaded Extension ID. See
392+
See
397393
[Upload Extension](/reference/api/upload-an-extension).
398394
399395
keep_alive: Set to true to keep the session alive even after disconnections. Available on
400396
the Hobby Plan and above.
401397
398+
project_id: The Project ID. Can be found in
399+
[Settings](https://www.browserbase.com/settings).
400+
402401
proxies: Proxy configuration. Can be true for default proxy, or an array of proxy
403402
configurations.
404403
@@ -422,10 +421,10 @@ async def create(
422421
"/v1/sessions",
423422
body=await async_maybe_transform(
424423
{
425-
"project_id": project_id,
426424
"browser_settings": browser_settings,
427425
"extension_id": extension_id,
428426
"keep_alive": keep_alive,
427+
"project_id": project_id,
429428
"proxies": proxies,
430429
"region": region,
431430
"api_timeout": api_timeout,
@@ -476,26 +475,25 @@ async def update(
476475
self,
477476
id: str,
478477
*,
479-
project_id: str,
480478
status: Literal["REQUEST_RELEASE"],
479+
project_id: str | Omit = omit,
481480
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
482481
# The extra values given here take precedence over values defined on the client or passed to this method.
483482
extra_headers: Headers | None = None,
484483
extra_query: Query | None = None,
485484
extra_body: Body | None = None,
486485
timeout: float | httpx.Timeout | None | NotGiven = not_given,
487486
) -> SessionUpdateResponse:
488-
"""Update a Session
487+
"""
488+
Update a Session
489489
490490
Args:
491-
project_id: The Project ID.
492-
493-
Can be found in
494-
[Settings](https://www.browserbase.com/settings).
495-
496491
status: Set to `REQUEST_RELEASE` to request that the session complete. Use before
497492
session's timeout to avoid additional charges.
498493
494+
project_id: The Project ID. Can be found in
495+
[Settings](https://www.browserbase.com/settings).
496+
499497
extra_headers: Send extra headers
500498
501499
extra_query: Add additional query parameters to the request
@@ -510,8 +508,8 @@ async def update(
510508
f"/v1/sessions/{id}",
511509
body=await async_maybe_transform(
512510
{
513-
"project_id": project_id,
514511
"status": status,
512+
"project_id": project_id,
515513
},
516514
session_update_params.SessionUpdateParams,
517515
),

src/browserbase/types/context_create_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, Annotated, TypedDict
5+
from typing_extensions import Annotated, TypedDict
66

77
from .._utils import PropertyInfo
88

99
__all__ = ["ContextCreateParams"]
1010

1111

1212
class ContextCreateParams(TypedDict, total=False):
13-
project_id: Required[Annotated[str, PropertyInfo(alias="projectId")]]
13+
project_id: Annotated[str, PropertyInfo(alias="projectId")]
1414
"""The Project ID.
1515
1616
Can be found in [Settings](https://www.browserbase.com/settings).

src/browserbase/types/session_create_params.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@
1919
"ProxiesUnionMember0UnionMember0",
2020
"ProxiesUnionMember0UnionMember0Geolocation",
2121
"ProxiesUnionMember0UnionMember1",
22+
"ProxiesUnionMember0UnionMember2",
2223
]
2324

2425

2526
class SessionCreateParams(TypedDict, total=False):
26-
project_id: Required[Annotated[str, PropertyInfo(alias="projectId")]]
27-
"""The Project ID.
28-
29-
Can be found in [Settings](https://www.browserbase.com/settings).
30-
"""
31-
3227
browser_settings: Annotated[BrowserSettings, PropertyInfo(alias="browserSettings")]
3328

3429
extension_id: Annotated[str, PropertyInfo(alias="extensionId")]
@@ -43,6 +38,12 @@ class SessionCreateParams(TypedDict, total=False):
4338
Available on the Hobby Plan and above.
4439
"""
4540

41+
project_id: Annotated[str, PropertyInfo(alias="projectId")]
42+
"""The Project ID.
43+
44+
Can be found in [Settings](https://www.browserbase.com/settings).
45+
"""
46+
4647
proxies: Union[Iterable[ProxiesUnionMember0], bool]
4748
"""Proxy configuration.
4849
@@ -213,4 +214,17 @@ class ProxiesUnionMember0UnionMember1(TypedDict, total=False):
213214
"""Username for external proxy authentication. Optional."""
214215

215216

216-
ProxiesUnionMember0: TypeAlias = Union[ProxiesUnionMember0UnionMember0, ProxiesUnionMember0UnionMember1]
217+
class ProxiesUnionMember0UnionMember2(TypedDict, total=False):
218+
type: Required[Literal["none"]]
219+
"""Type of proxy. Always 'none' for this config."""
220+
221+
domain_pattern: Annotated[str, PropertyInfo(alias="domainPattern")]
222+
"""Domain pattern for which this proxy should be used.
223+
224+
If omitted, defaults to all domains. Optional.
225+
"""
226+
227+
228+
ProxiesUnionMember0: TypeAlias = Union[
229+
ProxiesUnionMember0UnionMember0, ProxiesUnionMember0UnionMember1, ProxiesUnionMember0UnionMember2
230+
]

src/browserbase/types/session_update_params.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111

1212
class SessionUpdateParams(TypedDict, total=False):
13-
project_id: Required[Annotated[str, PropertyInfo(alias="projectId")]]
14-
"""The Project ID.
15-
16-
Can be found in [Settings](https://www.browserbase.com/settings).
17-
"""
18-
1913
status: Required[Literal["REQUEST_RELEASE"]]
2014
"""Set to `REQUEST_RELEASE` to request that the session complete.
2115
2216
Use before session's timeout to avoid additional charges.
2317
"""
18+
19+
project_id: Annotated[str, PropertyInfo(alias="projectId")]
20+
"""The Project ID.
21+
22+
Can be found in [Settings](https://www.browserbase.com/settings).
23+
"""

tests/api_resources/test_contexts.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ class TestContexts:
2323

2424
@parametrize
2525
def test_method_create(self, client: Browserbase) -> None:
26+
context = client.contexts.create()
27+
assert_matches_type(ContextCreateResponse, context, path=["response"])
28+
29+
@parametrize
30+
def test_method_create_with_all_params(self, client: Browserbase) -> None:
2631
context = client.contexts.create(
2732
project_id="projectId",
2833
)
2934
assert_matches_type(ContextCreateResponse, context, path=["response"])
3035

3136
@parametrize
3237
def test_raw_response_create(self, client: Browserbase) -> None:
33-
response = client.contexts.with_raw_response.create(
34-
project_id="projectId",
35-
)
38+
response = client.contexts.with_raw_response.create()
3639

3740
assert response.is_closed is True
3841
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -41,9 +44,7 @@ def test_raw_response_create(self, client: Browserbase) -> None:
4144

4245
@parametrize
4346
def test_streaming_response_create(self, client: Browserbase) -> None:
44-
with client.contexts.with_streaming_response.create(
45-
project_id="projectId",
46-
) as response:
47+
with client.contexts.with_streaming_response.create() as response:
4748
assert not response.is_closed
4849
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4950

@@ -136,16 +137,19 @@ class TestAsyncContexts:
136137

137138
@parametrize
138139
async def test_method_create(self, async_client: AsyncBrowserbase) -> None:
140+
context = await async_client.contexts.create()
141+
assert_matches_type(ContextCreateResponse, context, path=["response"])
142+
143+
@parametrize
144+
async def test_method_create_with_all_params(self, async_client: AsyncBrowserbase) -> None:
139145
context = await async_client.contexts.create(
140146
project_id="projectId",
141147
)
142148
assert_matches_type(ContextCreateResponse, context, path=["response"])
143149

144150
@parametrize
145151
async def test_raw_response_create(self, async_client: AsyncBrowserbase) -> None:
146-
response = await async_client.contexts.with_raw_response.create(
147-
project_id="projectId",
148-
)
152+
response = await async_client.contexts.with_raw_response.create()
149153

150154
assert response.is_closed is True
151155
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -154,9 +158,7 @@ async def test_raw_response_create(self, async_client: AsyncBrowserbase) -> None
154158

155159
@parametrize
156160
async def test_streaming_response_create(self, async_client: AsyncBrowserbase) -> None:
157-
async with async_client.contexts.with_streaming_response.create(
158-
project_id="projectId",
159-
) as response:
161+
async with async_client.contexts.with_streaming_response.create() as response:
160162
assert not response.is_closed
161163
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
162164

0 commit comments

Comments
 (0)