diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 0000000..3522560 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to PyPI in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/moderation-api/sdk-python/actions/workflows/publish-pypi.yml +name: Publish PyPI +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Publish to PyPI + run: | + bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.MODERATION_API_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..2fa10d1 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,21 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'moderation-api/sdk-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.MODERATION_API_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..fea3454 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.0.0" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index e72d055..3bdc7d9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-b71e4bef3bf1d91ff75dc3414d212613e5be0efb29b773ff12363814491fc604.yml -openapi_spec_hash: 261c3af6614314fbdd6ea3f7fb61979a -config_hash: 3e15855f4c5098c08626c2728c6cbd88 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-3eaa6a0657e9f67ea196c65d3b604c71f5406108983981ec696642563fda0a93.yml +openapi_spec_hash: c417a44bb9fa62a02eca68bbb307c712 +config_hash: 6d4d59b89f68ea23dddfdefeee29c973 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9a6cd2a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +## 1.0.0 (2025-12-06) + +Full Changelog: [v0.0.1...v1.0.0](https://github.com/moderation-api/sdk-python/compare/v0.0.1...v1.0.0) + +### Features + +* **api:** api update ([bc91d96](https://github.com/moderation-api/sdk-python/commit/bc91d96e25700bf7c01fa62b7f22fa11880313dc)) +* **api:** api update ([a9968a7](https://github.com/moderation-api/sdk-python/commit/a9968a7a8e5ff58d2fd87633b4afff658523cf5a)) +* **api:** api update ([4823b5e](https://github.com/moderation-api/sdk-python/commit/4823b5e2fbd811e2f4eb08e3181d4674d03a59b3)) +* **api:** api update ([ad12a65](https://github.com/moderation-api/sdk-python/commit/ad12a65a09be5b7eaf14f770c1c4edb321db6640)) +* **api:** manual updates ([50ee715](https://github.com/moderation-api/sdk-python/commit/50ee7151e5ae1e22a2d8017e3f32a7816145a1ac)) +* **api:** manual updates ([c8e371a](https://github.com/moderation-api/sdk-python/commit/c8e371ae1be439008fbfb10cfe65d7798aef5eb6)) +* **api:** manual updates ([f017cbc](https://github.com/moderation-api/sdk-python/commit/f017cbcec45065e9e6a2f2bfa66cd1e5fa22b851)) +* **api:** manual updates ([c49725c](https://github.com/moderation-api/sdk-python/commit/c49725cb034edec7411733f2f63a688940573cac)) +* **api:** manual updates ([fa2efc8](https://github.com/moderation-api/sdk-python/commit/fa2efc8b09c8da26be5ec99c97f6ed11bdfc727b)) +* **api:** manual updates ([2957153](https://github.com/moderation-api/sdk-python/commit/29571536bb27811f9bd573829884bc36beb8a61b)) +* **api:** manual updates ([3ad868f](https://github.com/moderation-api/sdk-python/commit/3ad868f45c737db62e7486299e07027b608047d1)) +* **api:** manual updates ([75eae97](https://github.com/moderation-api/sdk-python/commit/75eae9712e59c4a7e8554f83f3ec2a4a55b10e46)) +* **api:** manual updates ([2ea195a](https://github.com/moderation-api/sdk-python/commit/2ea195a89e76808ba1957802a6394ea4bf20b039)) +* **api:** removed deprecated moderate endpoints ([6c5dd93](https://github.com/moderation-api/sdk-python/commit/6c5dd93fbe80619e6e4b270dfd4624b713ba9c15)) + + +### Bug Fixes + +* ensure streams are always closed ([b4d4449](https://github.com/moderation-api/sdk-python/commit/b4d44494343f4925353071967649a414c05ae369)) + + +### Chores + +* configure new SDK language ([74c5185](https://github.com/moderation-api/sdk-python/commit/74c5185ae751945b7b24839e406f7c371c8d0b34)) +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([bbf694f](https://github.com/moderation-api/sdk-python/commit/bbf694f626644c1349960516a152a46bd8af1489)) +* **docs:** use environment variables for authentication in code snippets ([166f1cf](https://github.com/moderation-api/sdk-python/commit/166f1cf82be98f8fe92607b3983144af07788da9)) +* update lockfile ([ba4d9b9](https://github.com/moderation-api/sdk-python/commit/ba4d9b97fdc0d4a6a34058edc9d0b8dde4c8d5ba)) +* update SDK settings ([60af1e1](https://github.com/moderation-api/sdk-python/commit/60af1e123350c2cbacd9f05320048539d28b2cc4)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c750efd..b392520 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```sh -$ pip install git+ssh://git@github.com/stainless-sdks/moderation-api-python.git +$ pip install git+ssh://git@github.com/moderation-api/sdk-python.git ``` Alternatively, you can build from source and install the wheel file: @@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/moderation-api-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/moderation-api/sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 3871753..41f56a6 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ The REST API documentation can be found on [docs.moderationapi.com](https://docs ## Installation ```sh -# install from this staging repo -pip install git+ssh://git@github.com/stainless-sdks/moderation-api-python.git +# install from the production repo +pip install git+ssh://git@github.com/moderation-api/sdk-python.git ``` > [!NOTE] @@ -85,8 +85,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv You can enable this by installing `aiohttp`: ```sh -# install from this staging repo -pip install 'moderation_api[aiohttp] @ git+ssh://git@github.com/stainless-sdks/moderation-api-python.git' +# install from the production repo +pip install 'moderation_api[aiohttp] @ git+ssh://git@github.com/moderation-api/sdk-python.git' ``` Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: @@ -290,9 +290,9 @@ content = response.parse() # get the object that `content.submit()` would have print(content.recommendation) ``` -These methods return an [`APIResponse`](https://github.com/stainless-sdks/moderation-api-python/tree/main/src/moderation_api/_response.py) object. +These methods return an [`APIResponse`](https://github.com/moderation-api/sdk-python/tree/main/src/moderation_api/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/moderation-api-python/tree/main/src/moderation_api/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/moderation-api/sdk-python/tree/main/src/moderation_api/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -401,7 +401,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/moderation-api-python/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/moderation-api/sdk-python/issues) with questions, bugs, or suggestions. ### Determining the installed version diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..b845b0f --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/pyproject.toml b/pyproject.toml index 07df82b..a2e4300 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "moderation_api" -version = "0.0.1" +version = "1.0.0" description = "The official Python library for the moderation-api API" dynamic = ["readme"] license = "Apache-2.0" @@ -37,8 +37,8 @@ classifiers = [ ] [project.urls] -Homepage = "https://github.com/stainless-sdks/moderation-api-python" -Repository = "https://github.com/stainless-sdks/moderation-api-python" +Homepage = "https://github.com/moderation-api/sdk-python" +Repository = "https://github.com/moderation-api/sdk-python" [project.optional-dependencies] aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] @@ -126,7 +126,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/stainless-sdks/moderation-api-python/tree/main/\g<2>)' +replacement = '[\1](https://github.com/moderation-api/sdk-python/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..e07cb3e --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "python", + "extra-files": [ + "src/moderation_api/_version.py" + ] +} \ No newline at end of file diff --git a/src/moderation_api/_version.py b/src/moderation_api/_version.py index 219facb..0766c88 100644 --- a/src/moderation_api/_version.py +++ b/src/moderation_api/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "moderation_api" -__version__ = "0.0.1" +__version__ = "1.0.0" # x-release-please-version diff --git a/src/moderation_api/resources/account.py b/src/moderation_api/resources/account.py index 75a8a64..17c9901 100644 --- a/src/moderation_api/resources/account.py +++ b/src/moderation_api/resources/account.py @@ -26,7 +26,7 @@ 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AccountResourceWithRawResponse(self) @@ -35,7 +35,7 @@ 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/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AccountResourceWithStreamingResponse(self) @@ -66,7 +66,7 @@ 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncAccountResourceWithRawResponse(self) @@ -75,7 +75,7 @@ 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/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncAccountResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/actions/actions.py b/src/moderation_api/resources/actions/actions.py index fb16b2c..791b94a 100644 --- a/src/moderation_api/resources/actions/actions.py +++ b/src/moderation_api/resources/actions/actions.py @@ -47,7 +47,7 @@ def with_raw_response(self) -> ActionsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return ActionsResourceWithRawResponse(self) @@ -56,7 +56,7 @@ def with_streaming_response(self) -> ActionsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return ActionsResourceWithStreamingResponse(self) @@ -384,7 +384,7 @@ def with_raw_response(self) -> AsyncActionsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncActionsResourceWithRawResponse(self) @@ -393,7 +393,7 @@ def with_streaming_response(self) -> AsyncActionsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncActionsResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/actions/execute.py b/src/moderation_api/resources/actions/execute.py index 7c74d53..cd27479 100644 --- a/src/moderation_api/resources/actions/execute.py +++ b/src/moderation_api/resources/actions/execute.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> ExecuteResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return ExecuteResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> ExecuteResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return ExecuteResourceWithStreamingResponse(self) @@ -168,7 +168,7 @@ def with_raw_response(self) -> AsyncExecuteResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncExecuteResourceWithRawResponse(self) @@ -177,7 +177,7 @@ def with_streaming_response(self) -> AsyncExecuteResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncExecuteResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/auth.py b/src/moderation_api/resources/auth.py index ac39a8b..81c37ce 100644 --- a/src/moderation_api/resources/auth.py +++ b/src/moderation_api/resources/auth.py @@ -29,7 +29,7 @@ def with_raw_response(self) -> AuthResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AuthResourceWithRawResponse(self) @@ -38,7 +38,7 @@ def with_streaming_response(self) -> AuthResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AuthResourceWithStreamingResponse(self) @@ -88,7 +88,7 @@ def with_raw_response(self) -> AsyncAuthResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncAuthResourceWithRawResponse(self) @@ -97,7 +97,7 @@ def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncAuthResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/authors.py b/src/moderation_api/resources/authors.py index 03f1ac4..a8a90f4 100644 --- a/src/moderation_api/resources/authors.py +++ b/src/moderation_api/resources/authors.py @@ -35,7 +35,7 @@ def with_raw_response(self) -> AuthorsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AuthorsResourceWithRawResponse(self) @@ -44,7 +44,7 @@ def with_streaming_response(self) -> AuthorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AuthorsResourceWithStreamingResponse(self) @@ -336,7 +336,7 @@ def with_raw_response(self) -> AsyncAuthorsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncAuthorsResourceWithRawResponse(self) @@ -345,7 +345,7 @@ def with_streaming_response(self) -> AsyncAuthorsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncAuthorsResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/content.py b/src/moderation_api/resources/content.py index 65462c6..50dc8b5 100644 --- a/src/moderation_api/resources/content.py +++ b/src/moderation_api/resources/content.py @@ -31,7 +31,7 @@ def with_raw_response(self) -> ContentResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return ContentResourceWithRawResponse(self) @@ -40,7 +40,7 @@ def with_streaming_response(self) -> ContentResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return ContentResourceWithStreamingResponse(self) @@ -83,8 +83,7 @@ def submit( meta_type: The meta type of content being moderated - policies: Optionally override the channel policies for this moderation request only - (enterprise). + policies: (Enterprise) override the channel policies for this moderation request only. extra_headers: Send extra headers @@ -124,7 +123,7 @@ def with_raw_response(self) -> AsyncContentResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncContentResourceWithRawResponse(self) @@ -133,7 +132,7 @@ def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncContentResourceWithStreamingResponse(self) @@ -176,8 +175,7 @@ async def submit( meta_type: The meta type of content being moderated - policies: Optionally override the channel policies for this moderation request only - (enterprise). + policies: (Enterprise) override the channel policies for this moderation request only. extra_headers: Send extra headers diff --git a/src/moderation_api/resources/queue/items.py b/src/moderation_api/resources/queue/items.py index 9a2f548..017a6fb 100644 --- a/src/moderation_api/resources/queue/items.py +++ b/src/moderation_api/resources/queue/items.py @@ -32,7 +32,7 @@ def with_raw_response(self) -> ItemsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return ItemsResourceWithRawResponse(self) @@ -41,7 +41,7 @@ def with_streaming_response(self) -> ItemsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return ItemsResourceWithStreamingResponse(self) @@ -212,7 +212,7 @@ def with_raw_response(self) -> AsyncItemsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncItemsResourceWithRawResponse(self) @@ -221,7 +221,7 @@ def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncItemsResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/queue/queue.py b/src/moderation_api/resources/queue/queue.py index 53778a5..cbf3a48 100644 --- a/src/moderation_api/resources/queue/queue.py +++ b/src/moderation_api/resources/queue/queue.py @@ -41,7 +41,7 @@ def with_raw_response(self) -> QueueResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return QueueResourceWithRawResponse(self) @@ -50,7 +50,7 @@ def with_streaming_response(self) -> QueueResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return QueueResourceWithStreamingResponse(self) @@ -144,7 +144,7 @@ def with_raw_response(self) -> AsyncQueueResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncQueueResourceWithRawResponse(self) @@ -153,7 +153,7 @@ def with_streaming_response(self) -> AsyncQueueResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncQueueResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/wordlist/wordlist.py b/src/moderation_api/resources/wordlist/wordlist.py index b09d8fa..7023e0c 100644 --- a/src/moderation_api/resources/wordlist/wordlist.py +++ b/src/moderation_api/resources/wordlist/wordlist.py @@ -43,7 +43,7 @@ def with_raw_response(self) -> WordlistResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return WordlistResourceWithRawResponse(self) @@ -52,7 +52,7 @@ def with_streaming_response(self) -> WordlistResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return WordlistResourceWithStreamingResponse(self) @@ -218,7 +218,7 @@ def with_raw_response(self) -> AsyncWordlistResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncWordlistResourceWithRawResponse(self) @@ -227,7 +227,7 @@ def with_streaming_response(self) -> AsyncWordlistResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncWordlistResourceWithStreamingResponse(self) diff --git a/src/moderation_api/resources/wordlist/words.py b/src/moderation_api/resources/wordlist/words.py index 6af0cb9..e400ffb 100644 --- a/src/moderation_api/resources/wordlist/words.py +++ b/src/moderation_api/resources/wordlist/words.py @@ -29,7 +29,7 @@ def with_raw_response(self) -> WordsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return WordsResourceWithRawResponse(self) @@ -38,7 +38,7 @@ def with_streaming_response(self) -> WordsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return WordsResourceWithStreamingResponse(self) @@ -131,7 +131,7 @@ def with_raw_response(self) -> AsyncWordsResourceWithRawResponse: 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/stainless-sdks/moderation-api-python#accessing-raw-response-data-eg-headers + For more information, see https://www.github.com/moderation-api/sdk-python#accessing-raw-response-data-eg-headers """ return AsyncWordsResourceWithRawResponse(self) @@ -140,7 +140,7 @@ def with_streaming_response(self) -> AsyncWordsResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. - For more information, see https://www.github.com/stainless-sdks/moderation-api-python#with_streaming_response + For more information, see https://www.github.com/moderation-api/sdk-python#with_streaming_response """ return AsyncWordsResourceWithStreamingResponse(self) diff --git a/src/moderation_api/types/content_submit_params.py b/src/moderation_api/types/content_submit_params.py index 4457bf5..80828f3 100644 --- a/src/moderation_api/types/content_submit_params.py +++ b/src/moderation_api/types/content_submit_params.py @@ -14,12 +14,12 @@ "ContentImage", "ContentVideo", "ContentAudio", - "ContentContentNode", - "ContentContentNodeData", - "ContentContentNodeDataText", - "ContentContentNodeDataImage", - "ContentContentNodeDataVideo", - "ContentContentNodeDataAudio", + "ContentObject", + "ContentObjectData", + "ContentObjectDataText", + "ContentObjectDataImage", + "ContentObjectDataVideo", + "ContentObjectDataAudio", "Policy", "PolicyToxicity", "PolicyPersonalInformation", @@ -81,10 +81,7 @@ class ContentSubmitParams(TypedDict, total=False): """The meta type of content being moderated""" policies: Iterable[Policy] - """ - Optionally override the channel policies for this moderation request only - (enterprise). - """ + """(Enterprise) override the channel policies for this moderation request only.""" class ContentText(TypedDict, total=False): @@ -115,47 +112,47 @@ class ContentAudio(TypedDict, total=False): """The URL of the audio content""" -class ContentContentNodeDataText(TypedDict, total=False): +class ContentObjectDataText(TypedDict, total=False): text: Required[str] """The content text""" type: Required[Literal["text"]] -class ContentContentNodeDataImage(TypedDict, total=False): +class ContentObjectDataImage(TypedDict, total=False): type: Required[Literal["image"]] url: Required[str] """A public URL of the image content""" -class ContentContentNodeDataVideo(TypedDict, total=False): +class ContentObjectDataVideo(TypedDict, total=False): type: Required[Literal["video"]] url: Required[str] """A public URL of the video content""" -class ContentContentNodeDataAudio(TypedDict, total=False): +class ContentObjectDataAudio(TypedDict, total=False): type: Required[Literal["audio"]] url: Required[str] """The URL of the audio content""" -ContentContentNodeData: TypeAlias = Union[ - ContentContentNodeDataText, ContentContentNodeDataImage, ContentContentNodeDataVideo, ContentContentNodeDataAudio +ContentObjectData: TypeAlias = Union[ + ContentObjectDataText, ContentObjectDataImage, ContentObjectDataVideo, ContentObjectDataAudio ] -class ContentContentNode(TypedDict, total=False): - data: Required[Dict[str, ContentContentNodeData]] +class ContentObject(TypedDict, total=False): + data: Required[Dict[str, ContentObjectData]] """Values in the object. Can be mixed content types.""" type: Required[Literal["object"]] -Content: TypeAlias = Union[ContentText, ContentImage, ContentVideo, ContentAudio, ContentContentNode] +Content: TypeAlias = Union[ContentText, ContentImage, ContentVideo, ContentAudio, ContentObject] class PolicyToxicity(TypedDict, total=False): diff --git a/src/moderation_api/types/content_submit_response.py b/src/moderation_api/types/content_submit_response.py index d42dfbf..a2e16fe 100644 --- a/src/moderation_api/types/content_submit_response.py +++ b/src/moderation_api/types/content_submit_response.py @@ -11,11 +11,11 @@ "AuthorBlock", "AuthorTrustLevel", "Content", - "ContentModifiedUnionMember1ContentModifiedUnionMember1Item", - "ContentModifiedUnionMember1ContentModifiedUnionMember1ItemText", - "ContentModifiedUnionMember1ContentModifiedUnionMember1ItemImage", - "ContentModifiedUnionMember1ContentModifiedUnionMember1ItemVideo", - "ContentModifiedUnionMember1ContentModifiedUnionMember1ItemAudio", + "ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem", + "ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText", + "ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage", + "ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo", + "ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio", "Evaluation", "Insight", "InsightSentimentInsight", @@ -63,39 +63,39 @@ class Author(BaseModel): """The author's ID from your system""" -class ContentModifiedUnionMember1ContentModifiedUnionMember1ItemText(BaseModel): +class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText(BaseModel): text: str """The content text""" type: Literal["text"] -class ContentModifiedUnionMember1ContentModifiedUnionMember1ItemImage(BaseModel): +class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage(BaseModel): type: Literal["image"] url: str """A public URL of the image content""" -class ContentModifiedUnionMember1ContentModifiedUnionMember1ItemVideo(BaseModel): +class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo(BaseModel): type: Literal["video"] url: str """A public URL of the video content""" -class ContentModifiedUnionMember1ContentModifiedUnionMember1ItemAudio(BaseModel): +class ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio(BaseModel): type: Literal["audio"] url: str """The URL of the audio content""" -ContentModifiedUnionMember1ContentModifiedUnionMember1Item: TypeAlias = Union[ - ContentModifiedUnionMember1ContentModifiedUnionMember1ItemText, - ContentModifiedUnionMember1ContentModifiedUnionMember1ItemImage, - ContentModifiedUnionMember1ContentModifiedUnionMember1ItemVideo, - ContentModifiedUnionMember1ContentModifiedUnionMember1ItemAudio, +ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem: TypeAlias = Union[ + ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemText, + ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemImage, + ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemVideo, + ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItemAudio, ] @@ -109,7 +109,12 @@ class Content(BaseModel): masked: bool """Whether any values have been masked.""" - modified: Union[str, Dict[str, ContentModifiedUnionMember1ContentModifiedUnionMember1Item], None] = None + modified: Union[ + str, + Dict[str, object], + Dict[str, ContentModifiedModifiedNestedObjectContentContentModifiedModifiedNestedObjectContentItem], + None, + ] = None """The modified content, if any."""