diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 04b083c..2aa38c1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,18 +1,18 @@
name: CI
on:
push:
- branches:
- - main
- pull_request:
- branches:
- - main
- - next
+ branches-ignore:
+ - 'generated'
+ - 'codegen/**'
+ - 'integrated/**'
+ - 'stl-preview-head/**'
+ - 'stl-preview-base/**'
jobs:
lint:
timeout-minutes: 10
name: lint
- runs-on: ubuntu-latest
+ runs-on: ${{ github.repository == 'stainless-sdks/replicate-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
@@ -33,7 +33,7 @@ jobs:
test:
timeout-minutes: 10
name: test
- runs-on: ubuntu-latest
+ runs-on: ${{ github.repository == 'stainless-sdks/replicate-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index e8285b7..4f9005e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.5"
+ ".": "0.1.0-alpha.6"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 61aa00b..d3a92ec 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/replicate%2Freplicate-client-2788217b7ad7d61d1a77800bc5ff12a6810f1692d4d770b72fa8f898c6a055ab.yml
openapi_spec_hash: 4423bf747e228484547b441468a9f156
-config_hash: d820945093fc56fea6d062c90745d7a5
+config_hash: e9a36632894b8541a86a71420dd3d0b7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b53281..de6e811 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog
+## 0.1.0-alpha.6 (2025-04-24)
+
+Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/replicate/replicate-python-stainless/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
+
+### Bug Fixes
+
+* correct mapping for account.get ([e501778](https://github.com/replicate/replicate-python-stainless/commit/e501778a22c481147fbe419803a3f52ac9ba8243))
+
+
+### Chores
+
+* broadly detect json family of content-type headers ([eeaa507](https://github.com/replicate/replicate-python-stainless/commit/eeaa5071ed47e31264a268d9445fe8c0b8d059b1))
+* **ci:** only use depot for staging repos ([f7ec0b8](https://github.com/replicate/replicate-python-stainless/commit/f7ec0b8e11782aa89eee5f4af962158b665eee13))
+* **internal:** codegen related update ([fd43800](https://github.com/replicate/replicate-python-stainless/commit/fd43800c1da9a5c6ff06309a6c4a6a3808decff9))
+
## 0.1.0-alpha.5 (2025-04-24)
Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/replicate/replicate-python-stainless/compare/v0.1.0-alpha.4...v0.1.0-alpha.5)
diff --git a/README.md b/README.md
index 23b57ae..ba3cfc7 100644
--- a/README.md
+++ b/README.md
@@ -31,8 +31,8 @@ client = ReplicateClient(
bearer_token=os.environ.get("REPLICATE_API_TOKEN"), # This is the default and can be omitted
)
-accounts = client.accounts.list()
-print(accounts.type)
+account = client.account.get()
+print(account.type)
```
While you can provide a `bearer_token` keyword argument,
@@ -55,8 +55,8 @@ client = AsyncReplicateClient(
async def main() -> None:
- accounts = await client.accounts.list()
- print(accounts.type)
+ account = await client.account.get()
+ print(account.type)
asyncio.run(main())
@@ -152,7 +152,7 @@ from replicate import ReplicateClient
client = ReplicateClient()
try:
- client.accounts.list()
+ client.account.get()
except replicate.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -195,7 +195,7 @@ client = ReplicateClient(
)
# Or, configure per-request:
-client.with_options(max_retries=5).accounts.list()
+client.with_options(max_retries=5).account.get()
```
### Timeouts
@@ -218,7 +218,7 @@ client = ReplicateClient(
)
# Override per-request:
-client.with_options(timeout=5.0).accounts.list()
+client.with_options(timeout=5.0).account.get()
```
On timeout, an `APITimeoutError` is thrown.
@@ -259,10 +259,10 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from replicate import ReplicateClient
client = ReplicateClient()
-response = client.accounts.with_raw_response.list()
+response = client.account.with_raw_response.get()
print(response.headers.get('X-My-Header'))
-account = response.parse() # get the object that `accounts.list()` would have returned
+account = response.parse() # get the object that `account.get()` would have returned
print(account.type)
```
@@ -277,7 +277,7 @@ The above interface eagerly reads the full response body when you make the reque
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
```python
-with client.accounts.with_streaming_response.list() as response:
+with client.account.with_streaming_response.get() as response:
print(response.headers.get("X-My-Header"))
for line in response.iter_lines():
diff --git a/api.md b/api.md
index df97142..b223f02 100644
--- a/api.md
+++ b/api.md
@@ -44,17 +44,17 @@ Methods:
- client.hardware.list() -> HardwareListResponse
-# Accounts
+# Account
Types:
```python
-from replicate.types import AccountListResponse
+from replicate.types import AccountGetResponse
```
Methods:
-- client.accounts.list() -> AccountListResponse
+- client.account.get() -> AccountGetResponse
# Models
diff --git a/pyproject.toml b/pyproject.toml
index af88d90..bfcf284 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "replicate-stainless"
-version = "0.1.0-alpha.5"
+version = "0.1.0-alpha.6"
description = "The official Python library for the replicate-client API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/replicate/__init__.py b/src/replicate/__init__.py
index fa787bd..0815fe9 100644
--- a/src/replicate/__init__.py
+++ b/src/replicate/__init__.py
@@ -231,7 +231,7 @@ def _reset_client() -> None: # type: ignore[reportUnusedFunction]
from ._module_client import (
models as models,
- accounts as accounts,
+ account as account,
hardware as hardware,
webhooks as webhooks,
trainings as trainings,
diff --git a/src/replicate/_client.py b/src/replicate/_client.py
index 6afa0ec..5d2a69c 100644
--- a/src/replicate/_client.py
+++ b/src/replicate/_client.py
@@ -21,7 +21,7 @@
)
from ._utils import is_given, get_async_library
from ._version import __version__
-from .resources import accounts, hardware, trainings, collections, predictions
+from .resources import account, hardware, trainings, collections, predictions
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, ReplicateClientError
from ._base_client import (
@@ -49,7 +49,7 @@ class ReplicateClient(SyncAPIClient):
collections: collections.CollectionsResource
deployments: deployments.DeploymentsResource
hardware: hardware.HardwareResource
- accounts: accounts.AccountsResource
+ account: account.AccountResource
models: models.ModelsResource
predictions: predictions.PredictionsResource
trainings: trainings.TrainingsResource
@@ -114,7 +114,7 @@ def __init__(
self.collections = collections.CollectionsResource(self)
self.deployments = deployments.DeploymentsResource(self)
self.hardware = hardware.HardwareResource(self)
- self.accounts = accounts.AccountsResource(self)
+ self.account = account.AccountResource(self)
self.models = models.ModelsResource(self)
self.predictions = predictions.PredictionsResource(self)
self.trainings = trainings.TrainingsResource(self)
@@ -231,7 +231,7 @@ class AsyncReplicateClient(AsyncAPIClient):
collections: collections.AsyncCollectionsResource
deployments: deployments.AsyncDeploymentsResource
hardware: hardware.AsyncHardwareResource
- accounts: accounts.AsyncAccountsResource
+ account: account.AsyncAccountResource
models: models.AsyncModelsResource
predictions: predictions.AsyncPredictionsResource
trainings: trainings.AsyncTrainingsResource
@@ -296,7 +296,7 @@ def __init__(
self.collections = collections.AsyncCollectionsResource(self)
self.deployments = deployments.AsyncDeploymentsResource(self)
self.hardware = hardware.AsyncHardwareResource(self)
- self.accounts = accounts.AsyncAccountsResource(self)
+ self.account = account.AsyncAccountResource(self)
self.models = models.AsyncModelsResource(self)
self.predictions = predictions.AsyncPredictionsResource(self)
self.trainings = trainings.AsyncTrainingsResource(self)
@@ -414,7 +414,7 @@ def __init__(self, client: ReplicateClient) -> None:
self.collections = collections.CollectionsResourceWithRawResponse(client.collections)
self.deployments = deployments.DeploymentsResourceWithRawResponse(client.deployments)
self.hardware = hardware.HardwareResourceWithRawResponse(client.hardware)
- self.accounts = accounts.AccountsResourceWithRawResponse(client.accounts)
+ self.account = account.AccountResourceWithRawResponse(client.account)
self.models = models.ModelsResourceWithRawResponse(client.models)
self.predictions = predictions.PredictionsResourceWithRawResponse(client.predictions)
self.trainings = trainings.TrainingsResourceWithRawResponse(client.trainings)
@@ -426,7 +426,7 @@ def __init__(self, client: AsyncReplicateClient) -> None:
self.collections = collections.AsyncCollectionsResourceWithRawResponse(client.collections)
self.deployments = deployments.AsyncDeploymentsResourceWithRawResponse(client.deployments)
self.hardware = hardware.AsyncHardwareResourceWithRawResponse(client.hardware)
- self.accounts = accounts.AsyncAccountsResourceWithRawResponse(client.accounts)
+ self.account = account.AsyncAccountResourceWithRawResponse(client.account)
self.models = models.AsyncModelsResourceWithRawResponse(client.models)
self.predictions = predictions.AsyncPredictionsResourceWithRawResponse(client.predictions)
self.trainings = trainings.AsyncTrainingsResourceWithRawResponse(client.trainings)
@@ -438,7 +438,7 @@ def __init__(self, client: ReplicateClient) -> None:
self.collections = collections.CollectionsResourceWithStreamingResponse(client.collections)
self.deployments = deployments.DeploymentsResourceWithStreamingResponse(client.deployments)
self.hardware = hardware.HardwareResourceWithStreamingResponse(client.hardware)
- self.accounts = accounts.AccountsResourceWithStreamingResponse(client.accounts)
+ self.account = account.AccountResourceWithStreamingResponse(client.account)
self.models = models.ModelsResourceWithStreamingResponse(client.models)
self.predictions = predictions.PredictionsResourceWithStreamingResponse(client.predictions)
self.trainings = trainings.TrainingsResourceWithStreamingResponse(client.trainings)
@@ -450,7 +450,7 @@ def __init__(self, client: AsyncReplicateClient) -> None:
self.collections = collections.AsyncCollectionsResourceWithStreamingResponse(client.collections)
self.deployments = deployments.AsyncDeploymentsResourceWithStreamingResponse(client.deployments)
self.hardware = hardware.AsyncHardwareResourceWithStreamingResponse(client.hardware)
- self.accounts = accounts.AsyncAccountsResourceWithStreamingResponse(client.accounts)
+ self.account = account.AsyncAccountResourceWithStreamingResponse(client.account)
self.models = models.AsyncModelsResourceWithStreamingResponse(client.models)
self.predictions = predictions.AsyncPredictionsResourceWithStreamingResponse(client.predictions)
self.trainings = trainings.AsyncTrainingsResourceWithStreamingResponse(client.trainings)
diff --git a/src/replicate/_module_client.py b/src/replicate/_module_client.py
index 4e2ca08..7733870 100644
--- a/src/replicate/_module_client.py
+++ b/src/replicate/_module_client.py
@@ -12,16 +12,16 @@ def __load__(self) -> resources.ModelsResource:
return _load_client().models
-class HardwareResourceProxy(LazyProxy[resources.HardwareResource]):
+class AccountResourceProxy(LazyProxy[resources.AccountResource]):
@override
- def __load__(self) -> resources.HardwareResource:
- return _load_client().hardware
+ def __load__(self) -> resources.AccountResource:
+ return _load_client().account
-class AccountsResourceProxy(LazyProxy[resources.AccountsResource]):
+class HardwareResourceProxy(LazyProxy[resources.HardwareResource]):
@override
- def __load__(self) -> resources.AccountsResource:
- return _load_client().accounts
+ def __load__(self) -> resources.HardwareResource:
+ return _load_client().hardware
class WebhooksResourceProxy(LazyProxy[resources.WebhooksResource]):
@@ -55,8 +55,8 @@ def __load__(self) -> resources.PredictionsResource:
models: resources.ModelsResource = ModelsResourceProxy().__as_proxied__()
+account: resources.AccountResource = AccountResourceProxy().__as_proxied__()
hardware: resources.HardwareResource = HardwareResourceProxy().__as_proxied__()
-accounts: resources.AccountsResource = AccountsResourceProxy().__as_proxied__()
webhooks: resources.WebhooksResource = WebhooksResourceProxy().__as_proxied__()
trainings: resources.TrainingsResource = TrainingsResourceProxy().__as_proxied__()
collections: resources.CollectionsResource = CollectionsResourceProxy().__as_proxied__()
diff --git a/src/replicate/_response.py b/src/replicate/_response.py
index d6e7627..eb2ea3a 100644
--- a/src/replicate/_response.py
+++ b/src/replicate/_response.py
@@ -233,7 +233,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
# split is required to handle cases where additional information is included
# in the response, e.g. application/json; charset=utf-8
content_type, *_ = response.headers.get("content-type", "*").split(";")
- if content_type != "application/json":
+ if not content_type.endswith("json"):
if is_basemodel(cast_to):
try:
data = response.json()
diff --git a/src/replicate/_version.py b/src/replicate/_version.py
index 8343825..991a17e 100644
--- a/src/replicate/_version.py
+++ b/src/replicate/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "replicate"
-__version__ = "0.1.0-alpha.5" # x-release-please-version
+__version__ = "0.1.0-alpha.6" # x-release-please-version
diff --git a/src/replicate/resources/__init__.py b/src/replicate/resources/__init__.py
index 2f7006c..7982afa 100644
--- a/src/replicate/resources/__init__.py
+++ b/src/replicate/resources/__init__.py
@@ -8,13 +8,13 @@
ModelsResourceWithStreamingResponse,
AsyncModelsResourceWithStreamingResponse,
)
-from .accounts import (
- AccountsResource,
- AsyncAccountsResource,
- AccountsResourceWithRawResponse,
- AsyncAccountsResourceWithRawResponse,
- AccountsResourceWithStreamingResponse,
- AsyncAccountsResourceWithStreamingResponse,
+from .account import (
+ AccountResource,
+ AsyncAccountResource,
+ AccountResourceWithRawResponse,
+ AsyncAccountResourceWithRawResponse,
+ AccountResourceWithStreamingResponse,
+ AsyncAccountResourceWithStreamingResponse,
)
from .hardware import (
HardwareResource,
@@ -84,12 +84,12 @@
"AsyncHardwareResourceWithRawResponse",
"HardwareResourceWithStreamingResponse",
"AsyncHardwareResourceWithStreamingResponse",
- "AccountsResource",
- "AsyncAccountsResource",
- "AccountsResourceWithRawResponse",
- "AsyncAccountsResourceWithRawResponse",
- "AccountsResourceWithStreamingResponse",
- "AsyncAccountsResourceWithStreamingResponse",
+ "AccountResource",
+ "AsyncAccountResource",
+ "AccountResourceWithRawResponse",
+ "AsyncAccountResourceWithRawResponse",
+ "AccountResourceWithStreamingResponse",
+ "AsyncAccountResourceWithStreamingResponse",
"ModelsResource",
"AsyncModelsResource",
"ModelsResourceWithRawResponse",
diff --git a/src/replicate/resources/accounts.py b/src/replicate/resources/account.py
similarity index 70%
rename from src/replicate/resources/accounts.py
rename to src/replicate/resources/account.py
index 4846c22..304cc64 100644
--- a/src/replicate/resources/accounts.py
+++ b/src/replicate/resources/account.py
@@ -14,32 +14,32 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
-from ..types.account_list_response import AccountListResponse
+from ..types.account_get_response import AccountGetResponse
-__all__ = ["AccountsResource", "AsyncAccountsResource"]
+__all__ = ["AccountResource", "AsyncAccountResource"]
-class AccountsResource(SyncAPIResource):
+class AccountResource(SyncAPIResource):
@cached_property
- def with_raw_response(self) -> AccountsResourceWithRawResponse:
+ def with_raw_response(self) -> AccountResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/replicate/replicate-python-stainless#accessing-raw-response-data-eg-headers
"""
- return AccountsResourceWithRawResponse(self)
+ return AccountResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> AccountsResourceWithStreamingResponse:
+ def with_streaming_response(self) -> AccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/replicate/replicate-python-stainless#with_streaming_response
"""
- return AccountsResourceWithStreamingResponse(self)
+ return AccountResourceWithStreamingResponse(self)
- def list(
+ def get(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -48,7 +48,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountListResponse:
+ ) -> AccountGetResponse:
"""
Returns information about the user or organization associated with the provided
API token.
@@ -77,31 +77,31 @@ def list(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=AccountListResponse,
+ cast_to=AccountGetResponse,
)
-class AsyncAccountsResource(AsyncAPIResource):
+class AsyncAccountResource(AsyncAPIResource):
@cached_property
- def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse:
+ def with_raw_response(self) -> AsyncAccountResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.
For more information, see https://www.github.com/replicate/replicate-python-stainless#accessing-raw-response-data-eg-headers
"""
- return AsyncAccountsResourceWithRawResponse(self)
+ return AsyncAccountResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse:
+ def with_streaming_response(self) -> AsyncAccountResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
For more information, see https://www.github.com/replicate/replicate-python-stainless#with_streaming_response
"""
- return AsyncAccountsResourceWithStreamingResponse(self)
+ return AsyncAccountResourceWithStreamingResponse(self)
- async def list(
+ async def get(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -110,7 +110,7 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountListResponse:
+ ) -> AccountGetResponse:
"""
Returns information about the user or organization associated with the provided
API token.
@@ -139,41 +139,41 @@ async def list(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=AccountListResponse,
+ cast_to=AccountGetResponse,
)
-class AccountsResourceWithRawResponse:
- def __init__(self, accounts: AccountsResource) -> None:
- self._accounts = accounts
+class AccountResourceWithRawResponse:
+ def __init__(self, account: AccountResource) -> None:
+ self._account = account
- self.list = to_raw_response_wrapper(
- accounts.list,
+ self.get = to_raw_response_wrapper(
+ account.get,
)
-class AsyncAccountsResourceWithRawResponse:
- def __init__(self, accounts: AsyncAccountsResource) -> None:
- self._accounts = accounts
+class AsyncAccountResourceWithRawResponse:
+ def __init__(self, account: AsyncAccountResource) -> None:
+ self._account = account
- self.list = async_to_raw_response_wrapper(
- accounts.list,
+ self.get = async_to_raw_response_wrapper(
+ account.get,
)
-class AccountsResourceWithStreamingResponse:
- def __init__(self, accounts: AccountsResource) -> None:
- self._accounts = accounts
+class AccountResourceWithStreamingResponse:
+ def __init__(self, account: AccountResource) -> None:
+ self._account = account
- self.list = to_streamed_response_wrapper(
- accounts.list,
+ self.get = to_streamed_response_wrapper(
+ account.get,
)
-class AsyncAccountsResourceWithStreamingResponse:
- def __init__(self, accounts: AsyncAccountsResource) -> None:
- self._accounts = accounts
+class AsyncAccountResourceWithStreamingResponse:
+ def __init__(self, account: AsyncAccountResource) -> None:
+ self._account = account
- self.list = async_to_streamed_response_wrapper(
- accounts.list,
+ self.get = async_to_streamed_response_wrapper(
+ account.get,
)
diff --git a/src/replicate/types/__init__.py b/src/replicate/types/__init__.py
index 3fe2c03..a7c016f 100644
--- a/src/replicate/types/__init__.py
+++ b/src/replicate/types/__init__.py
@@ -6,7 +6,7 @@
from .prediction_output import PredictionOutput as PredictionOutput
from .model_create_params import ModelCreateParams as ModelCreateParams
from .model_list_response import ModelListResponse as ModelListResponse
-from .account_list_response import AccountListResponse as AccountListResponse
+from .account_get_response import AccountGetResponse as AccountGetResponse
from .training_get_response import TrainingGetResponse as TrainingGetResponse
from .hardware_list_response import HardwareListResponse as HardwareListResponse
from .prediction_list_params import PredictionListParams as PredictionListParams
diff --git a/src/replicate/types/account_list_response.py b/src/replicate/types/account_get_response.py
similarity index 88%
rename from src/replicate/types/account_list_response.py
rename to src/replicate/types/account_get_response.py
index 995ea14..bfbec2c 100644
--- a/src/replicate/types/account_list_response.py
+++ b/src/replicate/types/account_get_response.py
@@ -5,10 +5,10 @@
from .._models import BaseModel
-__all__ = ["AccountListResponse"]
+__all__ = ["AccountGetResponse"]
-class AccountListResponse(BaseModel):
+class AccountGetResponse(BaseModel):
type: Literal["organization", "user"]
"""The account type. Can be a user or an organization."""
diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_account.py
similarity index 52%
rename from tests/api_resources/test_accounts.py
rename to tests/api_resources/test_account.py
index 765d496..1039fbb 100644
--- a/tests/api_resources/test_accounts.py
+++ b/tests/api_resources/test_account.py
@@ -9,70 +9,70 @@
from replicate import ReplicateClient, AsyncReplicateClient
from tests.utils import assert_matches_type
-from replicate.types import AccountListResponse
+from replicate.types import AccountGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-class TestAccounts:
+class TestAccount:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@pytest.mark.skip()
@parametrize
- def test_method_list(self, client: ReplicateClient) -> None:
- account = client.accounts.list()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ def test_method_get(self, client: ReplicateClient) -> None:
+ account = client.account.get()
+ assert_matches_type(AccountGetResponse, account, path=["response"])
@pytest.mark.skip()
@parametrize
- def test_raw_response_list(self, client: ReplicateClient) -> None:
- response = client.accounts.with_raw_response.list()
+ def test_raw_response_get(self, client: ReplicateClient) -> None:
+ response = client.account.with_raw_response.get()
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ assert_matches_type(AccountGetResponse, account, path=["response"])
@pytest.mark.skip()
@parametrize
- def test_streaming_response_list(self, client: ReplicateClient) -> None:
- with client.accounts.with_streaming_response.list() as response:
+ def test_streaming_response_get(self, client: ReplicateClient) -> None:
+ with client.account.with_streaming_response.get() as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ assert_matches_type(AccountGetResponse, account, path=["response"])
assert cast(Any, response.is_closed) is True
-class TestAsyncAccounts:
+class TestAsyncAccount:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@pytest.mark.skip()
@parametrize
- async def test_method_list(self, async_client: AsyncReplicateClient) -> None:
- account = await async_client.accounts.list()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ async def test_method_get(self, async_client: AsyncReplicateClient) -> None:
+ account = await async_client.account.get()
+ assert_matches_type(AccountGetResponse, account, path=["response"])
@pytest.mark.skip()
@parametrize
- async def test_raw_response_list(self, async_client: AsyncReplicateClient) -> None:
- response = await async_client.accounts.with_raw_response.list()
+ async def test_raw_response_get(self, async_client: AsyncReplicateClient) -> None:
+ response = await async_client.account.with_raw_response.get()
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ assert_matches_type(AccountGetResponse, account, path=["response"])
@pytest.mark.skip()
@parametrize
- async def test_streaming_response_list(self, async_client: AsyncReplicateClient) -> None:
- async with async_client.accounts.with_streaming_response.list() as response:
+ async def test_streaming_response_get(self, async_client: AsyncReplicateClient) -> None:
+ async with async_client.account.with_streaming_response.get() as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountListResponse, account, path=["response"])
+ assert_matches_type(AccountGetResponse, account, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/test_client.py b/tests/test_client.py
index 279675f..129afa4 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -783,7 +783,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = client.accounts.with_raw_response.list()
+ response = client.account.with_raw_response.get()
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -807,7 +807,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = client.accounts.with_raw_response.list(extra_headers={"x-stainless-retry-count": Omit()})
+ response = client.account.with_raw_response.get(extra_headers={"x-stainless-retry-count": Omit()})
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@@ -830,7 +830,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = client.accounts.with_raw_response.list(extra_headers={"x-stainless-retry-count": "42"})
+ response = client.account.with_raw_response.get(extra_headers={"x-stainless-retry-count": "42"})
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
@@ -1574,7 +1574,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = await client.accounts.with_raw_response.list()
+ response = await client.account.with_raw_response.get()
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
@@ -1599,7 +1599,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = await client.accounts.with_raw_response.list(extra_headers={"x-stainless-retry-count": Omit()})
+ response = await client.account.with_raw_response.get(extra_headers={"x-stainless-retry-count": Omit()})
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
@@ -1623,7 +1623,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.get("/account").mock(side_effect=retry_handler)
- response = await client.accounts.with_raw_response.list(extra_headers={"x-stainless-retry-count": "42"})
+ response = await client.account.with_raw_response.get(extra_headers={"x-stainless-retry-count": "42"})
assert response.http_request.headers.get("x-stainless-retry-count") == "42"