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.34.0"
".": "1.35.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-984af2e010ad1bf22f607ee96f27260ecf421c0ce5664839799b92eb349f9255.yml
openapi_spec_hash: bbd9dbdc1a4b7b0ad35aa08fba66e676
config_hash: 9d144cc6c49d3fd53e5b4472c1e22165
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-407f949d64421d5454ec0f4b518a19c14daa41312b6efa370eac631e495ca44a.yml
openapi_spec_hash: 7bcba0df8e8cb1c5a2d02efc3d6c0fa5
config_hash: 6e090a71f4d354167d93b4534a0e7f05
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.35.0 (2026-08-20)

Full Changelog: [v1.34.0...v1.35.0](https://github.com/moderation-api/sdk-python/compare/v1.34.0...v1.35.0)

### Features

* **api:** webhooks and stream ([4f4bf9f](https://github.com/moderation-api/sdk-python/commit/4f4bf9f2d1e2b6c5ddea270e16fd4d8f10600618))

## 1.34.0 (2026-08-14)

Full Changelog: [v1.33.0...v1.34.0](https://github.com/moderation-api/sdk-python/compare/v1.33.0...v1.34.0)
Expand Down
35 changes: 35 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ from moderation_api.types import ContentSubmitResponse

Methods:

- <code title="get /stream">client.content.<a href="./src/moderation_api/resources/content.py">stream</a>() -> None</code>
- <code title="post /moderate">client.content.<a href="./src/moderation_api/resources/content.py">submit</a>(\*\*<a href="src/moderation_api/types/content_submit_params.py">params</a>) -> <a href="./src/moderation_api/types/content_submit_response.py">ContentSubmitResponse</a></code>

# Account
Expand Down Expand Up @@ -151,3 +152,37 @@ Methods:

- <code title="post /wordlist/{id}/words">client.wordlist.words.<a href="./src/moderation_api/resources/wordlist/words.py">add</a>(id, \*\*<a href="src/moderation_api/types/wordlist/word_add_params.py">params</a>) -> <a href="./src/moderation_api/types/wordlist/word_add_response.py">WordAddResponse</a></code>
- <code title="delete /wordlist/{id}/words">client.wordlist.words.<a href="./src/moderation_api/resources/wordlist/words.py">remove</a>(id, \*\*<a href="src/moderation_api/types/wordlist/word_remove_params.py">params</a>) -> <a href="./src/moderation_api/types/wordlist/word_remove_response.py">WordRemoveResponse</a></code>

# Webhooks

Types:

```python
from moderation_api.types import (
WebhookCreateResponse,
WebhookRetrieveResponse,
WebhookUpdateResponse,
WebhookListResponse,
WebhookDeleteResponse,
)
```

Methods:

- <code title="post /webhooks">client.webhooks.<a href="./src/moderation_api/resources/webhooks.py">create</a>(\*\*<a href="src/moderation_api/types/webhook_create_params.py">params</a>) -> <a href="./src/moderation_api/types/webhook_create_response.py">WebhookCreateResponse</a></code>
- <code title="get /webhooks/{id}">client.webhooks.<a href="./src/moderation_api/resources/webhooks.py">retrieve</a>(id) -> <a href="./src/moderation_api/types/webhook_retrieve_response.py">WebhookRetrieveResponse</a></code>
- <code title="put /webhooks/{id}">client.webhooks.<a href="./src/moderation_api/resources/webhooks.py">update</a>(id, \*\*<a href="src/moderation_api/types/webhook_update_params.py">params</a>) -> <a href="./src/moderation_api/types/webhook_update_response.py">WebhookUpdateResponse</a></code>
- <code title="get /webhooks">client.webhooks.<a href="./src/moderation_api/resources/webhooks.py">list</a>() -> <a href="./src/moderation_api/types/webhook_list_response.py">WebhookListResponse</a></code>
- <code title="delete /webhooks/{id}">client.webhooks.<a href="./src/moderation_api/resources/webhooks.py">delete</a>(id) -> <a href="./src/moderation_api/types/webhook_delete_response.py">WebhookDeleteResponse</a></code>

# WebhookSecret

Types:

```python
from moderation_api.types import WebhookSecretRetrieveResponse
```

Methods:

- <code title="get /webhook-secret">client.webhook_secret.<a href="./src/moderation_api/resources/webhook_secret.py">retrieve</a>() -> <a href="./src/moderation_api/types/webhook_secret_retrieve_response.py">WebhookSecretRetrieveResponse</a></code>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "moderation_api"
version = "1.34.0"
version = "1.35.0"
description = "The official Python library for the moderation-api API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
86 changes: 83 additions & 3 deletions src/moderation_api/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@
)

if TYPE_CHECKING:
from .resources import auth, queue, account, actions, authors, content, wordlist
from .resources import auth, queue, account, actions, authors, content, webhooks, wordlist, webhook_secret
from .resources.auth import AuthResource, AsyncAuthResource
from .resources.account import AccountResource, AsyncAccountResource
from .resources.authors import AuthorsResource, AsyncAuthorsResource
from .resources.content import ContentResource, AsyncContentResource
from .resources.webhooks import WebhooksResource, AsyncWebhooksResource
from .resources.queue.queue import QueueResource, AsyncQueueResource
from .resources.webhook_secret import WebhookSecretResource, AsyncWebhookSecretResource
from .resources.actions.actions import ActionsResource, AsyncActionsResource
from .resources.wordlist.wordlist import WordlistResource, AsyncWordlistResource

Expand Down Expand Up @@ -97,6 +99,7 @@ def __init__(

if base_url is None:
base_url = os.environ.get("MODERATION_API_BASE_URL")
self._base_url_overridden = base_url is not None
if base_url is None:
base_url = f"https://api.moderationapi.com/v1"

Expand Down Expand Up @@ -162,6 +165,18 @@ def wordlist(self) -> WordlistResource:

return WordlistResource(self)

@cached_property
def webhooks(self) -> WebhooksResource:
from .resources.webhooks import WebhooksResource

return WebhooksResource(self)

@cached_property
def webhook_secret(self) -> WebhookSecretResource:
from .resources.webhook_secret import WebhookSecretResource

return WebhookSecretResource(self)

@cached_property
def with_raw_response(self) -> ModerationAPIWithRawResponse:
return ModerationAPIWithRawResponse(self)
Expand Down Expand Up @@ -226,7 +241,7 @@ def copy(
params = set_default_query

http_client = http_client or self._client
return self.__class__(
client = self.__class__(
secret_key=secret_key or self.secret_key,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand All @@ -236,6 +251,8 @@ def copy(
default_query=params,
**_extra_kwargs,
)
client._base_url_overridden = self._base_url_overridden or base_url is not None
return client

# Alias for `copy` for nicer inline usage, e.g.
# client.with_options(timeout=10).foo.create(...)
Expand Down Expand Up @@ -316,6 +333,7 @@ def __init__(

if base_url is None:
base_url = os.environ.get("MODERATION_API_BASE_URL")
self._base_url_overridden = base_url is not None
if base_url is None:
base_url = f"https://api.moderationapi.com/v1"

Expand Down Expand Up @@ -381,6 +399,18 @@ def wordlist(self) -> AsyncWordlistResource:

return AsyncWordlistResource(self)

@cached_property
def webhooks(self) -> AsyncWebhooksResource:
from .resources.webhooks import AsyncWebhooksResource

return AsyncWebhooksResource(self)

@cached_property
def webhook_secret(self) -> AsyncWebhookSecretResource:
from .resources.webhook_secret import AsyncWebhookSecretResource

return AsyncWebhookSecretResource(self)

@cached_property
def with_raw_response(self) -> AsyncModerationAPIWithRawResponse:
return AsyncModerationAPIWithRawResponse(self)
Expand Down Expand Up @@ -445,7 +475,7 @@ def copy(
params = set_default_query

http_client = http_client or self._client
return self.__class__(
client = self.__class__(
secret_key=secret_key or self.secret_key,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand All @@ -455,6 +485,8 @@ def copy(
default_query=params,
**_extra_kwargs,
)
client._base_url_overridden = self._base_url_overridden or base_url is not None
return client

# Alias for `copy` for nicer inline usage, e.g.
# client.with_options(timeout=10).foo.create(...)
Expand Down Expand Up @@ -542,6 +574,18 @@ def wordlist(self) -> wordlist.WordlistResourceWithRawResponse:

return WordlistResourceWithRawResponse(self._client.wordlist)

@cached_property
def webhooks(self) -> webhooks.WebhooksResourceWithRawResponse:
from .resources.webhooks import WebhooksResourceWithRawResponse

return WebhooksResourceWithRawResponse(self._client.webhooks)

@cached_property
def webhook_secret(self) -> webhook_secret.WebhookSecretResourceWithRawResponse:
from .resources.webhook_secret import WebhookSecretResourceWithRawResponse

return WebhookSecretResourceWithRawResponse(self._client.webhook_secret)


class AsyncModerationAPIWithRawResponse:
_client: AsyncModerationAPI
Expand Down Expand Up @@ -591,6 +635,18 @@ def wordlist(self) -> wordlist.AsyncWordlistResourceWithRawResponse:

return AsyncWordlistResourceWithRawResponse(self._client.wordlist)

@cached_property
def webhooks(self) -> webhooks.AsyncWebhooksResourceWithRawResponse:
from .resources.webhooks import AsyncWebhooksResourceWithRawResponse

return AsyncWebhooksResourceWithRawResponse(self._client.webhooks)

@cached_property
def webhook_secret(self) -> webhook_secret.AsyncWebhookSecretResourceWithRawResponse:
from .resources.webhook_secret import AsyncWebhookSecretResourceWithRawResponse

return AsyncWebhookSecretResourceWithRawResponse(self._client.webhook_secret)


class ModerationAPIWithStreamedResponse:
_client: ModerationAPI
Expand Down Expand Up @@ -640,6 +696,18 @@ def wordlist(self) -> wordlist.WordlistResourceWithStreamingResponse:

return WordlistResourceWithStreamingResponse(self._client.wordlist)

@cached_property
def webhooks(self) -> webhooks.WebhooksResourceWithStreamingResponse:
from .resources.webhooks import WebhooksResourceWithStreamingResponse

return WebhooksResourceWithStreamingResponse(self._client.webhooks)

@cached_property
def webhook_secret(self) -> webhook_secret.WebhookSecretResourceWithStreamingResponse:
from .resources.webhook_secret import WebhookSecretResourceWithStreamingResponse

return WebhookSecretResourceWithStreamingResponse(self._client.webhook_secret)


class AsyncModerationAPIWithStreamedResponse:
_client: AsyncModerationAPI
Expand Down Expand Up @@ -689,6 +757,18 @@ def wordlist(self) -> wordlist.AsyncWordlistResourceWithStreamingResponse:

return AsyncWordlistResourceWithStreamingResponse(self._client.wordlist)

@cached_property
def webhooks(self) -> webhooks.AsyncWebhooksResourceWithStreamingResponse:
from .resources.webhooks import AsyncWebhooksResourceWithStreamingResponse

return AsyncWebhooksResourceWithStreamingResponse(self._client.webhooks)

@cached_property
def webhook_secret(self) -> webhook_secret.AsyncWebhookSecretResourceWithStreamingResponse:
from .resources.webhook_secret import AsyncWebhookSecretResourceWithStreamingResponse

return AsyncWebhookSecretResourceWithStreamingResponse(self._client.webhook_secret)


Client = ModerationAPI

Expand Down
2 changes: 1 addition & 1 deletion src/moderation_api/_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__ = "moderation_api"
__version__ = "1.34.0" # x-release-please-version
__version__ = "1.35.0" # x-release-please-version
28 changes: 28 additions & 0 deletions src/moderation_api/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
ContentResourceWithStreamingResponse,
AsyncContentResourceWithStreamingResponse,
)
from .webhooks import (
WebhooksResource,
AsyncWebhooksResource,
WebhooksResourceWithRawResponse,
AsyncWebhooksResourceWithRawResponse,
WebhooksResourceWithStreamingResponse,
AsyncWebhooksResourceWithStreamingResponse,
)
from .wordlist import (
WordlistResource,
AsyncWordlistResource,
Expand All @@ -56,6 +64,14 @@
WordlistResourceWithStreamingResponse,
AsyncWordlistResourceWithStreamingResponse,
)
from .webhook_secret import (
WebhookSecretResource,
AsyncWebhookSecretResource,
WebhookSecretResourceWithRawResponse,
AsyncWebhookSecretResourceWithRawResponse,
WebhookSecretResourceWithStreamingResponse,
AsyncWebhookSecretResourceWithStreamingResponse,
)

__all__ = [
"AuthorsResource",
Expand Down Expand Up @@ -100,4 +116,16 @@
"AsyncWordlistResourceWithRawResponse",
"WordlistResourceWithStreamingResponse",
"AsyncWordlistResourceWithStreamingResponse",
"WebhooksResource",
"AsyncWebhooksResource",
"WebhooksResourceWithRawResponse",
"AsyncWebhooksResourceWithRawResponse",
"WebhooksResourceWithStreamingResponse",
"AsyncWebhooksResourceWithStreamingResponse",
"WebhookSecretResource",
"AsyncWebhookSecretResource",
"WebhookSecretResourceWithRawResponse",
"AsyncWebhookSecretResourceWithRawResponse",
"WebhookSecretResourceWithStreamingResponse",
"AsyncWebhookSecretResourceWithStreamingResponse",
]
Loading
Loading