diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b2503e9..ac16f4f 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 9620bfba-8df9-4d0e-8796-8423b39f97f0 management: - docChecksum: d6bce8a263f0ec11d54bdf026957ba2f + docChecksum: 29c7bb10b9655dcfe925eacf9d5f4758 docVersion: 1.1.0 speakeasyVersion: internal generationVersion: internal - releaseVersion: 2.3.0 - configChecksum: 7d03dc7ad5513ecf24cd3879ea525e09 + releaseVersion: 2.4.0 + configChecksum: 3462f55ea591db361a8205c351e76575 repoURL: https://github.com/moderation-api/sdk-python installationURL: https://github.com/moderation-api/sdk-python.git published: true @@ -228,6 +228,10 @@ trackedFiles: last_write_checksum: sha1:f72533a66e9b9c50ee17bcde04ac8db58bb129d0 docs/models/deletewebhookresponse.md: last_write_checksum: sha1:9c274b660824d02e9fc18bab98ef18fd9027add1 + docs/models/deletewordlistrequest.md: + last_write_checksum: sha1:5939fbe361ccab24967ebd946e6f74e2749bf8a0 + docs/models/deletewordlistresponse.md: + last_write_checksum: sha1:3be4a556de9f7d3a0e60bd82593d0d9a60782d4f docs/models/drugs.md: last_write_checksum: sha1:7161f3ce2338c523d90d1556437b4fab5eb5ac8d docs/models/duplicatechannelrequest.md: @@ -523,7 +527,7 @@ trackedFiles: docs/models/queue.md: last_write_checksum: sha1:55d14bf277d370f30ebd0fca8e465c6cd63f21f8 docs/models/queueitem.md: - last_write_checksum: sha1:2b379154f8a8ce0497a58f0e6dc8eb9dcb7e9c85 + last_write_checksum: sha1:13b79624d38569780e2bc7e2567b594d3a06e580 docs/models/queueitemaudio.md: last_write_checksum: sha1:d531cb71cc9e6685f094a6934e80bf4043ac0c15 docs/models/queueitembrandimpersonation.md: @@ -577,15 +581,15 @@ trackedFiles: docs/models/removewordlistwordsresponse.md: last_write_checksum: sha1:5efef48f1d38df8e532615c71c4f05de2b0e28f8 docs/models/resolvequeueitemrequest.md: - last_write_checksum: sha1:ce5e4b9191848cac928a7e065d9389323916a892 + last_write_checksum: sha1:e5504f751485db76e8e67f06bcd7e3fddb2edb2a docs/models/resolvequeueitemresponse.md: last_write_checksum: sha1:6be4465672552b7deda68e1b60d4b503b1a90007 docs/models/resolvequeueitemsrequest.md: last_write_checksum: sha1:1ba6d46c01600c16c455ac44b0ee7912ae441f31 docs/models/resolvequeueitemsrequestbody.md: - last_write_checksum: sha1:d155b6e58e2a94d1239e4a3e3eb04eaa7b6c40eb + last_write_checksum: sha1:b12366427a2b048d338b57f9b910f91004c30f33 docs/models/resolvequeueitemsresponse.md: - last_write_checksum: sha1:90cc162d906a0f5f7f55f312fbf81adb1ecf16a1 + last_write_checksum: sha1:5985374f7ad21e774539d2b8b3e665c43e10e37d docs/models/respectinsight.md: last_write_checksum: sha1:4b28f5bb242fad6e0b615fff2c6845196b98f4f4 docs/models/reviewstats.md: @@ -687,9 +691,9 @@ trackedFiles: docs/models/unblockauthorresponse.md: last_write_checksum: sha1:d011cfdf60105b021cc8a5a07656c0f1b228d502 docs/models/unicodespoofing.md: - last_write_checksum: sha1:f226ab0193558bada5d79ae06526d468409f932e + last_write_checksum: sha1:ef143184ba5b0cf1c8f609407311ec114b139e99 docs/models/unresolvequeueitemrequest.md: - last_write_checksum: sha1:5806a111bde03f05d3868c104526e91118ecaa94 + last_write_checksum: sha1:3e740363d93566e4236402f44185200ecb57208d docs/models/unresolvequeueitemresponse.md: last_write_checksum: sha1:25712953fa620825ff2de945f02f73563e5d2389 docs/models/unresolvequeueitemstatus.md: @@ -793,7 +797,7 @@ trackedFiles: docs/sdks/feedback/README.md: last_write_checksum: sha1:ccbebb9f1e1102d390b4dbf114a5a4f783ef0abd docs/sdks/items/README.md: - last_write_checksum: sha1:ed06203e06e4abd51a3bbcb84865b67a11a9fde8 + last_write_checksum: sha1:4c64e26ecadb73cd169f85c1714c61ea4438658c docs/sdks/projects/README.md: last_write_checksum: sha1:a256679120b221c4cabb8026f7ccceaea7ca22c7 docs/sdks/queuesdk/README.md: @@ -803,7 +807,7 @@ trackedFiles: docs/sdks/webhooksecret/README.md: last_write_checksum: sha1:4d0b1dc7b8d78b321e15d45ec039a0786ae44c45 docs/sdks/wordlist/README.md: - last_write_checksum: sha1:785bdffde5f78c333a022a2fd3835c7a01481da7 + last_write_checksum: sha1:47d395924883d235164268fcd1e6f3cb6000d76e docs/sdks/words/README.md: last_write_checksum: sha1:6c81772f1cc8e8a8e09289b29f2bd7b5f1eeba9e py.typed: @@ -811,7 +815,7 @@ trackedFiles: pylintrc: last_write_checksum: sha1:cb40e5fd2885dcf20f7c572a590b2656efe282a0 pyproject.toml: - last_write_checksum: sha1:1e60e4220ba83b27bcc713c1decc4f8afa66a682 + last_write_checksum: sha1:fadd5a8ac4381f7750f27230154d98f05c882d0b scripts/prepare_readme.py: last_write_checksum: sha1:7b330dc0eb57c916a1158fd90c6227f8dc517c83 scripts/publish.sh: @@ -825,7 +829,7 @@ trackedFiles: src/moderation_api/_hooks/types.py: last_write_checksum: sha1:bb2a67c388c536a910bd205bd9582065c5d2de39 src/moderation_api/_version.py: - last_write_checksum: sha1:d6a55674cb763ada777bc63efed80be0caf384d9 + last_write_checksum: sha1:b90deef1c7258cbc0990026770e32d80dcfafa55 src/moderation_api/account.py: last_write_checksum: sha1:184d7da98d57398f23b83a572d3105e361ba430f src/moderation_api/actions.py: @@ -871,9 +875,9 @@ trackedFiles: src/moderation_api/httpclient.py: last_write_checksum: sha1:5e55338d6ee9f01ab648cad4380201a8a3da7dd7 src/moderation_api/items.py: - last_write_checksum: sha1:ea935d11d6bb0b939b051752b76a99101eae16d0 + last_write_checksum: sha1:97feeb2f9ecb3986e6bd01e5ebc2268b2c91e677 src/moderation_api/models/__init__.py: - last_write_checksum: sha1:ff7e6ce34a5955018fba5e858e24bca2d04891bb + last_write_checksum: sha1:d2459bf75c877925e2d6f31a5b6e30c60ea053c0 src/moderation_api/models/addwordlistwordsop.py: last_write_checksum: sha1:45d3dd92a286fa5b17f4eb79b5ed12062d019f4d src/moderation_api/models/allowcontentop.py: @@ -914,6 +918,8 @@ trackedFiles: last_write_checksum: sha1:2e84a7999f679a87ef393eb0c44805bd687d2e7d src/moderation_api/models/deletewebhookop.py: last_write_checksum: sha1:97c6f00957de3ac31a7a50533faa3040771622d6 + src/moderation_api/models/deletewordlistop.py: + last_write_checksum: sha1:93bceacf8a4f2ec0ba69d124a375fa2088e8adc4 src/moderation_api/models/duplicatechannelop.py: last_write_checksum: sha1:ac62e5fe7064a3b241935390d57002ed98bcc1e1 src/moderation_api/models/duplicateprojectop.py: @@ -991,7 +997,7 @@ trackedFiles: src/moderation_api/models/queue.py: last_write_checksum: sha1:bc6130277305f518ab00caa5fa59f70249ea344d src/moderation_api/models/queueitem.py: - last_write_checksum: sha1:2754d0a11bbf3966f987760232f03501b8c0a73b + last_write_checksum: sha1:eb43fa6a3c18c93c999b5f28ad4a6e6ba9bc1cba src/moderation_api/models/queuewithcounts.py: last_write_checksum: sha1:f0499600ece3ef0b74a2d4a73d20b665a32793b7 src/moderation_api/models/ratelimiterror.py: @@ -1001,19 +1007,19 @@ trackedFiles: src/moderation_api/models/removewordlistwordsop.py: last_write_checksum: sha1:7cb9e8a08223096df7ffece80ff363b0208a56fe src/moderation_api/models/resolvequeueitemop.py: - last_write_checksum: sha1:e5d5b47b99d1b32db9b1adffd09a7caa948dcea5 + last_write_checksum: sha1:ef4f85116a2e3b178a95f4c3fbac0d95b058dd60 src/moderation_api/models/resolvequeueitemsop.py: - last_write_checksum: sha1:10da89b43bc99f17c90f3873727079dee625d2d2 + last_write_checksum: sha1:28f5173ceedc97611d0a064f01e80c48721b2801 src/moderation_api/models/security.py: last_write_checksum: sha1:dc71db919301e2ed408358e7b2066a8cb30c581b src/moderation_api/models/submitcontentop.py: - last_write_checksum: sha1:c5ab5a0c1f431ef17bba685a3b70ce1a3434bb77 + last_write_checksum: sha1:5dca4a2b8914f97b98a97fc3094cc421b76ed7ca src/moderation_api/models/suspendauthorop.py: last_write_checksum: sha1:16ac1063324d990bb67359ec71ef772f5673db2c src/moderation_api/models/unblockauthorop.py: last_write_checksum: sha1:06364d4cb648bb8729583e07a789ace9b16af7fa src/moderation_api/models/unresolvequeueitemop.py: - last_write_checksum: sha1:90f2dd46899295dc1849fb3a31039b76cebc0c2c + last_write_checksum: sha1:05e3636521d1c4b22976d7e9ae7c124d621a81a0 src/moderation_api/models/updateactionop.py: last_write_checksum: sha1:bfd702ef0dbf1544fdd8aaeadca0887aaa108200 src/moderation_api/models/updateauthorop.py: @@ -1085,7 +1091,7 @@ trackedFiles: src/moderation_api/webhooksecret.py: last_write_checksum: sha1:df2b346a770a6c777b2fbab21d4c189c2c196d2f src/moderation_api/wordlist.py: - last_write_checksum: sha1:d4a0f12a41e2c00d0dfc69366ae4a6334fcdb62e + last_write_checksum: sha1:7213b67a709d2db6385fccd613e41979d4b3ffc2 src/moderation_api/words.py: last_write_checksum: sha1:27f34da4c40657bedee24f2b1d885811b4db0b58 examples: @@ -2137,4 +2143,18 @@ examples: application/json: {"type": "not_found_error", "code": "resource_not_found", "message": "Not found", "request_id": "h8fkz6kkzoa446ffve37atys", "doc_url": "https://confused-bell.org"} "429": application/json: {"type": "rate_limit_error", "code": "rate_limit_exceeded", "message": "Rate limit exceeded", "request_id": "h8fkz6kkzoa446ffve37atys", "doc_url": "https://nervous-partridge.org/"} + deleteWordlist: + speakeasy-default-delete-wordlist: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "", "deleted": true, "detachedChannelIds": ["", "", ""]} + "401": + application/json: {"type": "authentication_error", "code": "unauthorized", "message": "Authorization not provided", "request_id": "h8fkz6kkzoa446ffve37atys", "doc_url": "https://rotating-exterior.biz/"} + "404": + application/json: {"type": "not_found_error", "code": "resource_not_found", "message": "Not found", "request_id": "h8fkz6kkzoa446ffve37atys", "doc_url": "https://flickering-airmail.org/"} + "429": + application/json: {"type": "rate_limit_error", "code": "rate_limit_exceeded", "message": "Rate limit exceeded", "request_id": "h8fkz6kkzoa446ffve37atys", "doc_url": "https://decent-millet.biz"} examplesVersion: 1.0.2 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index b23df5b..b1588a0 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 2.3.0 + version: 2.4.0 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/openapi.json b/.speakeasy/openapi.json index 9a2cf7e..e6db07f 100644 --- a/.speakeasy/openapi.json +++ b/.speakeasy/openapi.json @@ -3033,7 +3033,7 @@ "get": { "operationId": "listQueueItems", "summary": "List queue items", - "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item.", + "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item.", "tags": [ "Review queues" ], @@ -3281,7 +3281,7 @@ "post": { "operationId": "resolveQueueItem", "summary": "Resolve a queue item", - "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`.", + "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`.", "tags": [ "Review queues" ], @@ -3306,10 +3306,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -3414,7 +3414,7 @@ "post": { "operationId": "resolveQueueItems", "summary": "Resolve queue items", - "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`.", + "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`.", "tags": [ "Review queues" ], @@ -3459,7 +3459,7 @@ "items": { "type": "string" }, - "description": "The item IDs to resolve. Up to 100." + "description": "The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." } }, "required": [ @@ -3492,7 +3492,7 @@ "items": { "type": "string" }, - "description": "Item IDs that do not exist in the project." + "description": "IDs from `itemIds` that match no item or content ID in the project." } }, "required": [ @@ -3571,7 +3571,7 @@ "post": { "operationId": "unresolveQueueItem", "summary": "Unresolve a queue item", - "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list.", + "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`.", "tags": [ "Review queues" ], @@ -3596,10 +3596,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -8622,6 +8622,116 @@ "readOnlyHint": false, "destructiveHint": true } + }, + "delete": { + "operationId": "deleteWordlist", + "summary": "Delete wordlist", + "description": "Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone.", + "tags": [ + "Wordlists" + ], + "security": [ + { + "Authorization": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "description": "ID of the wordlist to delete" + }, + "required": true, + "description": "ID of the wordlist to delete" + }, + { + "in": "header", + "name": "Project-Id", + "required": false, + "schema": { + "type": "string" + }, + "description": "The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.", + "x-speakeasy-name-override": "projectId" + } + ], + "responses": { + "200": { + "description": "Wordlist deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of the deleted wordlist" + }, + "deleted": { + "type": "boolean", + "description": "Whether the wordlist was deleted" + }, + "detachedChannelIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "IDs of the channels that used the wordlist. It was removed from them." + } + }, + "required": [ + "id", + "deleted", + "detachedChannelIds" + ], + "additionalProperties": false + } + } + } + }, + "401": { + "description": "Authorization not provided", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthenticationError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "429": { + "description": "Too many requests. Retry after the number of seconds in the `Retry-After` header.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RateLimitError" + } + } + } + } + }, + "x-speakeasy-group": "wordlist", + "x-speakeasy-name-override": "delete", + "x-speakeasy-mcp": { + "title": "Delete wordlist", + "scopes": [ + "destructive" + ], + "readOnlyHint": false, + "destructiveHint": true + } } }, "/wordlist/{id}/embedding-status": { @@ -10174,13 +10284,15 @@ "const": "unicode_spoofing" }, "signals": { - "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.", + "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.", "type": "object", "propertyNames": { "type": "string", "enum": [ "mixed_script", "confusable_word", + "hidden_lookalike", + "leetspeak", "invisible", "zalgo", "illegal", @@ -13528,11 +13640,11 @@ "properties": { "id": { "type": "string", - "description": "The item ID. Use it to resolve or unresolve the item in this queue." + "description": "The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue." }, "contentId": { "type": "string", - "description": "Your content ID, as you sent it to `POST /moderate`." + "description": "Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`." }, "content": { "anyOf": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3757ff2..a2de699 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 2.4.0 (2026-10-29) + +Full Changelog: [v2.3.0...v2.4.0](https://github.com/moderation-api/sdk-python/compare/v2.3.0...v2.4.0) + +### API changes + +- `POST /moderate`: added the new `hidden_lookalike` enum value to the request property `policies/items/oneOf[subschema #36: Unicode Spoofing]/signals/propertyNames/` +- `POST /moderate`: added the new `leetspeak` enum value to the request property `policies/items/oneOf[subschema #36: Unicode Spoofing]/signals/propertyNames/` +- `DELETE /wordlist/{id}`: endpoint added + ## 2.3.0 (2026-10-28) Full Changelog: [v2.2.0...v2.3.0](https://github.com/moderation-api/sdk-python/compare/v2.2.0...v2.3.0) diff --git a/README.md b/README.md index f5fc557..ef23215 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,7 @@ Create the organization client only where you manage projects and channels, for * [create](docs/sdks/wordlist/README.md#create) - Create wordlist * [retrieve](docs/sdks/wordlist/README.md#retrieve) - Get wordlist * [update](docs/sdks/wordlist/README.md#update) - Update wordlist +* [delete](docs/sdks/wordlist/README.md#delete) - Delete wordlist * [get_embedding_status](docs/sdks/wordlist/README.md#get_embedding_status) - Get embedding status #### [Wordlist.Words](docs/sdks/words/README.md) @@ -583,10 +584,10 @@ with ModerationAPI( **Inherit from [`ModerationAPIError`](./src/moderation_api/errors/moderationapierror.py)**: -* [`NotFoundError`](./src/moderation_api/errors/notfounderror.py): The resource does not exist or the key cannot see it. Status code `404`. Applicable to 44 of 58 methods.* -* [`PermissionDeniedError`](./src/moderation_api/errors/permissiondeniederror.py): The API key cannot do this, or the plan limit for this resource is reached. Status code `403`. Applicable to 36 of 58 methods.* -* [`InternalServerError`](./src/moderation_api/errors/internalservererror.py): Something went wrong on our side. Retry with backoff. Status code `500`. Applicable to 23 of 58 methods.* -* [`ConflictError`](./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 58 methods.* +* [`NotFoundError`](./src/moderation_api/errors/notfounderror.py): The resource does not exist or the key cannot see it. Status code `404`. Applicable to 45 of 59 methods.* +* [`PermissionDeniedError`](./src/moderation_api/errors/permissiondeniederror.py): The API key cannot do this, or the plan limit for this resource is reached. Status code `403`. Applicable to 36 of 59 methods.* +* [`InternalServerError`](./src/moderation_api/errors/internalservererror.py): Something went wrong on our side. Retry with backoff. Status code `500`. Applicable to 23 of 59 methods.* +* [`ConflictError`](./src/moderation_api/errors/conflicterror.py): The request conflicts with the current state of a resource. Status code `409`. Applicable to 2 of 59 methods.* * [`ResponseValidationError`](./src/moderation_api/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. diff --git a/docs/models/deletewordlistrequest.md b/docs/models/deletewordlistrequest.md new file mode 100644 index 0000000..718cd28 --- /dev/null +++ b/docs/models/deletewordlistrequest.md @@ -0,0 +1,9 @@ +# DeleteWordlistRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | ID of the wordlist to delete | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file diff --git a/docs/models/deletewordlistresponse.md b/docs/models/deletewordlistresponse.md new file mode 100644 index 0000000..b48720e --- /dev/null +++ b/docs/models/deletewordlistresponse.md @@ -0,0 +1,12 @@ +# DeleteWordlistResponse + +Wordlist deleted successfully + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | ID of the deleted wordlist | +| `deleted` | *bool* | :heavy_check_mark: | Whether the wordlist was deleted | +| `detached_channel_ids` | List[*str*] | :heavy_check_mark: | IDs of the channels that used the wordlist. It was removed from them. | \ No newline at end of file diff --git a/docs/models/queueitem.md b/docs/models/queueitem.md index efe0b62..7760c28 100644 --- a/docs/models/queueitem.md +++ b/docs/models/queueitem.md @@ -3,17 +3,17 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The item ID. Use it to resolve or unresolve the item in this queue. | -| `content_id` | *str* | :heavy_check_mark: | Your content ID, as you sent it to `POST /moderate`. | -| `content` | [Nullable[models.QueueItemContent]](../models/queueitemcontent.md) | :heavy_check_mark: | The submitted content. | -| `labels` | List[[models.Label](../models/label.md)] | :heavy_check_mark: | The moderation labels of the content. | -| `flagged` | *bool* | :heavy_check_mark: | Whether moderation flagged the content. | -| `severity` | *Nullable[float]* | :heavy_check_mark: | Severity score from 0 to 1, if available. | -| `status` | [models.QueueItemStatus](../models/queueitemstatus.md) | :heavy_check_mark: | `pending` waits for review. `resolved` is reviewed. | -| `timestamp` | *float* | :heavy_check_mark: | When the content was submitted, as Unix time in milliseconds. | -| `language` | *Nullable[str]* | :heavy_check_mark: | Detected ISO language code. | -| `conversation_id` | *Nullable[str]* | :heavy_check_mark: | Conversation ID, if any. | -| `author_id` | *Nullable[str]* | :heavy_check_mark: | Your author ID, if any. | -| `content_type` | *Nullable[str]* | :heavy_check_mark: | Content type, for example `message` or `profile`. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue. | +| `content_id` | *str* | :heavy_check_mark: | Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`. | +| `content` | [Nullable[models.QueueItemContent]](../models/queueitemcontent.md) | :heavy_check_mark: | The submitted content. | +| `labels` | List[[models.Label](../models/label.md)] | :heavy_check_mark: | The moderation labels of the content. | +| `flagged` | *bool* | :heavy_check_mark: | Whether moderation flagged the content. | +| `severity` | *Nullable[float]* | :heavy_check_mark: | Severity score from 0 to 1, if available. | +| `status` | [models.QueueItemStatus](../models/queueitemstatus.md) | :heavy_check_mark: | `pending` waits for review. `resolved` is reviewed. | +| `timestamp` | *float* | :heavy_check_mark: | When the content was submitted, as Unix time in milliseconds. | +| `language` | *Nullable[str]* | :heavy_check_mark: | Detected ISO language code. | +| `conversation_id` | *Nullable[str]* | :heavy_check_mark: | Conversation ID, if any. | +| `author_id` | *Nullable[str]* | :heavy_check_mark: | Your author ID, if any. | +| `content_type` | *Nullable[str]* | :heavy_check_mark: | Content type, for example `message` or `profile`. | \ No newline at end of file diff --git a/docs/models/resolvequeueitemrequest.md b/docs/models/resolvequeueitemrequest.md index 9f9e827..42e3912 100644 --- a/docs/models/resolvequeueitemrequest.md +++ b/docs/models/resolvequeueitemrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The queue ID. | -| `item_id` | *str* | :heavy_check_mark: | The item ID to resolve. | -| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The queue ID. | +| `item_id` | *str* | :heavy_check_mark: | The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file diff --git a/docs/models/resolvequeueitemsrequestbody.md b/docs/models/resolvequeueitemsrequestbody.md index 06a891f..549c2bb 100644 --- a/docs/models/resolvequeueitemsrequestbody.md +++ b/docs/models/resolvequeueitemsrequestbody.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `item_ids` | List[*str*] | :heavy_check_mark: | The item IDs to resolve. Up to 100. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `item_ids` | List[*str*] | :heavy_check_mark: | The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | \ No newline at end of file diff --git a/docs/models/resolvequeueitemsresponse.md b/docs/models/resolvequeueitemsresponse.md index 5ff2cdf..1a1d895 100644 --- a/docs/models/resolvequeueitemsresponse.md +++ b/docs/models/resolvequeueitemsresponse.md @@ -5,7 +5,7 @@ Successful response ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `resolved` | *int* | :heavy_check_mark: | Number of items resolved. | -| `not_found_ids` | List[*str*] | :heavy_check_mark: | Item IDs that do not exist in the project. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `resolved` | *int* | :heavy_check_mark: | Number of items resolved. | +| `not_found_ids` | List[*str*] | :heavy_check_mark: | IDs from `itemIds` that match no item or content ID in the project. | \ No newline at end of file diff --git a/docs/models/unicodespoofing.md b/docs/models/unicodespoofing.md index ca39e29..cdab1ae 100644 --- a/docs/models/unicodespoofing.md +++ b/docs/models/unicodespoofing.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `flag` | *bool* | :heavy_check_mark: | N/A | -| `threshold` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `id` | *Literal["unicode_spoofing"]* | :heavy_check_mark: | N/A | -| `signals` | Dict[str, [models.SignalsRequest](../models/signalsrequest.md)] | :heavy_minus_sign: | Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `flag` | *bool* | :heavy_check_mark: | N/A | +| `threshold` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `id` | *Literal["unicode_spoofing"]* | :heavy_check_mark: | N/A | +| `signals` | Dict[str, [models.SignalsRequest](../models/signalsrequest.md)] | :heavy_minus_sign: | Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled. | \ No newline at end of file diff --git a/docs/models/unresolvequeueitemrequest.md b/docs/models/unresolvequeueitemrequest.md index 3718421..01a3d64 100644 --- a/docs/models/unresolvequeueitemrequest.md +++ b/docs/models/unresolvequeueitemrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The queue ID. | -| `item_id` | *str* | :heavy_check_mark: | The item ID to unresolve. | -| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The queue ID. | +| `item_id` | *str* | :heavy_check_mark: | The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file diff --git a/docs/sdks/items/README.md b/docs/sdks/items/README.md index b4c4b8e..41d6ecf 100644 --- a/docs/sdks/items/README.md +++ b/docs/sdks/items/README.md @@ -11,7 +11,7 @@ ## list -List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item. +List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item. ### Example Usage @@ -70,7 +70,7 @@ with ModerationAPI( ## resolve -Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`. +Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`. ### Example Usage @@ -93,12 +93,12 @@ with ModerationAPI( ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The queue ID. | -| `item_id` | *str* | :heavy_check_mark: | The item ID to resolve. | -| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The queue ID. | +| `item_id` | *str* | :heavy_check_mark: | The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -117,7 +117,7 @@ with ModerationAPI( ## resolve_many -Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`. +Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`. ### Example Usage @@ -143,12 +143,12 @@ with ModerationAPI( ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The queue ID. | -| `item_ids` | List[*str*] | :heavy_check_mark: | The item IDs to resolve. Up to 100. | -| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The queue ID. | +| `item_ids` | List[*str*] | :heavy_check_mark: | The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -167,7 +167,7 @@ with ModerationAPI( ## unresolve -Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. +Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`. ### Example Usage @@ -190,12 +190,12 @@ with ModerationAPI( ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | The queue ID. | -| `item_id` | *str* | :heavy_check_mark: | The item ID to unresolve. | -| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The queue ID. | +| `item_id` | *str* | :heavy_check_mark: | The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/docs/sdks/wordlist/README.md b/docs/sdks/wordlist/README.md index 304ed41..3daa22d 100644 --- a/docs/sdks/wordlist/README.md +++ b/docs/sdks/wordlist/README.md @@ -8,6 +8,7 @@ * [create](#create) - Create wordlist * [retrieve](#retrieve) - Get wordlist * [update](#update) - Update wordlist +* [delete](#delete) - Delete wordlist * [get_embedding_status](#get_embedding_status) - Get embedding status ## list @@ -204,6 +205,50 @@ with ModerationAPI( | errors.RateLimitError | 429 | application/json | | errors.ModerationAPIDefaultError | 4XX, 5XX | \*/\* | +## delete + +Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone. + +### Example Usage + + +```python +from moderation_api import ModerationAPI +import os + + +with ModerationAPI( + secret_key=os.getenv("MODAPI_SECRET_KEY", ""), +) as ma_client: + + res = ma_client.wordlist.delete(id="") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | ID of the wordlist to delete | +| `project_id` | *Optional[str]* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.DeleteWordlistResponse](../../models/deletewordlistresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------- | -------------------------------- | -------------------------------- | +| errors.AuthenticationError | 401 | application/json | +| errors.NotFoundError | 404 | application/json | +| errors.RateLimitError | 429 | application/json | +| errors.ModerationAPIDefaultError | 4XX, 5XX | \*/\* | + ## get_embedding_status Get the current embedding progress status for a wordlist diff --git a/pyproject.toml b/pyproject.toml index 76e4b0f..4a73963 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "moderation_api" -version = "2.3.0" +version = "2.4.0" description = "The official Python library for the Moderation API" authors = [{ name = "Moderation API" },] readme = "README-PYPI.md" diff --git a/src/moderation_api/_version.py b/src/moderation_api/_version.py index 0b01af1..17e70ca 100644 --- a/src/moderation_api/_version.py +++ b/src/moderation_api/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "moderation_api" -__version__: str = "2.3.0" +__version__: str = "2.4.0" __openapi_doc_version__: str = "1.1.0" __gen_version__: str = "internal" -__user_agent__: str = "speakeasy-sdk/python 2.3.0 internal 1.1.0 moderation_api" +__user_agent__: str = "speakeasy-sdk/python 2.4.0 internal 1.1.0 moderation_api" try: if __package__ is not None: diff --git a/src/moderation_api/items.py b/src/moderation_api/items.py index 33abaa9..88f9b4c 100644 --- a/src/moderation_api/items.py +++ b/src/moderation_api/items.py @@ -33,7 +33,7 @@ def list( ) -> Optional[models.ListQueueItemsResponse]: r"""List queue items - List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item. + List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item. :param id: The queue ID. :param page: @@ -228,7 +228,7 @@ async def list_async( ) -> Optional[models.ListQueueItemsResponse]: r"""List queue items - List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item. + List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item. :param id: The queue ID. :param page: @@ -417,10 +417,10 @@ def resolve( ) -> models.ResolveQueueItemResponse: r"""Resolve a queue item - Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`. + Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`. :param id: The queue ID. - :param item_id: The item ID to resolve. + :param item_id: The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -537,10 +537,10 @@ async def resolve_async( ) -> models.ResolveQueueItemResponse: r"""Resolve a queue item - Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`. + Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`. :param id: The queue ID. - :param item_id: The item ID to resolve. + :param item_id: The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -657,10 +657,10 @@ def resolve_many( ) -> models.ResolveQueueItemsResponse: r"""Resolve queue items - Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`. + Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`. :param id: The queue ID. - :param item_ids: The item IDs to resolve. Up to 100. + :param item_ids: The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -782,10 +782,10 @@ async def resolve_many_async( ) -> models.ResolveQueueItemsResponse: r"""Resolve queue items - Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`. + Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`. :param id: The queue ID. - :param item_ids: The item IDs to resolve. Up to 100. + :param item_ids: The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -907,10 +907,10 @@ def unresolve( ) -> models.UnresolveQueueItemResponse: r"""Unresolve a queue item - Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. + Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`. :param id: The queue ID. - :param item_id: The item ID to unresolve. + :param item_id: The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method @@ -1027,10 +1027,10 @@ async def unresolve_async( ) -> models.UnresolveQueueItemResponse: r"""Unresolve a queue item - Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. + Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`. :param id: The queue ID. - :param item_id: The item ID to unresolve. + :param item_id: The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it. :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method diff --git a/src/moderation_api/models/__init__.py b/src/moderation_api/models/__init__.py index 468f695..79ddc66 100644 --- a/src/moderation_api/models/__init__.py +++ b/src/moderation_api/models/__init__.py @@ -138,6 +138,12 @@ DeleteWebhookResponse, DeleteWebhookResponseTypedDict, ) + from .deletewordlistop import ( + DeleteWordlistRequest, + DeleteWordlistRequestTypedDict, + DeleteWordlistResponse, + DeleteWordlistResponseTypedDict, + ) from .duplicatechannelop import ( DuplicateChannelRequest, DuplicateChannelRequestBody, @@ -903,6 +909,10 @@ "DeleteWebhookRequestTypedDict", "DeleteWebhookResponse", "DeleteWebhookResponseTypedDict", + "DeleteWordlistRequest", + "DeleteWordlistRequestTypedDict", + "DeleteWordlistResponse", + "DeleteWordlistResponseTypedDict", "Drugs", "DrugsTypedDict", "DuplicateChannelRequest", @@ -1502,6 +1512,10 @@ "DeleteWebhookRequestTypedDict": ".deletewebhookop", "DeleteWebhookResponse": ".deletewebhookop", "DeleteWebhookResponseTypedDict": ".deletewebhookop", + "DeleteWordlistRequest": ".deletewordlistop", + "DeleteWordlistRequestTypedDict": ".deletewordlistop", + "DeleteWordlistResponse": ".deletewordlistop", + "DeleteWordlistResponseTypedDict": ".deletewordlistop", "DuplicateChannelRequest": ".duplicatechannelop", "DuplicateChannelRequestBody": ".duplicatechannelop", "DuplicateChannelRequestBodyTypedDict": ".duplicatechannelop", diff --git a/src/moderation_api/models/deletewordlistop.py b/src/moderation_api/models/deletewordlistop.py new file mode 100644 index 0000000..de1363c --- /dev/null +++ b/src/moderation_api/models/deletewordlistop.py @@ -0,0 +1,78 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from moderation_api.types import BaseModel, UNSET_SENTINEL +from moderation_api.utils import FieldMetadata, HeaderMetadata, PathParamMetadata +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteWordlistRequestTypedDict(TypedDict): + id: str + r"""ID of the wordlist to delete""" + project_id: NotRequired[str] + r"""The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.""" + + +class DeleteWordlistRequest(BaseModel): + id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""ID of the wordlist to delete""" + + project_id: Annotated[ + Optional[str], + pydantic.Field(alias="Project-Id"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = None + r"""The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["projectId"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteWordlistResponseTypedDict(TypedDict): + r"""Wordlist deleted successfully""" + + id: str + r"""ID of the deleted wordlist""" + deleted: bool + r"""Whether the wordlist was deleted""" + detached_channel_ids: List[str] + r"""IDs of the channels that used the wordlist. It was removed from them.""" + + +class DeleteWordlistResponse(BaseModel): + r"""Wordlist deleted successfully""" + + id: str + r"""ID of the deleted wordlist""" + + deleted: bool + r"""Whether the wordlist was deleted""" + + detached_channel_ids: Annotated[ + List[str], pydantic.Field(alias="detachedChannelIds") + ] + r"""IDs of the channels that used the wordlist. It was removed from them.""" + + +try: + DeleteWordlistResponse.model_rebuild() +except NameError: + pass diff --git a/src/moderation_api/models/queueitem.py b/src/moderation_api/models/queueitem.py index beff052..dbbd880 100644 --- a/src/moderation_api/models/queueitem.py +++ b/src/moderation_api/models/queueitem.py @@ -525,9 +525,9 @@ def serialize_model(self, handler): class QueueItemTypedDict(TypedDict): id: str - r"""The item ID. Use it to resolve or unresolve the item in this queue.""" + r"""The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue.""" content_id: str - r"""Your content ID, as you sent it to `POST /moderate`.""" + r"""Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`.""" content: Nullable[QueueItemContentTypedDict] r"""The submitted content.""" labels: List[LabelTypedDict] @@ -552,10 +552,10 @@ class QueueItemTypedDict(TypedDict): class QueueItem(BaseModel): id: str - r"""The item ID. Use it to resolve or unresolve the item in this queue.""" + r"""The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue.""" content_id: Annotated[str, pydantic.Field(alias="contentId")] - r"""Your content ID, as you sent it to `POST /moderate`.""" + r"""Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`.""" content: Nullable[QueueItemContent] r"""The submitted content.""" diff --git a/src/moderation_api/models/resolvequeueitemop.py b/src/moderation_api/models/resolvequeueitemop.py index 57c2c18..519e02e 100644 --- a/src/moderation_api/models/resolvequeueitemop.py +++ b/src/moderation_api/models/resolvequeueitemop.py @@ -13,7 +13,7 @@ class ResolveQueueItemRequestTypedDict(TypedDict): id: str r"""The queue ID.""" item_id: str - r"""The item ID to resolve.""" + r"""The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" project_id: NotRequired[str] r"""The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.""" @@ -29,7 +29,7 @@ class ResolveQueueItemRequest(BaseModel): pydantic.Field(alias="itemId"), FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), ] - r"""The item ID to resolve.""" + r"""The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" project_id: Annotated[ Optional[str], diff --git a/src/moderation_api/models/resolvequeueitemsop.py b/src/moderation_api/models/resolvequeueitemsop.py index 4c57a30..6ee5b7e 100644 --- a/src/moderation_api/models/resolvequeueitemsop.py +++ b/src/moderation_api/models/resolvequeueitemsop.py @@ -16,12 +16,12 @@ class ResolveQueueItemsRequestBodyTypedDict(TypedDict): item_ids: List[str] - r"""The item IDs to resolve. Up to 100.""" + r"""The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" class ResolveQueueItemsRequestBody(BaseModel): item_ids: Annotated[List[str], pydantic.Field(alias="itemIds")] - r"""The item IDs to resolve. Up to 100.""" + r"""The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" class ResolveQueueItemsRequestTypedDict(TypedDict): @@ -73,7 +73,7 @@ class ResolveQueueItemsResponseTypedDict(TypedDict): resolved: int r"""Number of items resolved.""" not_found_ids: List[str] - r"""Item IDs that do not exist in the project.""" + r"""IDs from `itemIds` that match no item or content ID in the project.""" class ResolveQueueItemsResponse(BaseModel): @@ -83,7 +83,7 @@ class ResolveQueueItemsResponse(BaseModel): r"""Number of items resolved.""" not_found_ids: Annotated[List[str], pydantic.Field(alias="notFoundIds")] - r"""Item IDs that do not exist in the project.""" + r"""IDs from `itemIds` that match no item or content ID in the project.""" try: diff --git a/src/moderation_api/models/submitcontentop.py b/src/moderation_api/models/submitcontentop.py index f23b480..972c6c3 100644 --- a/src/moderation_api/models/submitcontentop.py +++ b/src/moderation_api/models/submitcontentop.py @@ -612,7 +612,7 @@ class UnicodeSpoofingTypedDict(TypedDict): threshold: NotRequired[float] id: Literal["unicode_spoofing"] signals: NotRequired[Dict[str, SignalsRequestTypedDict]] - r"""Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.""" + r"""Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.""" class UnicodeSpoofing(BaseModel): @@ -629,7 +629,7 @@ class UnicodeSpoofing(BaseModel): ] = "unicode_spoofing" signals: Optional[Dict[str, SignalsRequest]] = None - r"""Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.""" + r"""Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/moderation_api/models/unresolvequeueitemop.py b/src/moderation_api/models/unresolvequeueitemop.py index c0ddc90..db8bb47 100644 --- a/src/moderation_api/models/unresolvequeueitemop.py +++ b/src/moderation_api/models/unresolvequeueitemop.py @@ -13,7 +13,7 @@ class UnresolveQueueItemRequestTypedDict(TypedDict): id: str r"""The queue ID.""" item_id: str - r"""The item ID to unresolve.""" + r"""The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" project_id: NotRequired[str] r"""The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.""" @@ -29,7 +29,7 @@ class UnresolveQueueItemRequest(BaseModel): pydantic.Field(alias="itemId"), FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), ] - r"""The item ID to unresolve.""" + r"""The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it.""" project_id: Annotated[ Optional[str], diff --git a/src/moderation_api/wordlist.py b/src/moderation_api/wordlist.py index 17e776b..4946b4f 100644 --- a/src/moderation_api/wordlist.py +++ b/src/moderation_api/wordlist.py @@ -1084,6 +1084,216 @@ async def update_async( raise errors.ModerationAPIDefaultError("Unexpected response received", http_res) + def delete( + self, + *, + id: str, + project_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteWordlistResponse: + r"""Delete wordlist + + Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone. + + :param id: ID of the wordlist to delete + :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeleteWordlistRequest( + id=id, + project_id=project_id, + ) + + req = self._build_request( + method="DELETE", + path="/wordlist/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteWordlist", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["Wordlists"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteWordlistResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.AuthenticationErrorData, http_res + ) + raise errors.AuthenticationError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response(errors.NotFoundErrorData, http_res) + raise errors.NotFoundError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response(errors.RateLimitErrorData, http_res) + raise errors.RateLimitError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.ModerationAPIDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.ModerationAPIDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.ModerationAPIDefaultError("Unexpected response received", http_res) + + async def delete_async( + self, + *, + id: str, + project_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteWordlistResponse: + r"""Delete wordlist + + Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone. + + :param id: ID of the wordlist to delete + :param project_id: The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.DeleteWordlistRequest( + id=id, + project_id=project_id, + ) + + req = self._build_request_async( + method="DELETE", + path="/wordlist/{id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="deleteWordlist", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["Wordlists"], + extensions=None, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteWordlistResponse, http_res) + if utils.match_response(http_res, "401", "application/json"): + response_data = unmarshal_json_response( + errors.AuthenticationErrorData, http_res + ) + raise errors.AuthenticationError(response_data, http_res) + if utils.match_response(http_res, "404", "application/json"): + response_data = unmarshal_json_response(errors.NotFoundErrorData, http_res) + raise errors.NotFoundError(response_data, http_res) + if utils.match_response(http_res, "429", "application/json"): + response_data = unmarshal_json_response(errors.RateLimitErrorData, http_res) + raise errors.RateLimitError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.ModerationAPIDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.ModerationAPIDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.ModerationAPIDefaultError("Unexpected response received", http_res) + def get_embedding_status( self, *,