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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.6.0"
".": "1.7.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brainbase-egrigokhan%2Fbrainbase-0c00485d66a3b7505f3247467ef293fa5fb43a64e90a8b03a4127a2d9b15e6ab.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brainbase-egrigokhan%2Fbrainbase-a197a88d1abbdbd5c886875d2cf12ffd6abf79aec7d4dbd0439ed50197692eba.yml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.7.0 (2025-02-04)

Full Changelog: [v1.6.0...v1.7.0](https://github.com/BrainbaseHQ/brainbase-python-sdk/compare/v1.6.0...v1.7.0)

### Features

* **api:** update via SDK Studio ([#33](https://github.com/BrainbaseHQ/brainbase-python-sdk/issues/33)) ([1a43ad3](https://github.com/BrainbaseHQ/brainbase-python-sdk/commit/1a43ad3644983ec2d83f2ed24e87142cf7088c28))


### Chores

* remove custom code ([67dfb3e](https://github.com/BrainbaseHQ/brainbase-python-sdk/commit/67dfb3e6cd1e11368ec1eb934f7004987014ec3c))

## 1.6.0 (2025-02-04)

Full Changelog: [v1.5.0...v1.6.0](https://github.com/BrainbaseHQ/brainbase-python-sdk/compare/v1.5.0...v1.6.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).

## Documentation

The REST API documentation can be found on [docs.usebrainbase.com](https://docs.usebrainbase.com). The full API of this library can be found in [api.md](api.md).
The REST API documentation can be found on [docs.brainbase.com](https://docs.brainbase.com). The full API of this library can be found in [api.md](api.md).

## Installation

Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Methods:

- <code title="post /api/workers">client.workers.<a href="./src/brainbase/resources/workers/workers.py">create</a>(\*\*<a href="src/brainbase/types/worker_create_params.py">params</a>) -> None</code>
- <code title="get /api/workers/{id}">client.workers.<a href="./src/brainbase/resources/workers/workers.py">retrieve</a>(id) -> None</code>
- <code title="post /api/workers/{id}">client.workers.<a href="./src/brainbase/resources/workers/workers.py">update</a>(id, \*\*<a href="src/brainbase/types/worker_update_params.py">params</a>) -> None</code>
- <code title="get /api/workers">client.workers.<a href="./src/brainbase/resources/workers/workers.py">list</a>() -> None</code>
- <code title="delete /api/workers/{id}">client.workers.<a href="./src/brainbase/resources/workers/workers.py">delete</a>(id) -> None</code>

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "brainbase-labs"
version = "1.6.0"
version = "1.7.0"
description = "The official Python library for the brainbase API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
12 changes: 6 additions & 6 deletions src/brainbase/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ def __init__(
) -> None:
"""Construct a new synchronous brainbase client instance.

This automatically infers the `api_key` argument from the `API_KEY` environment variable if it is not provided.
This automatically infers the `api_key` argument from the `BRAINBASE_API_KEY` environment variable if it is not provided.
"""
if api_key is None:
api_key = os.environ.get("API_KEY")
api_key = os.environ.get("BRAINBASE_API_KEY")
if api_key is None:
raise BrainbaseError(
"The api_key client option must be set either by passing api_key to the client or by setting the API_KEY environment variable"
"The api_key client option must be set either by passing api_key to the client or by setting the BRAINBASE_API_KEY environment variable"
)
self.api_key = api_key

Expand Down Expand Up @@ -240,13 +240,13 @@ def __init__(
) -> None:
"""Construct a new async brainbase client instance.

This automatically infers the `api_key` argument from the `API_KEY` environment variable if it is not provided.
This automatically infers the `api_key` argument from the `BRAINBASE_API_KEY` environment variable if it is not provided.
"""
if api_key is None:
api_key = os.environ.get("API_KEY")
api_key = os.environ.get("BRAINBASE_API_KEY")
if api_key is None:
raise BrainbaseError(
"The api_key client option must be set either by passing api_key to the client or by setting the API_KEY environment variable"
"The api_key client option must be set either by passing api_key to the client or by setting the BRAINBASE_API_KEY environment variable"
)
self.api_key = api_key

Expand Down
2 changes: 1 addition & 1 deletion src/brainbase/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "brainbase"
__version__ = "1.6.0" # x-release-please-version
__version__ = "1.7.0" # x-release-please-version
104 changes: 103 additions & 1 deletion src/brainbase/resources/workers/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
FlowsResourceWithStreamingResponse,
AsyncFlowsResourceWithStreamingResponse,
)
from ...types import worker_create_params
from ...types import worker_create_params, worker_update_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
Expand Down Expand Up @@ -143,6 +143,51 @@ def retrieve(
cast_to=NoneType,
)

def update(
self,
id: str,
*,
description: str | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
status: str | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Update a worker

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._post(
f"/api/workers/{id}",
body=maybe_transform(
{
"description": description,
"name": name,
"status": status,
},
worker_update_params.WorkerUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)

def list(
self,
*,
Expand Down Expand Up @@ -302,6 +347,51 @@ async def retrieve(
cast_to=NoneType,
)

async def update(
self,
id: str,
*,
description: str | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
status: str | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Update a worker

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._post(
f"/api/workers/{id}",
body=await async_maybe_transform(
{
"description": description,
"name": name,
"status": status,
},
worker_update_params.WorkerUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=NoneType,
)

async def list(
self,
*,
Expand Down Expand Up @@ -367,6 +457,9 @@ def __init__(self, workers: WorkersResource) -> None:
self.retrieve = to_raw_response_wrapper(
workers.retrieve,
)
self.update = to_raw_response_wrapper(
workers.update,
)
self.list = to_raw_response_wrapper(
workers.list,
)
Expand All @@ -393,6 +486,9 @@ def __init__(self, workers: AsyncWorkersResource) -> None:
self.retrieve = async_to_raw_response_wrapper(
workers.retrieve,
)
self.update = async_to_raw_response_wrapper(
workers.update,
)
self.list = async_to_raw_response_wrapper(
workers.list,
)
Expand All @@ -419,6 +515,9 @@ def __init__(self, workers: WorkersResource) -> None:
self.retrieve = to_streamed_response_wrapper(
workers.retrieve,
)
self.update = to_streamed_response_wrapper(
workers.update,
)
self.list = to_streamed_response_wrapper(
workers.list,
)
Expand All @@ -445,6 +544,9 @@ def __init__(self, workers: AsyncWorkersResource) -> None:
self.retrieve = async_to_streamed_response_wrapper(
workers.retrieve,
)
self.update = async_to_streamed_response_wrapper(
workers.update,
)
self.list = async_to_streamed_response_wrapper(
workers.list,
)
Expand Down
1 change: 1 addition & 0 deletions src/brainbase/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from __future__ import annotations

from .worker_create_params import WorkerCreateParams as WorkerCreateParams
from .worker_update_params import WorkerUpdateParams as WorkerUpdateParams
15 changes: 15 additions & 0 deletions src/brainbase/types/worker_update_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

__all__ = ["WorkerUpdateParams"]


class WorkerUpdateParams(TypedDict, total=False):
description: str

name: str

status: str
106 changes: 106 additions & 0 deletions tests/api_resources/test_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,59 @@ def test_path_params_retrieve(self, client: Brainbase) -> None:
"",
)

@pytest.mark.skip()
@parametrize
def test_method_update(self, client: Brainbase) -> None:
worker = client.workers.update(
id="id",
)
assert worker is None

@pytest.mark.skip()
@parametrize
def test_method_update_with_all_params(self, client: Brainbase) -> None:
worker = client.workers.update(
id="id",
description="description",
name="name",
status="status",
)
assert worker is None

@pytest.mark.skip()
@parametrize
def test_raw_response_update(self, client: Brainbase) -> None:
response = client.workers.with_raw_response.update(
id="id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
worker = response.parse()
assert worker is None

@pytest.mark.skip()
@parametrize
def test_streaming_response_update(self, client: Brainbase) -> None:
with client.workers.with_streaming_response.update(
id="id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

worker = response.parse()
assert worker is None

assert cast(Any, response.is_closed) is True

@pytest.mark.skip()
@parametrize
def test_path_params_update(self, client: Brainbase) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
client.workers.with_raw_response.update(
id="",
)

@pytest.mark.skip()
@parametrize
def test_method_list(self, client: Brainbase) -> None:
Expand Down Expand Up @@ -261,6 +314,59 @@ async def test_path_params_retrieve(self, async_client: AsyncBrainbase) -> None:
"",
)

@pytest.mark.skip()
@parametrize
async def test_method_update(self, async_client: AsyncBrainbase) -> None:
worker = await async_client.workers.update(
id="id",
)
assert worker is None

@pytest.mark.skip()
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncBrainbase) -> None:
worker = await async_client.workers.update(
id="id",
description="description",
name="name",
status="status",
)
assert worker is None

@pytest.mark.skip()
@parametrize
async def test_raw_response_update(self, async_client: AsyncBrainbase) -> None:
response = await async_client.workers.with_raw_response.update(
id="id",
)

assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
worker = await response.parse()
assert worker is None

@pytest.mark.skip()
@parametrize
async def test_streaming_response_update(self, async_client: AsyncBrainbase) -> None:
async with async_client.workers.with_streaming_response.update(
id="id",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

worker = await response.parse()
assert worker is None

assert cast(Any, response.is_closed) is True

@pytest.mark.skip()
@parametrize
async def test_path_params_update(self, async_client: AsyncBrainbase) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
await async_client.workers.with_raw_response.update(
id="",
)

@pytest.mark.skip()
@parametrize
async def test_method_list(self, async_client: AsyncBrainbase) -> None:
Expand Down