From fb8df06ae671eca5609061ff8184685b3f269b77 Mon Sep 17 00:00:00 2001 From: chrisdengso <8185683+chrisdengso@users.noreply.github.com> Date: Thu, 12 Nov 2026 18:55:12 +0000 Subject: [PATCH] feat: v2.4.0, API changes --- .speakeasy/gen.lock | 74 ++-- .speakeasy/gen.yaml | 2 +- .speakeasy/openapi.json | 326 +++++++++++++----- CHANGELOG.md | 11 + README.md | 9 +- docs/models/deletewordlistrequest.md | 9 + docs/models/deletewordlistresponse.md | 12 + docs/models/queueitem.md | 28 +- docs/models/resolvequeueitemrequest.md | 10 +- docs/models/resolvequeueitemsrequestbody.md | 6 +- docs/models/resolvequeueitemsresponse.md | 8 +- docs/models/sort.md | 1 + docs/models/unicodespoofing.md | 12 +- docs/models/unresolvequeueitemrequest.md | 10 +- docs/sdks/actions/README.md | 10 +- docs/sdks/contentsdk/README.md | 2 +- docs/sdks/items/README.md | 44 +-- docs/sdks/wordlist/README.md | 45 +++ pyproject.toml | 2 +- src/moderation_api/_version.py | 4 +- src/moderation_api/actions.py | 20 +- src/moderation_api/content_sdk.py | 4 + src/moderation_api/items.py | 28 +- src/moderation_api/models/__init__.py | 14 + src/moderation_api/models/deletewordlistop.py | 78 +++++ src/moderation_api/models/listqueueitemsop.py | 1 + src/moderation_api/models/queueitem.py | 8 +- .../models/resolvequeueitemop.py | 4 +- .../models/resolvequeueitemsop.py | 8 +- src/moderation_api/models/submitcontentop.py | 4 +- .../models/unresolvequeueitemop.py | 4 +- src/moderation_api/wordlist.py | 210 +++++++++++ 32 files changed, 793 insertions(+), 215 deletions(-) create mode 100644 docs/models/deletewordlistrequest.md create mode 100644 docs/models/deletewordlistresponse.md create mode 100644 src/moderation_api/models/deletewordlistop.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b2503e9..e511a4a 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: d1c7a760d4c00f34fad01646ab23b9eb 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: @@ -615,7 +619,7 @@ trackedFiles: docs/models/signalsresponse.md: last_write_checksum: sha1:328f5e9dbbfa3c89008ee8e529c0dc32988aa39f docs/models/sort.md: - last_write_checksum: sha1:37123a81430b8f146ca6674ed624b198942a153e + last_write_checksum: sha1:171465f040c009d9c0f7439ca3ae1fe54016685f docs/models/sortby.md: last_write_checksum: sha1:565d7b37a09c9e022505f2666e9e41b40a1a33e8 docs/models/sortdirection.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: @@ -779,7 +783,7 @@ trackedFiles: docs/sdks/account/README.md: last_write_checksum: sha1:c32364abb6cabbbee7f5bf82fe310cacd7413f8e docs/sdks/actions/README.md: - last_write_checksum: sha1:89df32db9f98a933b1b656125c592b7100bb5b53 + last_write_checksum: sha1:3134e4f08a8b03c09dce121816bcc959cefa5dc8 docs/sdks/analytics/README.md: last_write_checksum: sha1:b9e0da42f3bf64aae7181769cd178a301b735833 docs/sdks/apikeys/README.md: @@ -789,11 +793,11 @@ trackedFiles: docs/sdks/channels/README.md: last_write_checksum: sha1:01c0e51bc630e4f5cb937e39faf535e894547fd3 docs/sdks/contentsdk/README.md: - last_write_checksum: sha1:620ee485059acf28c3f0aa6494465e677bcd220f + last_write_checksum: sha1:964adc45b962e7489f79544a448c058fda0cb6ad 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,11 +829,11 @@ 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: - last_write_checksum: sha1:bd53c19de12cb21c3df0b14d054516a02ce75107 + last_write_checksum: sha1:37e9e9f0707bce84649e40664987d9454243b108 src/moderation_api/analytics.py: last_write_checksum: sha1:e943d3f3a63389f916542a9149ae9b199ac77aaa src/moderation_api/apikeys.py: @@ -841,7 +845,7 @@ trackedFiles: src/moderation_api/channels.py: last_write_checksum: sha1:427f7ba3e717e4cdadbff8bca70a602c9a2a9c81 src/moderation_api/content_sdk.py: - last_write_checksum: sha1:248ea437a26352455ced96ea4d7d532da3634a51 + last_write_checksum: sha1:99c58e596099cc09d8a9140d5780bd22187dea84 src/moderation_api/errors/__init__.py: last_write_checksum: sha1:043e566785713d1aee1f2709cf3083cb51df01f6 src/moderation_api/errors/authenticationerror.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: @@ -967,7 +973,7 @@ trackedFiles: src/moderation_api/models/listprojectsop.py: last_write_checksum: sha1:71cf5c9825f4f7e2a6aa31149946079f7a45cb08 src/moderation_api/models/listqueueitemsop.py: - last_write_checksum: sha1:cc74c8240e44b2363dbd1f4ab68de65427d299a8 + last_write_checksum: sha1:e076efa5ce455595cc0443b2459bd7cdd9f5aa1f src/moderation_api/models/listqueuesop.py: last_write_checksum: sha1:6f7bc390cb6fb073f89251c87ef5f3f1414d7706 src/moderation_api/models/listwebhooksop.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..81ffb54 100644 --- a/.speakeasy/openapi.json +++ b/.speakeasy/openapi.json @@ -394,7 +394,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -591,7 +592,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -790,7 +792,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -972,7 +975,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -1179,7 +1183,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -1433,7 +1438,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -1624,7 +1630,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -1874,7 +1881,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -1993,7 +2001,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { @@ -2234,7 +2243,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } }, "delete": { @@ -2360,7 +2370,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -2510,7 +2521,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -2658,7 +2670,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -2805,7 +2818,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -3025,7 +3039,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -3033,7 +3048,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" ], @@ -3084,7 +3099,8 @@ "FIFO", "LIFO", "RANDOM", - "SEVERITY_DESC" + "SEVERITY_DESC", + "ROBOCALL_DESC" ] } }, @@ -3254,7 +3270,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -3281,7 +3298,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 +3323,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", @@ -3406,7 +3423,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -3414,7 +3432,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 +3477,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 +3510,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": [ @@ -3563,7 +3581,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -3571,7 +3590,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 +3615,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", @@ -3705,7 +3724,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -3713,7 +3733,7 @@ "get": { "operationId": "listActions", "summary": "List moderation actions", - "description": "List the moderation actions of the project. The list is paginated.", + "description": "List the moderation actions of the project, with their webhooks. An action is a decision that a reviewer or a rule can take on content or an author. Built-in actions (for example reject an item or block an author) change the item or author in Moderation API. Custom actions record the decision and send it to the webhooks of the action, where the customer platform acts on it. The list is paginated.", "tags": [ "Actions" ], @@ -3988,7 +4008,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -4013,7 +4034,7 @@ "post": { "operationId": "createAction", "summary": "Create an action", - "description": "Create an action.", + "description": "Create an action that reviewers and rules can take. `type` sets what it does: a built-in type changes the item or author in Moderation API, and a custom type (`ITEM_CUSTOM`, `AUTHOR_CUSTOM`) only records the decision for the webhooks to deliver. Creating an action does not execute it.", "tags": [ "Actions" ], @@ -4347,7 +4368,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -4355,7 +4377,7 @@ "get": { "operationId": "getAction", "summary": "Get an action", - "description": "Get an action by ID.", + "description": "Get an action by ID: its type, where it shows in the review queues, the values it takes and its webhooks.", "tags": [ "Actions" ], @@ -4574,13 +4596,14 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { "operationId": "updateAction", "summary": "Update an action", - "description": "Update an action.", + "description": "Update the settings of an action: its name, type, queues and values. The new settings apply the next time the action is executed. Updating an action does not execute it.", "tags": [ "Actions" ], @@ -4925,7 +4948,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } }, "delete": { @@ -5037,7 +5061,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -5045,7 +5070,7 @@ "post": { "operationId": "executeAction", "summary": "Execute moderation action", - "description": "Execute a moderation action on one or more content items.", + "description": "Execute one action of the project, by ID or key, on content items or authors. A built-in action changes them in Moderation API (for example rejects the items or blocks the authors). Every executed action is recorded, and the project sends it to the webhooks of the action and to its other webhook endpoints, where the customer platform can act on it. List the actions first to see what each one does.", "tags": [ "Actions" ], @@ -5198,7 +5223,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": true } } }, @@ -5206,7 +5232,7 @@ "post": { "operationId": "executeActionById", "summary": "Execute an action", - "description": "Execute an action on a set of content items in a queue.", + "description": "Execute an action on a set of content items in a queue. The project sends the result to the webhooks of the action. Use `POST /actions/execute` instead.", "tags": [ "Actions" ], @@ -5487,7 +5513,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": true } } }, @@ -5625,7 +5652,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -5751,7 +5779,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": true } } }, @@ -5886,7 +5915,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": true } } }, @@ -6012,7 +6042,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -6183,7 +6214,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -6405,7 +6437,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -6557,7 +6590,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { @@ -6767,7 +6801,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": true } }, "delete": { @@ -6869,7 +6904,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -7664,7 +7700,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -8066,7 +8103,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -8255,7 +8293,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -8431,7 +8470,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { @@ -8620,7 +8660,119 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false + } + }, + "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, + "openWorldHint": false } } }, @@ -8760,7 +8912,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -8910,7 +9063,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "delete": { @@ -9043,7 +9197,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -9051,6 +9206,7 @@ "post": { "operationId": "submitContent", "summary": "Submit content", + "description": "Moderate one piece of content: text, an image, a video, audio or an object with several fields. The project checks it against the policies of its channel and returns the result. Act on `recommendation.action` (allow, review or reject). The content is stored in the project unless `doNotStore` is set, and items to review go to the review queue. The project can send the result to its webhook endpoints.", "tags": [ "Content" ], @@ -10174,13 +10330,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", @@ -11440,7 +11598,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": true } } }, @@ -11548,7 +11707,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -11684,7 +11844,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -11773,7 +11934,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { @@ -11940,7 +12102,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } }, "delete": { @@ -12042,7 +12205,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -12159,7 +12323,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -12277,7 +12442,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -12405,7 +12571,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false }, "x-speakeasy-pagination": { "type": "offsetLimit", @@ -12569,7 +12736,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -12658,7 +12826,8 @@ "read" ], "readOnlyHint": true, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } }, "put": { @@ -12868,7 +13037,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } }, "delete": { @@ -12980,7 +13150,8 @@ "destructive" ], "readOnlyHint": false, - "destructiveHint": true + "destructiveHint": true, + "openWorldHint": false } } }, @@ -13104,7 +13275,8 @@ "write" ], "readOnlyHint": false, - "destructiveHint": false + "destructiveHint": false, + "openWorldHint": false } } }, @@ -13528,11 +13700,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..fc8b77a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 2.4.0 (2026-11-12) + +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/` +- `GET /queue/{id}/items`: added the new enum value `ROBOCALL_DESC` to the `query` request parameter `sort` +- `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/sort.md b/docs/models/sort.md index e858c56..0435e32 100644 --- a/docs/models/sort.md +++ b/docs/models/sort.md @@ -14,3 +14,4 @@ value: Sort = "FIFO" - `"LIFO"` - `"RANDOM"` - `"SEVERITY_DESC"` +- `"ROBOCALL_DESC"` 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/actions/README.md b/docs/sdks/actions/README.md index b49ce1f..3199cd8 100644 --- a/docs/sdks/actions/README.md +++ b/docs/sdks/actions/README.md @@ -13,7 +13,7 @@ ## list -List the moderation actions of the project. The list is paginated. +List the moderation actions of the project, with their webhooks. An action is a decision that a reviewer or a rule can take on content or an author. Built-in actions (for example reject an item or block an author) change the item or author in Moderation API. Custom actions record the decision and send it to the webhooks of the action, where the customer platform acts on it. The list is paginated. ### Example Usage @@ -64,7 +64,7 @@ with ModerationAPI( ## create -Create an action. +Create an action that reviewers and rules can take. `type` sets what it does: a built-in type changes the item or author in Moderation API, and a custom type (`ITEM_CUSTOM`, `AUTHOR_CUSTOM`) only records the decision for the webhooks to deliver. Creating an action does not execute it. ### Example Usage @@ -119,7 +119,7 @@ with ModerationAPI( ## retrieve -Get an action by ID. +Get an action by ID: its type, where it shows in the review queues, the values it takes and its webhooks. ### Example Usage @@ -164,7 +164,7 @@ with ModerationAPI( ## update -Update an action. +Update the settings of an action: its name, type, queues and values. The new settings apply the next time the action is executed. Updating an action does not execute it. ### Example Usage @@ -266,7 +266,7 @@ with ModerationAPI( ## execute -Execute a moderation action on one or more content items. +Execute one action of the project, by ID or key, on content items or authors. A built-in action changes them in Moderation API (for example rejects the items or blocks the authors). Every executed action is recorded, and the project sends it to the webhooks of the action and to its other webhook endpoints, where the customer platform can act on it. List the actions first to see what each one does. ### Example Usage diff --git a/docs/sdks/contentsdk/README.md b/docs/sdks/contentsdk/README.md index e18cb22..ad327c6 100644 --- a/docs/sdks/contentsdk/README.md +++ b/docs/sdks/contentsdk/README.md @@ -108,7 +108,7 @@ with ModerationAPI( ## submit -Submit content +Moderate one piece of content: text, an image, a video, audio or an object with several fields. The project checks it against the policies of its channel and returns the result. Act on `recommendation.action` (allow, review or reject). The content is stored in the project unless `doNotStore` is set, and items to review go to the review queue. The project can send the result to its webhook endpoints. ### Example Usage 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/actions.py b/src/moderation_api/actions.py index 200e6ee..83c4683 100644 --- a/src/moderation_api/actions.py +++ b/src/moderation_api/actions.py @@ -25,7 +25,7 @@ def list( ) -> Optional[models.ListActionsResponse]: r"""List moderation actions - List the moderation actions of the project. The list is paginated. + List the moderation actions of the project, with their webhooks. An action is a decision that a reviewer or a rule can take on content or an author. Built-in actions (for example reject an item or block an author) change the item or author in Moderation API. Custom actions record the decision and send it to the webhooks of the action, where the customer platform acts on it. The list is paginated. :param queue_id: :param page: @@ -186,7 +186,7 @@ async def list_async( ) -> Optional[models.ListActionsResponse]: r"""List moderation actions - List the moderation actions of the project. The list is paginated. + List the moderation actions of the project, with their webhooks. An action is a decision that a reviewer or a rule can take on content or an author. Built-in actions (for example reject an item or block an author) change the item or author in Moderation API. Custom actions record the decision and send it to the webhooks of the action, where the customer platform acts on it. The list is paginated. :param queue_id: :param page: @@ -365,7 +365,7 @@ def create( ) -> models.CreateActionResponse: r"""Create an action - Create an action. + Create an action that reviewers and rules can take. `type` sets what it does: a built-in type changes the item or author in Moderation API, and a custom type (`ITEM_CUSTOM`, `AUTHOR_CUSTOM`) only records the decision for the webhooks to deliver. Creating an action does not execute it. :param name: The name of the action. :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. @@ -522,7 +522,7 @@ async def create_async( ) -> models.CreateActionResponse: r"""Create an action - Create an action. + Create an action that reviewers and rules can take. `type` sets what it does: a built-in type changes the item or author in Moderation API, and a custom type (`ITEM_CUSTOM`, `AUTHOR_CUSTOM`) only records the decision for the webhooks to deliver. Creating an action does not execute it. :param name: The name of the action. :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. @@ -662,7 +662,7 @@ def retrieve( ) -> models.GetActionResponse: r"""Get an action - Get an action by ID. + Get an action by ID: its type, where it shows in the review queues, the values it takes and its webhooks. :param id: The ID of the action to get. :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. @@ -772,7 +772,7 @@ async def retrieve_async( ) -> models.GetActionResponse: r"""Get an action - Get an action by ID. + Get an action by ID: its type, where it shows in the review queues, the values it takes and its webhooks. :param id: The ID of the action to get. :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. @@ -900,7 +900,7 @@ def update( ) -> models.UpdateActionResponse: r"""Update an action - Update an action. + Update the settings of an action: its name, type, queues and values. The new settings apply the next time the action is executed. Updating an action does not execute it. :param id: The ID of the action to update. :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. @@ -1063,7 +1063,7 @@ async def update_async( ) -> models.UpdateActionResponse: r"""Update an action - Update an action. + Update the settings of an action: its name, type, queues and values. The new settings apply the next time the action is executed. Updating an action does not execute it. :param id: The ID of the action to update. :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. @@ -1435,7 +1435,7 @@ def execute( ) -> models.ExecuteActionResponse: r"""Execute moderation action - Execute a moderation action on one or more content items. + Execute one action of the project, by ID or key, on content items or authors. A built-in action changes them in Moderation API (for example rejects the items or blocks the authors). Every executed action is recorded, and the project sends it to the webhooks of the action and to its other webhook endpoints, where the customer platform can act on it. List the actions first to see what each one does. :param action_key: ID or key of the action to execute :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. @@ -1571,7 +1571,7 @@ async def execute_async( ) -> models.ExecuteActionResponse: r"""Execute moderation action - Execute a moderation action on one or more content items. + Execute one action of the project, by ID or key, on content items or authors. A built-in action changes them in Moderation API (for example rejects the items or blocks the authors). Every executed action is recorded, and the project sends it to the webhooks of the action and to its other webhook endpoints, where the customer platform can act on it. List the actions first to see what each one does. :param action_key: ID or key of the action to execute :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. diff --git a/src/moderation_api/content_sdk.py b/src/moderation_api/content_sdk.py index 10c0d48..f67de1b 100644 --- a/src/moderation_api/content_sdk.py +++ b/src/moderation_api/content_sdk.py @@ -549,6 +549,8 @@ def submit( ) -> models.SubmitContentResponse: r"""Submit content + Moderate one piece of content: text, an image, a video, audio or an object with several fields. The project checks it against the policies of its channel and returns the result. Act on `recommendation.action` (allow, review or reject). The content is stored in the project unless `doNotStore` is set, and items to review go to the review queue. The project can send the result to its webhook endpoints. + :param content: The content sent for moderation :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 timestamp: Unix timestamp (in milliseconds) of when the content was created. Use if content is not submitted in real-time. @@ -712,6 +714,8 @@ async def submit_async( ) -> models.SubmitContentResponse: r"""Submit content + Moderate one piece of content: text, an image, a video, audio or an object with several fields. The project checks it against the policies of its channel and returns the result. Act on `recommendation.action` (allow, review or reject). The content is stored in the project unless `doNotStore` is set, and items to review go to the review queue. The project can send the result to its webhook endpoints. + :param content: The content sent for moderation :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 timestamp: Unix timestamp (in milliseconds) of when the content was created. Use if content is not submitted in real-time. 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/listqueueitemsop.py b/src/moderation_api/models/listqueueitemsop.py index 2e64899..2fa999a 100644 --- a/src/moderation_api/models/listqueueitemsop.py +++ b/src/moderation_api/models/listqueueitemsop.py @@ -21,6 +21,7 @@ "LIFO", "RANDOM", "SEVERITY_DESC", + "ROBOCALL_DESC", ] 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, *,