Skip to content

feat(api): api update #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 18
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-f1ba1f2c1512973c1640f7e2d27c72c4f5c49ec07e70b026d52818e7f8b1468e.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fbrowserbase-6a5cbe2f816042d594335d77f9600cd47cdb9c21d9d60971a2eca87983061c72.yml
30 changes: 21 additions & 9 deletions src/browserbase/resources/sessions/sessions.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Union, Iterable
from typing import Dict, Union, Iterable
from typing_extensions import Literal

import httpx
@@ -108,7 +108,7 @@ def create(
proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
api_timeout: int | NotGiven = NOT_GIVEN,
user_metadata: object | NotGiven = NOT_GIVEN,
user_metadata: Dict[str, object] | 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,
@@ -138,7 +138,8 @@ def create(
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
the Project's `defaultTimeout`.

user_metadata: Arbitrary user metadata to attach to the session.
user_metadata: Arbitrary user metadata to attach to the session. To learn more about user
metadata, see [User Metadata](/features/sessions#user-metadata).

extra_headers: Send extra headers

@@ -263,10 +264,15 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SessionListResponse:
"""
List Sessions
"""List Sessions

Args:
q: Query sessions by user metadata.

See
[Querying Sessions by User Metadata](/features/sessions#querying-sessions-by-user-metadata)
for the schema of this query.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
@@ -373,7 +379,7 @@ async def create(
proxies: Union[bool, Iterable[session_create_params.ProxiesUnionMember1]] | NotGiven = NOT_GIVEN,
region: Literal["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"] | NotGiven = NOT_GIVEN,
api_timeout: int | NotGiven = NOT_GIVEN,
user_metadata: object | NotGiven = NOT_GIVEN,
user_metadata: Dict[str, object] | 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,
@@ -403,7 +409,8 @@ async def create(
api_timeout: Duration in seconds after which the session will automatically end. Defaults to
the Project's `defaultTimeout`.

user_metadata: Arbitrary user metadata to attach to the session.
user_metadata: Arbitrary user metadata to attach to the session. To learn more about user
metadata, see [User Metadata](/features/sessions#user-metadata).

extra_headers: Send extra headers

@@ -528,10 +535,15 @@ async def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SessionListResponse:
"""
List Sessions
"""List Sessions

Args:
q: Query sessions by user metadata.

See
[Querying Sessions by User Metadata](/features/sessions#querying-sessions-by-user-metadata)
for the schema of this query.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
10 changes: 7 additions & 3 deletions src/browserbase/types/session.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from datetime import datetime
from typing_extensions import Literal

@@ -47,5 +47,9 @@ class Session(BaseModel):
memory_usage: Optional[int] = FieldInfo(alias="memoryUsage", default=None)
"""Memory used by the Session"""

user_metadata: Optional[object] = FieldInfo(alias="userMetadata", default=None)
"""Arbitrary user metadata to attach to the session."""
user_metadata: Optional[Dict[str, object]] = FieldInfo(alias="userMetadata", default=None)
"""Arbitrary user metadata to attach to the session.

To learn more about user metadata, see
[User Metadata](/features/sessions#user-metadata).
"""
10 changes: 7 additions & 3 deletions src/browserbase/types/session_create_params.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Union, Iterable
from typing import Dict, List, Union, Iterable
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict

from .._utils import PropertyInfo
@@ -57,8 +57,12 @@ class SessionCreateParams(TypedDict, total=False):
Defaults to the Project's `defaultTimeout`.
"""

user_metadata: Annotated[object, PropertyInfo(alias="userMetadata")]
"""Arbitrary user metadata to attach to the session."""
user_metadata: Annotated[Dict[str, object], PropertyInfo(alias="userMetadata")]
"""Arbitrary user metadata to attach to the session.

To learn more about user metadata, see
[User Metadata](/features/sessions#user-metadata).
"""


class BrowserSettingsContext(TypedDict, total=False):
10 changes: 7 additions & 3 deletions src/browserbase/types/session_create_response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import Dict, Optional
from datetime import datetime
from typing_extensions import Literal

@@ -56,5 +56,9 @@ class SessionCreateResponse(BaseModel):
memory_usage: Optional[int] = FieldInfo(alias="memoryUsage", default=None)
"""Memory used by the Session"""

user_metadata: Optional[object] = FieldInfo(alias="userMetadata", default=None)
"""Arbitrary user metadata to attach to the session."""
user_metadata: Optional[Dict[str, object]] = FieldInfo(alias="userMetadata", default=None)
"""Arbitrary user metadata to attach to the session.

To learn more about user metadata, see
[User Metadata](/features/sessions#user-metadata).
"""
6 changes: 6 additions & 0 deletions src/browserbase/types/session_list_params.py
Original file line number Diff line number Diff line change
@@ -9,5 +9,11 @@

class SessionListParams(TypedDict, total=False):
q: str
"""Query sessions by user metadata.

See
[Querying Sessions by User Metadata](/features/sessions#querying-sessions-by-user-metadata)
for the schema of this query.
"""

status: Literal["RUNNING", "ERROR", "TIMED_OUT", "COMPLETED"]
4 changes: 2 additions & 2 deletions tests/api_resources/test_sessions.py
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ def test_method_create_with_all_params(self, client: Browserbase) -> None:
proxies=True,
region="us-west-2",
api_timeout=60,
user_metadata={},
user_metadata={"foo": "bar"},
)
assert_matches_type(SessionCreateResponse, session, path=["response"])

@@ -299,7 +299,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncBrowserbas
proxies=True,
region="us-west-2",
api_timeout=60,
user_metadata={},
user_metadata={"foo": "bar"},
)
assert_matches_type(SessionCreateResponse, session, path=["response"])