Skip to content

Commit

Permalink
feat(kv)!: move analytics under existing namespace (#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stainless Bot committed Dec 4, 2024
1 parent 4823b68 commit 375bc8c
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 231 deletions.
28 changes: 13 additions & 15 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,19 @@ Methods:
- <code title="put /accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk">client.kv.namespaces.<a href="./src/cloudflare/resources/kv/namespaces/namespaces.py">bulk_update</a>(namespace_id, \*, account_id, \*\*<a href="src/cloudflare/types/kv/namespace_bulk_update_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespace_bulk_update_response.py">Optional[NamespaceBulkUpdateResponse]</a></code>
- <code title="get /accounts/{account_id}/storage/kv/namespaces/{namespace_id}">client.kv.namespaces.<a href="./src/cloudflare/resources/kv/namespaces/namespaces.py">get</a>(namespace_id, \*, account_id) -> <a href="./src/cloudflare/types/kv/namespace.py">Optional[Namespace]</a></code>

### Analytics

Types:

```python
from cloudflare.types.kv.namespaces import Components, Schema
```

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.kv.namespaces.analytics.<a href="./src/cloudflare/resources/kv/namespaces/analytics.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/analytics_list_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/schema.py">Optional[Schema]</a></code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.kv.namespaces.analytics.<a href="./src/cloudflare/resources/kv/namespaces/analytics.py">stored</a>(\*, account_id, \*\*<a href="src/cloudflare/types/kv/namespaces/analytics_stored_params.py">params</a>) -> <a href="./src/cloudflare/types/kv/namespaces/components.py">Optional[Components]</a></code>

### Keys

Types:
Expand Down Expand Up @@ -4167,21 +4180,6 @@ Methods:
- <code title="delete /accounts/{account_id}/rules/lists/{list_id}/items">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">delete</a>(list_id, \*, account_id) -> <a href="./src/cloudflare/types/rules/lists/item_delete_response.py">ItemDeleteResponse</a></code>
- <code title="get /accounts/{account_identifier}/rules/lists/{list_id}/items/{item_id}">client.rules.lists.items.<a href="./src/cloudflare/resources/rules/lists/items.py">get</a>(item_id, \*, account_identifier, list_id) -> <a href="./src/cloudflare/types/rules/lists/item_get_response.py">ItemGetResponse</a></code>

# Storage

## Analytics

Types:

```python
from cloudflare.types.storage import Components, Schema
```

Methods:

- <code title="get /accounts/{account_id}/storage/analytics">client.storage.analytics.<a href="./src/cloudflare/resources/storage/analytics.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/storage/analytics_list_params.py">params</a>) -> <a href="./src/cloudflare/types/storage/schema.py">Optional[Schema]</a></code>
- <code title="get /accounts/{account_id}/storage/analytics/stored">client.storage.analytics.<a href="./src/cloudflare/resources/storage/analytics.py">stored</a>(\*, account_id, \*\*<a href="src/cloudflare/types/storage/analytics_stored_params.py">params</a>) -> <a href="./src/cloudflare/types/storage/components.py">Optional[Components]</a></code>

# Stream

Types:
Expand Down
37 changes: 0 additions & 37 deletions src/cloudflare/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
billing,
filters,
logpush,
storage,
workers,
accounts,
alerting,
Expand Down Expand Up @@ -537,12 +536,6 @@ def rules(self) -> rules.RulesResource:

return RulesResource(self)

@cached_property
def storage(self) -> storage.StorageResource:
from .resources.storage import StorageResource

return StorageResource(self)

@cached_property
def stream(self) -> stream.StreamResource:
from .resources.stream import StreamResource
Expand Down Expand Up @@ -1296,12 +1289,6 @@ def rules(self) -> rules.AsyncRulesResource:

return AsyncRulesResource(self)

@cached_property
def storage(self) -> storage.AsyncStorageResource:
from .resources.storage import AsyncStorageResource

return AsyncStorageResource(self)

@cached_property
def stream(self) -> stream.AsyncStreamResource:
from .resources.stream import AsyncStreamResource
Expand Down Expand Up @@ -1988,12 +1975,6 @@ def rules(self) -> rules.RulesResourceWithRawResponse:

return RulesResourceWithRawResponse(self._client.rules)

@cached_property
def storage(self) -> storage.StorageResourceWithRawResponse:
from .resources.storage import StorageResourceWithRawResponse

return StorageResourceWithRawResponse(self._client.storage)

@cached_property
def stream(self) -> stream.StreamResourceWithRawResponse:
from .resources.stream import StreamResourceWithRawResponse
Expand Down Expand Up @@ -2501,12 +2482,6 @@ def rules(self) -> rules.AsyncRulesResourceWithRawResponse:

return AsyncRulesResourceWithRawResponse(self._client.rules)

@cached_property
def storage(self) -> storage.AsyncStorageResourceWithRawResponse:
from .resources.storage import AsyncStorageResourceWithRawResponse

return AsyncStorageResourceWithRawResponse(self._client.storage)

@cached_property
def stream(self) -> stream.AsyncStreamResourceWithRawResponse:
from .resources.stream import AsyncStreamResourceWithRawResponse
Expand Down Expand Up @@ -3014,12 +2989,6 @@ def rules(self) -> rules.RulesResourceWithStreamingResponse:

return RulesResourceWithStreamingResponse(self._client.rules)

@cached_property
def storage(self) -> storage.StorageResourceWithStreamingResponse:
from .resources.storage import StorageResourceWithStreamingResponse

return StorageResourceWithStreamingResponse(self._client.storage)

@cached_property
def stream(self) -> stream.StreamResourceWithStreamingResponse:
from .resources.stream import StreamResourceWithStreamingResponse
Expand Down Expand Up @@ -3531,12 +3500,6 @@ def rules(self) -> rules.AsyncRulesResourceWithStreamingResponse:

return AsyncRulesResourceWithStreamingResponse(self._client.rules)

@cached_property
def storage(self) -> storage.AsyncStorageResourceWithStreamingResponse:
from .resources.storage import AsyncStorageResourceWithStreamingResponse

return AsyncStorageResourceWithStreamingResponse(self._client.storage)

@cached_property
def stream(self) -> stream.AsyncStreamResourceWithStreamingResponse:
from .resources.stream import AsyncStreamResourceWithStreamingResponse
Expand Down
14 changes: 14 additions & 0 deletions src/cloudflare/resources/kv/namespaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
MetadataResourceWithStreamingResponse,
AsyncMetadataResourceWithStreamingResponse,
)
from .analytics import (
AnalyticsResource,
AsyncAnalyticsResource,
AnalyticsResourceWithRawResponse,
AsyncAnalyticsResourceWithRawResponse,
AnalyticsResourceWithStreamingResponse,
AsyncAnalyticsResourceWithStreamingResponse,
)
from .namespaces import (
NamespacesResource,
AsyncNamespacesResource,
Expand All @@ -34,6 +42,12 @@
)

__all__ = [
"AnalyticsResource",
"AsyncAnalyticsResource",
"AnalyticsResourceWithRawResponse",
"AsyncAnalyticsResourceWithRawResponse",
"AnalyticsResourceWithStreamingResponse",
"AsyncAnalyticsResourceWithStreamingResponse",
"KeysResource",
"AsyncKeysResource",
"KeysResourceWithRawResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._utils import (
maybe_transform,
async_maybe_transform,
)
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ..._base_client import make_request_options
from ...types.storage import analytics_list_params, analytics_stored_params
from ...types.storage.schema import Schema
from ...types.storage.components import Components
from ...._wrappers import ResultWrapper
from ...._base_client import make_request_options
from ....types.kv.namespaces import analytics_list_params, analytics_stored_params
from ....types.kv.namespaces.schema import Schema
from ....types.kv.namespaces.components import Components

__all__ = ["AnalyticsResource", "AsyncAnalyticsResource"]

Expand Down
32 changes: 32 additions & 0 deletions src/cloudflare/resources/kv/namespaces/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
maybe_transform,
async_maybe_transform,
)
from .analytics import (
AnalyticsResource,
AsyncAnalyticsResource,
AnalyticsResourceWithRawResponse,
AsyncAnalyticsResourceWithRawResponse,
AnalyticsResourceWithStreamingResponse,
AsyncAnalyticsResourceWithStreamingResponse,
)
from ...._compat import cached_property
from ....types.kv import (
namespace_list_params,
Expand Down Expand Up @@ -63,6 +71,10 @@


class NamespacesResource(SyncAPIResource):
@cached_property
def analytics(self) -> AnalyticsResource:
return AnalyticsResource(self._client)

@cached_property
def keys(self) -> KeysResource:
return KeysResource(self._client)
Expand Down Expand Up @@ -438,6 +450,10 @@ def get(


class AsyncNamespacesResource(AsyncAPIResource):
@cached_property
def analytics(self) -> AsyncAnalyticsResource:
return AsyncAnalyticsResource(self._client)

@cached_property
def keys(self) -> AsyncKeysResource:
return AsyncKeysResource(self._client)
Expand Down Expand Up @@ -838,6 +854,10 @@ def __init__(self, namespaces: NamespacesResource) -> None:
namespaces.get,
)

@cached_property
def analytics(self) -> AnalyticsResourceWithRawResponse:
return AnalyticsResourceWithRawResponse(self._namespaces.analytics)

@cached_property
def keys(self) -> KeysResourceWithRawResponse:
return KeysResourceWithRawResponse(self._namespaces.keys)
Expand Down Expand Up @@ -877,6 +897,10 @@ def __init__(self, namespaces: AsyncNamespacesResource) -> None:
namespaces.get,
)

@cached_property
def analytics(self) -> AsyncAnalyticsResourceWithRawResponse:
return AsyncAnalyticsResourceWithRawResponse(self._namespaces.analytics)

@cached_property
def keys(self) -> AsyncKeysResourceWithRawResponse:
return AsyncKeysResourceWithRawResponse(self._namespaces.keys)
Expand Down Expand Up @@ -916,6 +940,10 @@ def __init__(self, namespaces: NamespacesResource) -> None:
namespaces.get,
)

@cached_property
def analytics(self) -> AnalyticsResourceWithStreamingResponse:
return AnalyticsResourceWithStreamingResponse(self._namespaces.analytics)

@cached_property
def keys(self) -> KeysResourceWithStreamingResponse:
return KeysResourceWithStreamingResponse(self._namespaces.keys)
Expand Down Expand Up @@ -955,6 +983,10 @@ def __init__(self, namespaces: AsyncNamespacesResource) -> None:
namespaces.get,
)

@cached_property
def analytics(self) -> AsyncAnalyticsResourceWithStreamingResponse:
return AsyncAnalyticsResourceWithStreamingResponse(self._namespaces.analytics)

@cached_property
def keys(self) -> AsyncKeysResourceWithStreamingResponse:
return AsyncKeysResourceWithStreamingResponse(self._namespaces.keys)
Expand Down
33 changes: 0 additions & 33 deletions src/cloudflare/resources/storage/__init__.py

This file was deleted.

Loading

0 comments on commit 375bc8c

Please sign in to comment.