From 8bdf3604c551c679b690436f944ee6c1a1d57ce9 Mon Sep 17 00:00:00 2001 From: chrisdengso <8185683+chrisdengso@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:12:40 +0000 Subject: [PATCH] feat: v3.4.0, API changes --- .speakeasy/gen.lock | 78 +++++-- .speakeasy/gen.yaml | 2 +- .speakeasy/openapi.json | 138 +++++++++-- CHANGELOG.md | 10 + Gemfile.lock | 2 +- README.md | 14 +- docs/models/components/queueitem.md | 4 +- .../operations/deletewordlistrequest.md | 9 + .../operations/deletewordlistresponse.md | 11 + .../operations/deletewordlistresponsebody.md | 12 + .../operations/resolvequeueitemrequest.md | 10 +- .../resolvequeueitemsrequestbody.md | 6 +- .../resolvequeueitemsresponsebody.md | 8 +- docs/models/operations/unicodespoofing.md | 12 +- .../operations/unresolvequeueitemrequest.md | 10 +- docs/sdks/items/README.md | 28 +-- docs/sdks/wordlist/README.md | 43 ++++ lib/moderation_api/items.rb | 8 +- .../models/components/queueitem.rb | 4 +- lib/moderation_api/models/operations.rb | 3 + .../operations/deletewordlist_request.rb | 39 ++++ .../operations/deletewordlist_request.rbi | 20 ++ .../operations/deletewordlist_response.rb | 51 +++++ .../operations/deletewordlist_response.rbi | 32 +++ .../operations/deletewordlist_responsebody.rb | 47 ++++ .../deletewordlist_responsebody.rbi | 26 +++ .../operations/resolvequeueitem_request.rb | 2 +- .../resolvequeueitems_requestbody.rb | 2 +- .../resolvequeueitems_responsebody.rb | 2 +- .../models/operations/unicode_spoofing.rb | 2 +- .../operations/unresolvequeueitem_request.rb | 2 +- lib/moderation_api/moderationapi.rb | 2 +- lib/moderation_api/sdkconfiguration.rb | 4 +- lib/moderation_api/wordlist.rb | 216 ++++++++++++++++++ moderation_api.gemspec | 2 +- 35 files changed, 761 insertions(+), 100 deletions(-) create mode 100644 docs/models/operations/deletewordlistrequest.md create mode 100644 docs/models/operations/deletewordlistresponse.md create mode 100644 docs/models/operations/deletewordlistresponsebody.md create mode 100644 lib/moderation_api/models/operations/deletewordlist_request.rb create mode 100644 lib/moderation_api/models/operations/deletewordlist_request.rbi create mode 100644 lib/moderation_api/models/operations/deletewordlist_response.rb create mode 100644 lib/moderation_api/models/operations/deletewordlist_response.rbi create mode 100644 lib/moderation_api/models/operations/deletewordlist_responsebody.rb create mode 100644 lib/moderation_api/models/operations/deletewordlist_responsebody.rbi diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index a4cf2586..d3ee64ee 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: a78f35a2-6d8d-4b9f-8962-89b8103f2924 management: - docChecksum: d6bce8a263f0ec11d54bdf026957ba2f + docChecksum: 29c7bb10b9655dcfe925eacf9d5f4758 docVersion: 1.1.0 speakeasyVersion: internal generationVersion: internal - releaseVersion: 3.3.0 - configChecksum: f643d19c39f460f5b897b686b9f50d2e + releaseVersion: 3.4.0 + configChecksum: c9a222e953fdc5d702181456b833ed7c repoURL: https://github.com/moderation-api/sdk-ruby installationURL: https://github.com/moderation-api/sdk-ruby published: true @@ -38,7 +38,7 @@ trackedFiles: Gemfile: last_write_checksum: sha1:8c1b6fa9505f61abd0fb6741f8094e9655a55495 Gemfile.lock: - last_write_checksum: sha1:6e10344330d556edc920935336fa64f52bda4df7 + last_write_checksum: sha1:c8e6dae81c73f4a444ac274375a62c07a4bf1853 Rakefile: last_write_checksum: sha1:c572639efdae8c7b24141ee5c02d8f009e101ed8 USAGE.md: @@ -92,7 +92,7 @@ trackedFiles: docs/models/components/queue.md: last_write_checksum: sha1:ac8d8af0be1ed160bd0c98c11003b4dff0627a7e docs/models/components/queueitem.md: - last_write_checksum: sha1:84306866c0ef4edcf218f0c51fc7215662bcbad7 + last_write_checksum: sha1:352e25fc1e796f154623f9b9c8eaa702f8d74355 docs/models/components/queueitemaudio.md: last_write_checksum: sha1:ae2eba19682e61cc960d7b94951d8199dea73ed6 docs/models/components/queueitembrandimpersonation.md: @@ -349,6 +349,12 @@ trackedFiles: last_write_checksum: sha1:710b4cf0e9c349d8477ddc7e2e9816104dd8dccf docs/models/operations/deletewebhookresponsebody.md: last_write_checksum: sha1:e0adfa96b5e5d1bffd7e83c497dcd9507d1557c1 + docs/models/operations/deletewordlistrequest.md: + last_write_checksum: sha1:cc2058d191c77a138239189197a2587fa06808f9 + docs/models/operations/deletewordlistresponse.md: + last_write_checksum: sha1:5fb4c31830cf7723eb1769ead14b21c2b6abe65e + docs/models/operations/deletewordlistresponsebody.md: + last_write_checksum: sha1:540e349255d405e68bf1bf70bb3c40e5ba0b4596 docs/models/operations/drugs.md: last_write_checksum: sha1:792c7ad94945aa8936f42b744846a2d6f86c0e81 docs/models/operations/duplicatechannelrequest.md: @@ -680,7 +686,7 @@ trackedFiles: docs/models/operations/removewordlistwordsresponsebody.md: last_write_checksum: sha1:def6fad308c85268f2497306789d01bbd6def4bf docs/models/operations/resolvequeueitemrequest.md: - last_write_checksum: sha1:aeac5804fec81f40a18df878e0b77e68772ba009 + last_write_checksum: sha1:5d825065d7f695033e436ee2a524d62a0034934d docs/models/operations/resolvequeueitemresponse.md: last_write_checksum: sha1:2b979b11815dd8da34ad0cda2e962f86f82ffe9d docs/models/operations/resolvequeueitemresponsebody.md: @@ -688,11 +694,11 @@ trackedFiles: docs/models/operations/resolvequeueitemsrequest.md: last_write_checksum: sha1:d4ffc421aa33c7aa1e877d4b04058562ac56b3ac docs/models/operations/resolvequeueitemsrequestbody.md: - last_write_checksum: sha1:05591c511d094304a255f5637957e3f8678917b3 + last_write_checksum: sha1:2475cb1b6149807c414e392ea66270f295102574 docs/models/operations/resolvequeueitemsresponse.md: last_write_checksum: sha1:f2fdc411b3ea13849af86792a7c29e990fcac7c5 docs/models/operations/resolvequeueitemsresponsebody.md: - last_write_checksum: sha1:4a33d72c110df9c1be8e9dcdfcaa7c0738a4cbd2 + last_write_checksum: sha1:4e359e185548871f94474bea8c37506d77e5eeaf docs/models/operations/respectinsight.md: last_write_checksum: sha1:2234db7794940b4f0f4c39e255a9b5e33114d335 docs/models/operations/reviewstats.md: @@ -778,9 +784,9 @@ trackedFiles: docs/models/operations/unblockauthorresponsebody.md: last_write_checksum: sha1:8b747cfe2e8ef37842c4b1d0672dd205a9bd3fd1 docs/models/operations/unicodespoofing.md: - last_write_checksum: sha1:79534af1086c3960979eeadb5a132cbba08a993a + last_write_checksum: sha1:8fa334552a549f8725350b34f80a7f6e5ff965bf docs/models/operations/unresolvequeueitemrequest.md: - last_write_checksum: sha1:1c6256d300d386b67c88b7a50a1693a152c9bec1 + last_write_checksum: sha1:3780db511f54a36bb42524a73e0d95bbca5a2d21 docs/models/operations/unresolvequeueitemresponse.md: last_write_checksum: sha1:b83c7f0e09b623e5a18cb3f1cfc976d21f6c6cb9 docs/models/operations/unresolvequeueitemresponsebody.md: @@ -890,7 +896,7 @@ trackedFiles: docs/sdks/feedback/README.md: last_write_checksum: sha1:a01d711b5e761184a0033a59f4604075be684cfb docs/sdks/items/README.md: - last_write_checksum: sha1:81e26c6ed42bebc36d969bcb798b9422b8fa95f1 + last_write_checksum: sha1:e4ca11704d40b992061f9d44c58df6d638773ee9 docs/sdks/projects/README.md: last_write_checksum: sha1:623605cf28283e448ae1c5a1137bb3005725b6cf docs/sdks/queue/README.md: @@ -900,7 +906,7 @@ trackedFiles: docs/sdks/webhooksecret/README.md: last_write_checksum: sha1:817c8bad58bd102383e2a3a17b6bb13d92a6fcc3 docs/sdks/wordlist/README.md: - last_write_checksum: sha1:837e7fcfc17ef38f187af6d308be6fd7a89e6cdc + last_write_checksum: sha1:8bb0b5ae225b68a5743768afe4c29024987246ea docs/sdks/words/README.md: last_write_checksum: sha1:e0b9bb6b768f98744d317e37a05c9f90ad17030d lib/crystalline.rb: @@ -934,7 +940,7 @@ trackedFiles: lib/moderation_api/feedback.rb: last_write_checksum: sha1:184f119c5d2fc1bcb5f65416c2d61ae445759303 lib/moderation_api/items.rb: - last_write_checksum: sha1:6c0728649b25ff1b8ffe80e2ea0cbf03d3d81cc2 + last_write_checksum: sha1:42fb3749c2b0a3b2324689fb00b5f605a7ab608b lib/moderation_api/models/callbacks.rb: last_write_checksum: sha1:00479d36cc70b26d311a89c2162e1eecd7986e77 lib/moderation_api/models/components.rb: @@ -1036,7 +1042,7 @@ trackedFiles: lib/moderation_api/models/components/queue.rbi: last_write_checksum: sha1:3a00381410a202d5b63540601480896e9c7cddde lib/moderation_api/models/components/queueitem.rb: - last_write_checksum: sha1:7e0fd1d8988ff4de337e7410a81a012fd74efe0f + last_write_checksum: sha1:44aada9586aeefa9da78425f09d28454b9b25278 lib/moderation_api/models/components/queueitem.rbi: last_write_checksum: sha1:43f900ce46cff89a3a5fce7d857bbf9f65d65a68 lib/moderation_api/models/components/queueitem_audio.rb: @@ -1158,7 +1164,7 @@ trackedFiles: lib/moderation_api/models/errors/ratelimiterror.rbi: last_write_checksum: sha1:87922693e4ec7f67110e261b50d041d6591d3a6b lib/moderation_api/models/operations.rb: - last_write_checksum: sha1:2d68be2cd15f38a13613397ed812fad2c5472039 + last_write_checksum: sha1:5df771570d05b01aa93efa32762c15d9f14b3bb7 lib/moderation_api/models/operations/action_request.rb: last_write_checksum: sha1:dfab71edc86fbc3977a4b8a8a5b781c24536b087 lib/moderation_api/models/operations/action_request.rbi: @@ -1559,6 +1565,18 @@ trackedFiles: last_write_checksum: sha1:d02d6845bbe248684b041c074db9607d67a2f8a1 lib/moderation_api/models/operations/deletewebhook_responsebody.rbi: last_write_checksum: sha1:40de1639f53aff5282809248f807557701711009 + lib/moderation_api/models/operations/deletewordlist_request.rb: + last_write_checksum: sha1:fd2e4a0d57a1e955d99903c3ad1e44adba5967c6 + lib/moderation_api/models/operations/deletewordlist_request.rbi: + last_write_checksum: sha1:c6303099087b1a8b931eced63d7bbf667fec2ec1 + lib/moderation_api/models/operations/deletewordlist_response.rb: + last_write_checksum: sha1:f9b6b289c88afddbb444c6862460d485bfcadc5c + lib/moderation_api/models/operations/deletewordlist_response.rbi: + last_write_checksum: sha1:1567f135a32b74622137079c645772dee6b26066 + lib/moderation_api/models/operations/deletewordlist_responsebody.rb: + last_write_checksum: sha1:89857a73e8c3d5752276b1233909bd72fa8cad4a + lib/moderation_api/models/operations/deletewordlist_responsebody.rbi: + last_write_checksum: sha1:77cdadd12f99bac01e4e8358301ec6295a7a4a83 lib/moderation_api/models/operations/drugs.rb: last_write_checksum: sha1:9a658147ecce726db9fa93f3c8d17322dde370f8 lib/moderation_api/models/operations/drugs.rbi: @@ -2220,7 +2238,7 @@ trackedFiles: lib/moderation_api/models/operations/removewordlistwords_responsebody.rbi: last_write_checksum: sha1:356759040681697022af0658456acc63000fd0dc lib/moderation_api/models/operations/resolvequeueitem_request.rb: - last_write_checksum: sha1:5984f5dd964df63fb3aa76109807784036fcf295 + last_write_checksum: sha1:28d4c9c909c82614138c9423cf004356496695d7 lib/moderation_api/models/operations/resolvequeueitem_request.rbi: last_write_checksum: sha1:bc1b789a4e4c0690b5f05a3f38f61a0dff2d4c40 lib/moderation_api/models/operations/resolvequeueitem_response.rb: @@ -2236,7 +2254,7 @@ trackedFiles: lib/moderation_api/models/operations/resolvequeueitems_request.rbi: last_write_checksum: sha1:9438390ff81d23f39dfcd06665930b9333e9f04e lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb: - last_write_checksum: sha1:708062055b9cd22d74ff5686d93ff490eaf431f1 + last_write_checksum: sha1:9a4812fd96a6b5725867c4a951d513e2df2d21d3 lib/moderation_api/models/operations/resolvequeueitems_requestbody.rbi: last_write_checksum: sha1:b3dcb46f20093268b8a1921cf7ae3eb7a6d74e97 lib/moderation_api/models/operations/resolvequeueitems_response.rb: @@ -2244,7 +2262,7 @@ trackedFiles: lib/moderation_api/models/operations/resolvequeueitems_response.rbi: last_write_checksum: sha1:3fde7d2df48d7acf98ffb330e07dd0666a467e8c lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb: - last_write_checksum: sha1:d5f0c86021fa713abb263a06e2424ecb48aabdf3 + last_write_checksum: sha1:44b99af1877decfe255746fa13e03ea643bdbf0a lib/moderation_api/models/operations/resolvequeueitems_responsebody.rbi: last_write_checksum: sha1:779e79702cfdf776af2e4ad89ab0690b90bbfe90 lib/moderation_api/models/operations/respect_insight.rb: @@ -2416,11 +2434,11 @@ trackedFiles: lib/moderation_api/models/operations/unblockauthor_responsebody.rbi: last_write_checksum: sha1:d4c3f778a488c456376e95499608a2cd231c7b0a lib/moderation_api/models/operations/unicode_spoofing.rb: - last_write_checksum: sha1:0727fb610bfaa91f2a8dab9edc155cfd097d4a21 + last_write_checksum: sha1:9d7bd9b5c69da039c675e0ce384f435fec17563e lib/moderation_api/models/operations/unicode_spoofing.rbi: last_write_checksum: sha1:7656bced8fbc58bd5d5acd35faf840f724c02f2f lib/moderation_api/models/operations/unresolvequeueitem_request.rb: - last_write_checksum: sha1:05021b63f4b03cb2c9760b6e2cba101dd073b891 + last_write_checksum: sha1:512e738489dc520aad413a1c5f16f362631b78fb lib/moderation_api/models/operations/unresolvequeueitem_request.rbi: last_write_checksum: sha1:ab56910c197bef8ee566e1e2dd7f4ae6e8947139 lib/moderation_api/models/operations/unresolvequeueitem_response.rb: @@ -2618,7 +2636,7 @@ trackedFiles: lib/moderation_api/sdk_hooks/types.rb: last_write_checksum: sha1:4c965332c50ba795946cf8df50a6202e89db0a45 lib/moderation_api/sdkconfiguration.rb: - last_write_checksum: sha1:80368426dbf67637927adc40f84b77e1ee1d2aa4 + last_write_checksum: sha1:2f2fbd9b5954e2fc9f4ee6e206490ea6f067ed7f lib/moderation_api/sdkconfiguration.rbi: last_write_checksum: sha1:0ff7c53716ae2b6668c84ad4f83b9a8697482c33 lib/moderation_api/utils/forms.rb: @@ -2642,11 +2660,11 @@ trackedFiles: lib/moderation_api/webhooksecret.rb: last_write_checksum: sha1:233f69692169d89c8b9c7a02f67dfb43437bbd3e lib/moderation_api/wordlist.rb: - last_write_checksum: sha1:d37f222f1fcb517a2d99e68a715b16627882272d + last_write_checksum: sha1:b34128a840a59fbb33b5bcc4f95540825554dfa4 lib/moderation_api/words.rb: last_write_checksum: sha1:1caff3b1db9983d6cd6d76e0f90d47a39e376842 moderation_api.gemspec: - last_write_checksum: sha1:06d86939c2481dab45a58511862ea78f38c7df98 + last_write_checksum: sha1:166cc314904fa48b06f09c7fcb565cf219238c51 sorbet/config: last_write_checksum: sha1:d02b32628dad70edc5929a9b9801d5e2dca15d40 sorbet/rbi/annotations/.gitattributes: @@ -3706,4 +3724,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 48b05302..397463ec 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false ruby: - version: 3.3.0 + version: 3.4.0 additionalDependencies: development: {} runtime: {} diff --git a/.speakeasy/openapi.json b/.speakeasy/openapi.json index 9a2cf7e4..e6db07ff 100644 --- a/.speakeasy/openapi.json +++ b/.speakeasy/openapi.json @@ -3033,7 +3033,7 @@ "get": { "operationId": "listQueueItems", "summary": "List queue items", - "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item.", + "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item.", "tags": [ "Review queues" ], @@ -3281,7 +3281,7 @@ "post": { "operationId": "resolveQueueItem", "summary": "Resolve a queue item", - "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`.", + "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`.", "tags": [ "Review queues" ], @@ -3306,10 +3306,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -3414,7 +3414,7 @@ "post": { "operationId": "resolveQueueItems", "summary": "Resolve queue items", - "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`.", + "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`.", "tags": [ "Review queues" ], @@ -3459,7 +3459,7 @@ "items": { "type": "string" }, - "description": "The item IDs to resolve. Up to 100." + "description": "The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." } }, "required": [ @@ -3492,7 +3492,7 @@ "items": { "type": "string" }, - "description": "Item IDs that do not exist in the project." + "description": "IDs from `itemIds` that match no item or content ID in the project." } }, "required": [ @@ -3571,7 +3571,7 @@ "post": { "operationId": "unresolveQueueItem", "summary": "Unresolve a queue item", - "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list.", + "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`.", "tags": [ "Review queues" ], @@ -3596,10 +3596,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -8622,6 +8622,116 @@ "readOnlyHint": false, "destructiveHint": true } + }, + "delete": { + "operationId": "deleteWordlist", + "summary": "Delete wordlist", + "description": "Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone.", + "tags": [ + "Wordlists" + ], + "security": [ + { + "Authorization": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "description": "ID of the wordlist to delete" + }, + "required": true, + "description": "ID of the wordlist to delete" + }, + { + "in": "header", + "name": "Project-Id", + "required": false, + "schema": { + "type": "string" + }, + "description": "The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.", + "x-speakeasy-name-override": "projectId" + } + ], + "responses": { + "200": { + "description": "Wordlist deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of the deleted wordlist" + }, + "deleted": { + "type": "boolean", + "description": "Whether the wordlist was deleted" + }, + "detachedChannelIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "IDs of the channels that used the wordlist. It was removed from them." + } + }, + "required": [ + "id", + "deleted", + "detachedChannelIds" + ], + "additionalProperties": false + } + } + } + }, + "401": { + "description": "Authorization not provided", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthenticationError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "429": { + "description": "Too many requests. Retry after the number of seconds in the `Retry-After` header.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RateLimitError" + } + } + } + } + }, + "x-speakeasy-group": "wordlist", + "x-speakeasy-name-override": "delete", + "x-speakeasy-mcp": { + "title": "Delete wordlist", + "scopes": [ + "destructive" + ], + "readOnlyHint": false, + "destructiveHint": true + } } }, "/wordlist/{id}/embedding-status": { @@ -10174,13 +10284,15 @@ "const": "unicode_spoofing" }, "signals": { - "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.", + "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.", "type": "object", "propertyNames": { "type": "string", "enum": [ "mixed_script", "confusable_word", + "hidden_lookalike", + "leetspeak", "invisible", "zalgo", "illegal", @@ -13528,11 +13640,11 @@ "properties": { "id": { "type": "string", - "description": "The item ID. Use it to resolve or unresolve the item in this queue." + "description": "The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue." }, "contentId": { "type": "string", - "description": "Your content ID, as you sent it to `POST /moderate`." + "description": "Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`." }, "content": { "anyOf": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index ff3a8417..72257d13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 3.4.0 (2026-10-29) + +Full Changelog: [v3.3.0...v3.4.0](https://github.com/moderation-api/sdk-ruby/compare/v3.3.0...v3.4.0) + +### API changes + +- `POST /moderate`: added the new `hidden_lookalike` enum value to the request property `policies/items/oneOf[subschema #36: Unicode Spoofing]/signals/propertyNames/` +- `POST /moderate`: added the new `leetspeak` enum value to the request property `policies/items/oneOf[subschema #36: Unicode Spoofing]/signals/propertyNames/` +- `DELETE /wordlist/{id}`: endpoint added + ## 3.3.0 (2026-10-28) Full Changelog: [v3.2.0...v3.3.0](https://github.com/moderation-api/sdk-ruby/compare/v3.2.0...v3.3.0) diff --git a/Gemfile.lock b/Gemfile.lock index b99020ff..5ac2b810 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - moderation_api (3.3.0) + moderation_api (3.4.0) faraday faraday-multipart faraday-retry diff --git a/README.md b/README.md index 94793b66..21f071a5 100644 --- a/README.md +++ b/README.md @@ -86,13 +86,13 @@ end Use `content.submit` to moderate text, images, video, audio, or objects with several fields. All parameters except `content` are optional. -Pass your API key as `secret_key`. The examples read it from the `MODAPI_SECRET_KEY` environment variable. +The client reads your API key from the `MODAPI_SECRET_KEY` environment variable. To set it in code, pass `secret_key`. ```ruby require "moderation_api" Operations = ModerationApi::Models::Operations -client = ModerationApi::ModerationApi.new(secret_key: ENV.fetch("MODAPI_SECRET_KEY")) +client = ModerationApi::ModerationApi.new # reads MODAPI_SECRET_KEY # Text client.content.submit(body: Operations::SubmitContentRequestBody.new( @@ -220,8 +220,8 @@ A project key can't call the management API: the API returns `403` with the code ```ruby require "moderation_api" -# Project key -client = ModerationApi::ModerationApi.new(secret_key: ENV.fetch("MODAPI_SECRET_KEY")) +# Project key, from MODAPI_SECRET_KEY +client = ModerationApi::ModerationApi.new # Organization key management = ModerationApi::ModerationApi.new(secret_key: ENV.fetch("MODAPI_ORGANIZATION_KEY")) @@ -337,6 +337,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) @@ -447,10 +448,7 @@ end Set a timeout in milliseconds for all requests on the client, or for one request: ```ruby -client = ModerationApi::ModerationApi.new( - secret_key: ENV.fetch("MODAPI_SECRET_KEY"), - timeout_ms: 10_000 -) +client = ModerationApi::ModerationApi.new(timeout_ms: 10_000) client.content.submit( body: Operations::SubmitContentRequestBody.new(content: Operations::TextRequest.new(text: "Hello")), diff --git a/docs/models/components/queueitem.md b/docs/models/components/queueitem.md index 6ffe56d5..6ade3200 100644 --- a/docs/models/components/queueitem.md +++ b/docs/models/components/queueitem.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *::String* | :heavy_check_mark: | The item ID. Use it to resolve or unresolve the item in this queue. | -| `content_id` | *::String* | :heavy_check_mark: | Your content ID, as you sent it to `POST /moderate`. | +| `id` | *::String* | :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` | *::String* | :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` | [T.nilable(T.any(Models::Components::QueueItemText, Models::Components::QueueItemImage, Models::Components::QueueItemVideo, Models::Components::QueueItemAudio, Models::Components::QueueItemObject))](../../models/shared/queueitemcontent.md) | :heavy_check_mark: | The submitted content. | | `labels` | T::Array<[Models::Components::Label](../../models/shared/label.md)> | :heavy_check_mark: | The moderation labels of the content. | | `flagged` | *T::Boolean* | :heavy_check_mark: | Whether moderation flagged the content. | diff --git a/docs/models/operations/deletewordlistrequest.md b/docs/models/operations/deletewordlistrequest.md new file mode 100644 index 00000000..f040bb98 --- /dev/null +++ b/docs/models/operations/deletewordlistrequest.md @@ -0,0 +1,9 @@ +# DeleteWordlistRequest + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *::String* | :heavy_check_mark: | ID of the wordlist to delete | +| `project_id` | *T.nilable(::String)* | :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/operations/deletewordlistresponse.md b/docs/models/operations/deletewordlistresponse.md new file mode 100644 index 00000000..633bbe2b --- /dev/null +++ b/docs/models/operations/deletewordlistresponse.md @@ -0,0 +1,11 @@ +# DeleteWordlistResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `content_type` | *::String* | :heavy_check_mark: | HTTP response content type for this operation | +| `status_code` | *::Integer* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [Faraday::Response](https://www.rubydoc.info/gems/faraday/Faraday/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `object` | [T.nilable(Models::Operations::DeleteWordlistResponseBody)](../../models/operations/deletewordlistresponsebody.md) | :heavy_minus_sign: | Wordlist deleted successfully | \ No newline at end of file diff --git a/docs/models/operations/deletewordlistresponsebody.md b/docs/models/operations/deletewordlistresponsebody.md new file mode 100644 index 00000000..d04f586f --- /dev/null +++ b/docs/models/operations/deletewordlistresponsebody.md @@ -0,0 +1,12 @@ +# DeleteWordlistResponseBody + +Wordlist deleted successfully + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `id` | *::String* | :heavy_check_mark: | ID of the deleted wordlist | +| `deleted` | *T::Boolean* | :heavy_check_mark: | Whether the wordlist was deleted | +| `detached_channel_ids` | T::Array<*::String*> | :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/operations/resolvequeueitemrequest.md b/docs/models/operations/resolvequeueitemrequest.md index f6b827c2..92fdc5a8 100644 --- a/docs/models/operations/resolvequeueitemrequest.md +++ b/docs/models/operations/resolvequeueitemrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *::String* | :heavy_check_mark: | The queue ID. | -| `item_id` | *::String* | :heavy_check_mark: | The item ID to resolve. | -| `project_id` | *T.nilable(::String)* | :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` | *::String* | :heavy_check_mark: | The queue ID. | +| `item_id` | *::String* | :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` | *T.nilable(::String)* | :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/operations/resolvequeueitemsrequestbody.md b/docs/models/operations/resolvequeueitemsrequestbody.md index c5e42980..5c50aca9 100644 --- a/docs/models/operations/resolvequeueitemsrequestbody.md +++ b/docs/models/operations/resolvequeueitemsrequestbody.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `item_ids` | T::Array<*::String*> | :heavy_check_mark: | The item IDs to resolve. Up to 100. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `item_ids` | T::Array<*::String*> | :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/operations/resolvequeueitemsresponsebody.md b/docs/models/operations/resolvequeueitemsresponsebody.md index e8228c93..4a3e248a 100644 --- a/docs/models/operations/resolvequeueitemsresponsebody.md +++ b/docs/models/operations/resolvequeueitemsresponsebody.md @@ -5,7 +5,7 @@ Successful response ## Fields -| Field | Type | Required | Description | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| `resolved` | *::Integer* | :heavy_check_mark: | Number of items resolved. | -| `not_found_ids` | T::Array<*::String*> | :heavy_check_mark: | Item IDs that do not exist in the project. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `resolved` | *::Integer* | :heavy_check_mark: | Number of items resolved. | +| `not_found_ids` | T::Array<*::String*> | :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/operations/unicodespoofing.md b/docs/models/operations/unicodespoofing.md index cd8dd53e..672a5296 100644 --- a/docs/models/operations/unicodespoofing.md +++ b/docs/models/operations/unicodespoofing.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `flag` | *T::Boolean* | :heavy_check_mark: | N/A | -| `threshold` | *T.nilable(::Float)* | :heavy_minus_sign: | N/A | -| `id` | *::String* | :heavy_check_mark: | N/A | -| `signals` | T::Hash[Symbol, [Models::Operations::SignalsRequest](../../models/operations/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` | *T::Boolean* | :heavy_check_mark: | N/A | +| `threshold` | *T.nilable(::Float)* | :heavy_minus_sign: | N/A | +| `id` | *::String* | :heavy_check_mark: | N/A | +| `signals` | T::Hash[Symbol, [Models::Operations::SignalsRequest](../../models/operations/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/operations/unresolvequeueitemrequest.md b/docs/models/operations/unresolvequeueitemrequest.md index daf2d2b5..c0c49887 100644 --- a/docs/models/operations/unresolvequeueitemrequest.md +++ b/docs/models/operations/unresolvequeueitemrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *::String* | :heavy_check_mark: | The queue ID. | -| `item_id` | *::String* | :heavy_check_mark: | The item ID to unresolve. | -| `project_id` | *T.nilable(::String)* | :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` | *::String* | :heavy_check_mark: | The queue ID. | +| `item_id` | *::String* | :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` | *T.nilable(::String)* | :heavy_minus_sign: | The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error. | \ No newline at end of file diff --git a/docs/sdks/items/README.md b/docs/sdks/items/README.md index b163aa4d..314ec139 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 @@ -59,7 +59,7 @@ end ## 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 @@ -81,11 +81,11 @@ end ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *::String* | :heavy_check_mark: | The queue ID. | -| `item_id` | *::String* | :heavy_check_mark: | The item ID to resolve. | -| `project_id` | *T.nilable(::String)* | :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. | +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *::String* | :heavy_check_mark: | The queue ID. | +| `item_id` | *::String* | :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` | *T.nilable(::String)* | :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. | ### Response @@ -104,7 +104,7 @@ end ## 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 @@ -154,7 +154,7 @@ end ## 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 @@ -176,11 +176,11 @@ end ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *::String* | :heavy_check_mark: | The queue ID. | -| `item_id` | *::String* | :heavy_check_mark: | The item ID to unresolve. | -| `project_id` | *T.nilable(::String)* | :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. | +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *::String* | :heavy_check_mark: | The queue ID. | +| `item_id` | *::String* | :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` | *T.nilable(::String)* | :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. | ### Response diff --git a/docs/sdks/wordlist/README.md b/docs/sdks/wordlist/README.md index 4ea5bbdd..0e29654a 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 @@ -189,6 +190,48 @@ end | Models::Errors::RateLimitError | 429 | application/json | | Errors::APIError | 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 + + +```ruby +require 'moderation_api' + +Models = ::ModerationApi::Models +s = ::ModerationApi::ModerationApi.new( + secret_key: '' +) +res = s.wordlist.delete(id: '') + +unless res.object.nil? + # handle response +end + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *::String* | :heavy_check_mark: | ID of the wordlist to delete | +| `project_id` | *T.nilable(::String)* | :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. | + +### Response + +**[T.nilable(Models::Operations::DeleteWordlistResponse)](../../models/operations/deletewordlistresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | +| Models::Errors::AuthenticationError | 401 | application/json | +| Models::Errors::NotFoundError | 404 | application/json | +| Models::Errors::RateLimitError | 429 | application/json | +| Errors::APIError | 4XX, 5XX | \*/\* | + ## get_embedding_status Get the current embedding progress status for a wordlist diff --git a/lib/moderation_api/items.rb b/lib/moderation_api/items.rb index 91ce20e1..ea3b70f9 100644 --- a/lib/moderation_api/items.rb +++ b/lib/moderation_api/items.rb @@ -48,7 +48,7 @@ def get_url(base_url:, url_variables: nil) } def list(request:, timeout_ms: nil, http_headers: nil) # list - 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. url, params = @sdk_configuration.get_server_details base_url = Utils.template_url(url, params) url = Utils.generate_url( @@ -375,7 +375,7 @@ def list(request:, timeout_ms: nil, http_headers: nil) } def resolve(id:, item_id:, project_id: nil, timeout_ms: nil, http_headers: nil) # resolve - 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`. request = Models::Operations::ResolveQueueItemRequest.new( id: id, item_id: item_id, @@ -637,7 +637,7 @@ def resolve(id:, item_id:, project_id: nil, timeout_ms: nil, http_headers: nil) } def resolve_many(body:, id:, project_id: nil, timeout_ms: nil, http_headers: nil) # resolve_many - 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`. request = Models::Operations::ResolveQueueItemsRequest.new( id: id, body: body, @@ -912,7 +912,7 @@ def resolve_many(body:, id:, project_id: nil, timeout_ms: nil, http_headers: nil } def unresolve(id:, item_id:, project_id: nil, timeout_ms: nil, http_headers: nil) # unresolve - 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`. request = Models::Operations::UnresolveQueueItemRequest.new( id: id, item_id: item_id, diff --git a/lib/moderation_api/models/components/queueitem.rb b/lib/moderation_api/models/components/queueitem.rb index cffe05c8..8ddef6fe 100644 --- a/lib/moderation_api/models/components/queueitem.rb +++ b/lib/moderation_api/models/components/queueitem.rb @@ -11,9 +11,9 @@ class QueueItem extend T::Sig include Crystalline::MetadataFields - # The item ID. Use it to resolve or unresolve the item in this queue. + # The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue. field :id, ::String, {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("id"), required: true}} - # Your content ID, as you sent it to `POST /moderate`. + # 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`. field( :content_id, ::String, diff --git a/lib/moderation_api/models/operations.rb b/lib/moderation_api/models/operations.rb index 0ea4a31f..83c65495 100644 --- a/lib/moderation_api/models/operations.rb +++ b/lib/moderation_api/models/operations.rb @@ -164,6 +164,9 @@ module Operations autoload :DeleteWebhookResponseBody, "moderation_api/models/operations/deletewebhook_responsebody.rb" autoload :DeleteWebhookRequest, "moderation_api/models/operations/deletewebhook_request.rb" autoload :DeleteWebhookResponse, "moderation_api/models/operations/deletewebhook_response.rb" + autoload :DeleteWordlistResponseBody, "moderation_api/models/operations/deletewordlist_responsebody.rb" + autoload :DeleteWordlistRequest, "moderation_api/models/operations/deletewordlist_request.rb" + autoload :DeleteWordlistResponse, "moderation_api/models/operations/deletewordlist_response.rb" autoload :DuplicateChannelRequestBody, "moderation_api/models/operations/duplicatechannel_requestbody.rb" autoload :DuplicateChannelRequest, "moderation_api/models/operations/duplicatechannel_request.rb" autoload :DuplicateChannelResponse, "moderation_api/models/operations/duplicatechannel_response.rb" diff --git a/lib/moderation_api/models/operations/deletewordlist_request.rb b/lib/moderation_api/models/operations/deletewordlist_request.rb new file mode 100644 index 00000000..2d8fc01b --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_request.rb @@ -0,0 +1,39 @@ +# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + +module ModerationApi + module Models + module Operations + + class DeleteWordlistRequest + extend T::Sig + include Crystalline::MetadataFields + + # ID of the wordlist to delete + field :id, ::String, {'path_param': {'field_name': "id", 'style': "simple", 'explode': false}} + # 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. + field( + :project_id, + Crystalline::Nilable.new(::String), + {'header': {'field_name': "Project-Id", 'style': "simple", 'explode': false}} + ) + + sig { params(id: ::String, project_id: T.nilable(::String)).void } + def initialize(id:, project_id: nil) + @id = id + @project_id = project_id + end + + sig { params(other: T.untyped).returns(T::Boolean) } + def ==(other) + return false unless other.is_a?(self.class) + return false unless @id == other.id + return false unless @project_id == other.project_id + true + end + end + end + end +end diff --git a/lib/moderation_api/models/operations/deletewordlist_request.rbi b/lib/moderation_api/models/operations/deletewordlist_request.rbi new file mode 100644 index 00000000..1bdd2b29 --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_request.rbi @@ -0,0 +1,20 @@ +# typed: true +# frozen_string_literal: true + +class ModerationApi::Models::Operations::DeleteWordlistRequest + extend ::Crystalline::MetadataFields::ClassMethods +end + +class ModerationApi::Models::Operations::DeleteWordlistRequest + def id + end + + def id=(str_) + end + + def project_id + end + + def project_id=(str_) + end +end diff --git a/lib/moderation_api/models/operations/deletewordlist_response.rb b/lib/moderation_api/models/operations/deletewordlist_response.rb new file mode 100644 index 00000000..8b2725b7 --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_response.rb @@ -0,0 +1,51 @@ +# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + +module ModerationApi + module Models + module Operations + + class DeleteWordlistResponse + extend T::Sig + include Crystalline::MetadataFields + + # HTTP response content type for this operation + field :content_type, ::String + # HTTP response status code for this operation + field :status_code, ::Integer + # Raw HTTP response; suitable for custom response parsing + field :raw_response, ::Faraday::Response + # Wordlist deleted successfully + field :object, Crystalline::Nilable.new(Models::Operations::DeleteWordlistResponseBody) + + sig { + params( + content_type: ::String, + status_code: ::Integer, + raw_response: ::Faraday::Response, + object: T.nilable(Models::Operations::DeleteWordlistResponseBody) + ) + .void + } + def initialize(content_type:, status_code:, raw_response:, object: nil) + @content_type = content_type + @status_code = status_code + @raw_response = raw_response + @object = object + end + + sig { params(other: T.untyped).returns(T::Boolean) } + def ==(other) + return false unless other.is_a?(self.class) + return false unless @content_type == other.content_type + return false unless @status_code == other.status_code + return false unless @raw_response == other.raw_response + return false unless @object == other.object + true + end + end + end + end +end diff --git a/lib/moderation_api/models/operations/deletewordlist_response.rbi b/lib/moderation_api/models/operations/deletewordlist_response.rbi new file mode 100644 index 00000000..13aae899 --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_response.rbi @@ -0,0 +1,32 @@ +# typed: true +# frozen_string_literal: true + +class ModerationApi::Models::Operations::DeleteWordlistResponse + extend ::Crystalline::MetadataFields::ClassMethods +end + +class ModerationApi::Models::Operations::DeleteWordlistResponse + def content_type + end + + def content_type=(str_) + end + + def status_code + end + + def status_code=(str_) + end + + def raw_response + end + + def raw_response=(str_) + end + + def object + end + + def object=(str_) + end +end diff --git a/lib/moderation_api/models/operations/deletewordlist_responsebody.rb b/lib/moderation_api/models/operations/deletewordlist_responsebody.rb new file mode 100644 index 00000000..0b667be7 --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_responsebody.rb @@ -0,0 +1,47 @@ +# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + +module ModerationApi + module Models + module Operations + # Wordlist deleted successfully + class DeleteWordlistResponseBody + extend T::Sig + include Crystalline::MetadataFields + + # ID of the deleted wordlist + field :id, ::String, {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("id"), required: true}} + # Whether the wordlist was deleted + field( + :deleted, + Crystalline::Boolean.new, + {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("deleted"), required: true}} + ) + # IDs of the channels that used the wordlist. It was removed from them. + field( + :detached_channel_ids, + Crystalline::Array.new(::String), + {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("detachedChannelIds"), required: true}} + ) + + sig { params(id: ::String, deleted: T::Boolean, detached_channel_ids: T::Array[::String]).void } + def initialize(id:, deleted:, detached_channel_ids:) + @id = id + @deleted = deleted + @detached_channel_ids = detached_channel_ids + end + + sig { params(other: T.untyped).returns(T::Boolean) } + def ==(other) + return false unless other.is_a?(self.class) + return false unless @id == other.id + return false unless @deleted == other.deleted + return false unless @detached_channel_ids == other.detached_channel_ids + true + end + end + end + end +end diff --git a/lib/moderation_api/models/operations/deletewordlist_responsebody.rbi b/lib/moderation_api/models/operations/deletewordlist_responsebody.rbi new file mode 100644 index 00000000..fdbac958 --- /dev/null +++ b/lib/moderation_api/models/operations/deletewordlist_responsebody.rbi @@ -0,0 +1,26 @@ +# typed: true +# frozen_string_literal: true + +class ModerationApi::Models::Operations::DeleteWordlistResponseBody + extend ::Crystalline::MetadataFields::ClassMethods +end + +class ModerationApi::Models::Operations::DeleteWordlistResponseBody + def id + end + + def id=(str_) + end + + def deleted + end + + def deleted=(str_) + end + + def detached_channel_ids + end + + def detached_channel_ids=(str_) + end +end diff --git a/lib/moderation_api/models/operations/resolvequeueitem_request.rb b/lib/moderation_api/models/operations/resolvequeueitem_request.rb index 34f16542..525307d7 100644 --- a/lib/moderation_api/models/operations/resolvequeueitem_request.rb +++ b/lib/moderation_api/models/operations/resolvequeueitem_request.rb @@ -13,7 +13,7 @@ class ResolveQueueItemRequest # The queue ID. field :id, ::String, {'path_param': {'field_name': "id", 'style': "simple", 'explode': false}} - # The item ID to resolve. + # 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. field :item_id, ::String, {'path_param': {'field_name': "itemId", 'style': "simple", 'explode': false}} # 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. field( diff --git a/lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb b/lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb index 413a461a..2b265b63 100644 --- a/lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb +++ b/lib/moderation_api/models/operations/resolvequeueitems_requestbody.rb @@ -11,7 +11,7 @@ class ResolveQueueItemsRequestBody extend T::Sig include Crystalline::MetadataFields - # The item IDs to resolve. Up to 100. + # 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. field( :item_ids, Crystalline::Array.new(::String), diff --git a/lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb b/lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb index d40cf8f5..6f0db326 100644 --- a/lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb +++ b/lib/moderation_api/models/operations/resolvequeueitems_responsebody.rb @@ -17,7 +17,7 @@ class ResolveQueueItemsResponseBody ::Integer, {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("resolved"), required: true}} ) - # Item IDs that do not exist in the project. + # IDs from `itemIds` that match no item or content ID in the project. field( :not_found_ids, Crystalline::Array.new(::String), diff --git a/lib/moderation_api/models/operations/unicode_spoofing.rb b/lib/moderation_api/models/operations/unicode_spoofing.rb index aafe3351..5817a0c2 100644 --- a/lib/moderation_api/models/operations/unicode_spoofing.rb +++ b/lib/moderation_api/models/operations/unicode_spoofing.rb @@ -24,7 +24,7 @@ class UnicodeSpoofing ) field :id, ::String, {'format_json': {'letter_case': ::ModerationApi::Utils.field_name("id"), required: true}} - # 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. + # 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. field( :signals, Crystalline::Nilable.new(Crystalline::Hash.new(Symbol, Models::Operations::SignalsRequest)), diff --git a/lib/moderation_api/models/operations/unresolvequeueitem_request.rb b/lib/moderation_api/models/operations/unresolvequeueitem_request.rb index 15f3cb15..364aa5d7 100644 --- a/lib/moderation_api/models/operations/unresolvequeueitem_request.rb +++ b/lib/moderation_api/models/operations/unresolvequeueitem_request.rb @@ -13,7 +13,7 @@ class UnresolveQueueItemRequest # The queue ID. field :id, ::String, {'path_param': {'field_name': "id", 'style': "simple", 'explode': false}} - # The item ID to unresolve. + # 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. field :item_id, ::String, {'path_param': {'field_name': "itemId", 'style': "simple", 'explode': false}} # 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. field( diff --git a/lib/moderation_api/moderationapi.rb b/lib/moderation_api/moderationapi.rb index 4aeee65d..9422fcce 100644 --- a/lib/moderation_api/moderationapi.rb +++ b/lib/moderation_api/moderationapi.rb @@ -59,7 +59,7 @@ def initialize( client: nil, retry_config: nil, timeout_ms: nil, - secret_key: nil, + secret_key: ENV.fetch("MODAPI_SECRET_KEY", nil), security_source: nil, server_idx: nil, server_url: nil, diff --git a/lib/moderation_api/sdkconfiguration.rb b/lib/moderation_api/sdkconfiguration.rb index 7189c117..8668320f 100644 --- a/lib/moderation_api/sdkconfiguration.rb +++ b/lib/moderation_api/sdkconfiguration.rb @@ -93,9 +93,9 @@ def initialize(client, hooks, retry_config, timeout_ms, secret_key, security_sou @language = "ruby" @openapi_doc_version = "1.1.0" - @sdk_version = "3.3.0" + @sdk_version = "3.4.0" @gen_version = "internal" - @user_agent = "speakeasy-sdk/ruby 3.3.0 internal 1.1.0 moderation_api" + @user_agent = "speakeasy-sdk/ruby 3.4.0 internal 1.1.0 moderation_api" end sig { returns([String, T::Hash[Symbol, String]]) } diff --git a/lib/moderation_api/wordlist.rb b/lib/moderation_api/wordlist.rb index afe1f5c9..36281fd3 100644 --- a/lib/moderation_api/wordlist.rb +++ b/lib/moderation_api/wordlist.rb @@ -1120,6 +1120,222 @@ def update(body:, id:, project_id: nil, timeout_ms: nil, http_headers: nil) end end + sig { + params( + id: ::String, + project_id: T.nilable(::String), + timeout_ms: T.nilable(Integer), + http_headers: T.nilable(T::Hash[T.any(String, Symbol), String]) + ) + .returns(Models::Operations::DeleteWordlistResponse) + } + def delete(id:, project_id: nil, timeout_ms: nil, http_headers: nil) + # delete - 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. + request = Models::Operations::DeleteWordlistRequest.new( + id: id, + project_id: project_id + ) + url, params = @sdk_configuration.get_server_details + base_url = Utils.template_url(url, params) + url = Utils.generate_url( + Models::Operations::DeleteWordlistRequest, + base_url, + "/wordlist/{id}", + request + ) + headers = Utils.get_headers(request) + headers = T.cast(headers, T::Hash[String, String]) + headers["Accept"] = "application/json" + headers["user-agent"] = @sdk_configuration.user_agent + + security = @sdk_configuration.security_source&.call + + timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil? + timeout ||= @sdk_configuration.timeout + + connection = @sdk_configuration.client + + hook_ctx = SDKHooks::HookContext.new( + config: @sdk_configuration, + base_url: base_url, + oauth2_scopes: nil, + operation_id: "deleteWordlist", + security_source: @sdk_configuration.security_source + ) + + error = T.let(nil, T.nilable(StandardError)) + http_response = T.let(nil, T.nilable(Faraday::Response)) + + begin + http_response = T.must(connection).delete(url) do |req| + req.headers.merge!(headers) + req.options.timeout = timeout unless timeout.nil? + Utils.configure_request_security(req, security) + http_headers&.each do |key, value| + req.headers[key.to_s] = value + end + + @sdk_configuration.hooks.before_request( + hook_ctx: SDKHooks::BeforeRequestHookContext.new( + hook_ctx: hook_ctx + ), + request: req + ) + end + + rescue StandardError => e + error = e + ensure + if http_response.nil? || Utils.error_status?(http_response.status) + http_response = @sdk_configuration.hooks.after_error( + error: error, + hook_ctx: SDKHooks::AfterErrorHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + else + http_response = @sdk_configuration.hooks.after_success( + hook_ctx: SDKHooks::AfterSuccessHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + end + + if http_response.nil? + raise error if !error.nil? + raise "no response" + end + end + + content_type = http_response.headers.fetch("Content-Type", "application/octet-stream") + if Utils.match_status_code(http_response.status, ["200"]) + if Utils.match_content_type(content_type, "application/json") + http_response = @sdk_configuration.hooks.after_success( + hook_ctx: SDKHooks::AfterSuccessHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + response_data = http_response.env.response_body + obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Operations::DeleteWordlistResponseBody) + response = Models::Operations::DeleteWordlistResponse.new( + status_code: http_response.status, + content_type: content_type, + raw_response: http_response, + object: T.unsafe(obj) + ) + + return response + else + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "Unknown content type received" + ) + end + elsif Utils.match_status_code(http_response.status, ["401"]) + if Utils.match_content_type(content_type, "application/json") + http_response = @sdk_configuration.hooks.after_success( + hook_ctx: SDKHooks::AfterSuccessHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + response_data = http_response.env.response_body + obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError) + obj.raw_response = http_response + raise obj + else + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "Unknown content type received" + ) + end + elsif Utils.match_status_code(http_response.status, ["404"]) + if Utils.match_content_type(content_type, "application/json") + http_response = @sdk_configuration.hooks.after_success( + hook_ctx: SDKHooks::AfterSuccessHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + response_data = http_response.env.response_body + obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError) + obj.raw_response = http_response + raise obj + else + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "Unknown content type received" + ) + end + elsif Utils.match_status_code(http_response.status, ["429"]) + if Utils.match_content_type(content_type, "application/json") + http_response = @sdk_configuration.hooks.after_success( + hook_ctx: SDKHooks::AfterSuccessHookContext.new( + hook_ctx: hook_ctx + ), + response: http_response + ) + response_data = http_response.env.response_body + obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError) + obj.raw_response = http_response + raise obj + else + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "Unknown content type received" + ) + end + elsif Utils.match_status_code(http_response.status, ["4XX"]) + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "API error occurred" + ) + elsif Utils.match_status_code(http_response.status, ["5XX"]) + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "API error occurred" + ) + else + raise( + ::ModerationApi::Models::Errors::APIError.new( + status_code: http_response.status, + body: http_response.env.response_body, + raw_response: http_response + ), + "Unknown status code received" + ) + + end + end + sig { params( id: ::String, diff --git a/moderation_api.gemspec b/moderation_api.gemspec index f7d13010..58a911d4 100644 --- a/moderation_api.gemspec +++ b/moderation_api.gemspec @@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__) Gem::Specification.new do |s| s.name = 'moderation_api' - s.version = '3.3.0' + s.version = '3.4.0' s.platform = Gem::Platform::RUBY s.licenses = ['Apache-2.0'] s.summary = ''