diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 65d60e1..cffd100 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 0199302d-9d48-4081-a021-a66e7a11ce41 management: - docChecksum: d6bce8a263f0ec11d54bdf026957ba2f + docChecksum: 29c7bb10b9655dcfe925eacf9d5f4758 docVersion: 1.1.0 speakeasyVersion: internal generationVersion: internal - releaseVersion: 1.3.0 - configChecksum: cba30f585a63d0da38fb70b401b25d5e + releaseVersion: 1.4.0 + configChecksum: 8dd588e2f67e2feb90c248cfac22e589 repoURL: https://github.com/moderation-api/sdk-php installationURL: https://github.com/moderation-api/sdk-php.git published: true @@ -84,7 +84,7 @@ trackedFiles: docs/Models/Components/Queue.md: last_write_checksum: sha1:2beff4d4c2ceff7b9f3d7196e8b8e05249566b74 docs/Models/Components/QueueItem.md: - last_write_checksum: sha1:12aad26aa74df0600dcb2bc512d72fffefc7eb3a + last_write_checksum: sha1:b13839a6f8189012f2e941d2601fa173495d18af docs/Models/Components/QueueItemAudio.md: last_write_checksum: sha1:4fdfd0ffb2285b940fa1453812e5d4dbdfdba727 docs/Models/Components/QueueItemBrandImpersonation.md: @@ -341,6 +341,12 @@ trackedFiles: last_write_checksum: sha1:dbe1e045ca97e7659e8812cf1a2d98e9858b52f3 docs/Models/Operations/DeleteWebhookResponseBody.md: last_write_checksum: sha1:2e336ec503f487c015ddc5583b49df6da5697cb5 + docs/Models/Operations/DeleteWordlistRequest.md: + last_write_checksum: sha1:8241b2c8b49bac7cd9d204731bfe658043ee7ed8 + docs/Models/Operations/DeleteWordlistResponse.md: + last_write_checksum: sha1:7fe7101c2e8b9517843549152fd88f507696abbd + docs/Models/Operations/DeleteWordlistResponseBody.md: + last_write_checksum: sha1:ed5f0f0e203d9d940a08151af8f164c42383bbc2 docs/Models/Operations/Drugs.md: last_write_checksum: sha1:a53499427c75cb4239f8c1afe9ce8af01bc6ed2f docs/Models/Operations/DuplicateChannelRequest.md: @@ -672,7 +678,7 @@ trackedFiles: docs/Models/Operations/RemoveWordlistWordsResponseBody.md: last_write_checksum: sha1:fd7813fca61c3aedd3405949ae1e889bc151239d docs/Models/Operations/ResolveQueueItemRequest.md: - last_write_checksum: sha1:f91c967ea892e6f33596bf83208c5e5231ad0fdd + last_write_checksum: sha1:6fc389615ddec51f42021eb0fcbc88cccba0bc61 docs/Models/Operations/ResolveQueueItemResponse.md: last_write_checksum: sha1:045ce38326d9ff36e7ec593be667cf0fcfc042f8 docs/Models/Operations/ResolveQueueItemResponseBody.md: @@ -680,11 +686,11 @@ trackedFiles: docs/Models/Operations/ResolveQueueItemsRequest.md: last_write_checksum: sha1:033c70664e31a9deb0f31992868b67530da3a1a3 docs/Models/Operations/ResolveQueueItemsRequestBody.md: - last_write_checksum: sha1:0f82d0cc3c9fd7ebf5313da8ad417dc0f0f83362 + last_write_checksum: sha1:39ed65a478aef539983b0a024fc6214c17a14564 docs/Models/Operations/ResolveQueueItemsResponse.md: last_write_checksum: sha1:8bafedce19f5709c554178c10350c13461e22e99 docs/Models/Operations/ResolveQueueItemsResponseBody.md: - last_write_checksum: sha1:0d2fc602321205502b6f83dd5dd3b8429f32d547 + last_write_checksum: sha1:c9b1220e1363fd336443c00949ea0910f3010d44 docs/Models/Operations/RespectInsight.md: last_write_checksum: sha1:bd2d45e1df3eeb9c4be98781dcc625d41892a777 docs/Models/Operations/ReviewStats.md: @@ -774,9 +780,9 @@ trackedFiles: docs/Models/Operations/UnblockAuthorResponseBody.md: last_write_checksum: sha1:af868cee06a14fe460e0c033458bdd6a573bab22 docs/Models/Operations/UnicodeSpoofing.md: - last_write_checksum: sha1:dcc11bf5e62c90b2ac0c2f11329dfdabd0c205ef + last_write_checksum: sha1:2296695724c48e20c5521e2924ff25bf9a7b11fb docs/Models/Operations/UnresolveQueueItemRequest.md: - last_write_checksum: sha1:c978170bc5ad02a63805869da25d2d3365b4a2ee + last_write_checksum: sha1:fe972127bb6b28ca0d0bfa9c949119a58ad12632 docs/Models/Operations/UnresolveQueueItemResponse.md: last_write_checksum: sha1:e28749d8dd7c7f06578dc5822f2b7a293f489bc4 docs/Models/Operations/UnresolveQueueItemResponseBody.md: @@ -882,7 +888,7 @@ trackedFiles: docs/sdks/feedback/README.md: last_write_checksum: sha1:c94088099f0c490ede88e5a6e31de669fe2a2cd5 docs/sdks/items/README.md: - last_write_checksum: sha1:2c198ec31dd36ed1088c4c23e511463ad4ed03ca + last_write_checksum: sha1:a7425571d838d47f8714c12e76668241b38752d0 docs/sdks/projects/README.md: last_write_checksum: sha1:867175adea7355b0fa2e9a014b6a62272d188d83 docs/sdks/queue/README.md: @@ -892,7 +898,7 @@ trackedFiles: docs/sdks/webhooksecret/README.md: last_write_checksum: sha1:1b4551ad8328b2553709e01007eb1f1f2656f9fe docs/sdks/wordlist/README.md: - last_write_checksum: sha1:f36eac428751331c3f688e4f177c6df6ced6e976 + last_write_checksum: sha1:d1eb4ed27eaced9b9b1d43160bc5588c6b66e06f docs/sdks/words/README.md: last_write_checksum: sha1:3b7fb592b91e8792b8140f9a74b22f68068982ff phpstan.neon: @@ -950,7 +956,7 @@ trackedFiles: src/Hooks/TokenResponse.php: last_write_checksum: sha1:4f4b445bf43144d2d423367512caf2ac8f63341d src/Items.php: - last_write_checksum: sha1:c8457dd9ad091f087674e2a34a9bc8d1b05c11a6 + last_write_checksum: sha1:a445f4f4bd83af8ff722e9b93eeb7c9fceb61e94 src/Models/Components/AuthenticationErrorCode.php: last_write_checksum: sha1:903736b77081716fb731d0d241fd98149b46eee9 src/Models/Components/BadRequestErrorCode.php: @@ -998,7 +1004,7 @@ trackedFiles: src/Models/Components/Queue.php: last_write_checksum: sha1:f5c6fb3b984f03d40685344d53186d761b6927b0 src/Models/Components/QueueItem.php: - last_write_checksum: sha1:98d038430ecfac2335253f57f3950e8d10f5ab2a + last_write_checksum: sha1:3c1e15de8040aaf9c393a5bfd1d733fda36e9046 src/Models/Components/QueueItemAudio.php: last_write_checksum: sha1:7e8618a6988da402fb0c06c892da52e61ba3456c src/Models/Components/QueueItemBrandImpersonation.php: @@ -1261,6 +1267,12 @@ trackedFiles: last_write_checksum: sha1:c02adbc6a20d61a9bef2a7e3a54f921be157e72d src/Models/Operations/DeleteWebhookResponseBody.php: last_write_checksum: sha1:c009dbf6fd2e394e010bc881e88de2d437c5b4cf + src/Models/Operations/DeleteWordlistRequest.php: + last_write_checksum: sha1:91a009e7a6655c7e263811aa5429c4a23a69d858 + src/Models/Operations/DeleteWordlistResponse.php: + last_write_checksum: sha1:f0e462de6707ab44f5133206f31eb34d317ee142 + src/Models/Operations/DeleteWordlistResponseBody.php: + last_write_checksum: sha1:c3c638e52501c34d695a0b5f3a6eb7012e67fb6a src/Models/Operations/Drugs.php: last_write_checksum: sha1:28ca14192e186489807005748d6f926ac09c8bc7 src/Models/Operations/DuplicateChannelRequest.php: @@ -1584,7 +1596,7 @@ trackedFiles: src/Models/Operations/RemoveWordlistWordsResponseBody.php: last_write_checksum: sha1:616012ca61922bfb310e29c791df90767b646c44 src/Models/Operations/ResolveQueueItemRequest.php: - last_write_checksum: sha1:ecf2f34b3e9196d7bf7b0c15577753b04a4ac440 + last_write_checksum: sha1:1ba75f7a631c707aa99e1d7beab561ad92be34ce src/Models/Operations/ResolveQueueItemResponse.php: last_write_checksum: sha1:633e4f018e58afd3489001095a8e53e6d4a007cb src/Models/Operations/ResolveQueueItemResponseBody.php: @@ -1592,11 +1604,11 @@ trackedFiles: src/Models/Operations/ResolveQueueItemsRequest.php: last_write_checksum: sha1:3ccff66584e3587d7bdce0adf4593e3d087dbe6f src/Models/Operations/ResolveQueueItemsRequestBody.php: - last_write_checksum: sha1:373db95f4a4eab8fd92b2b6be569df1a31e2feb6 + last_write_checksum: sha1:2fab683e5195d7528acdab8f67fba1799e1872d7 src/Models/Operations/ResolveQueueItemsResponse.php: last_write_checksum: sha1:5ad92db0f28554426f7fe10e21f96d8935feebc7 src/Models/Operations/ResolveQueueItemsResponseBody.php: - last_write_checksum: sha1:c36317d7e6b697bf1913c672c8b0bb82fc240ced + last_write_checksum: sha1:6b443c374db2b4418d9e49902ab85813c6922819 src/Models/Operations/RespectInsight.php: last_write_checksum: sha1:c762707b020bd49e5342940627e1babf9142fc64 src/Models/Operations/ReviewStats.php: @@ -1684,9 +1696,9 @@ trackedFiles: src/Models/Operations/UnblockAuthorResponseBody.php: last_write_checksum: sha1:c7bbdc50394aba4df6b98d748407ed42a34dda80 src/Models/Operations/UnicodeSpoofing.php: - last_write_checksum: sha1:280971a1558295ec10314a1f8ea945083b2b10e2 + last_write_checksum: sha1:eba70d14b8f981ffea6b671acf9f4b3ac9029b6c src/Models/Operations/UnresolveQueueItemRequest.php: - last_write_checksum: sha1:c4eec26b08994710d880c2b559cb6e954fb688e2 + last_write_checksum: sha1:58c409c212b97e0fa5bff1e5ea93239f4b8b43c1 src/Models/Operations/UnresolveQueueItemResponse.php: last_write_checksum: sha1:2f5ec7c6a563b965063f5a5708b8edd7a1934b52 src/Models/Operations/UnresolveQueueItemResponseBody.php: @@ -1784,7 +1796,7 @@ trackedFiles: src/Queue.php: last_write_checksum: sha1:be966a810109ae154cee3d97d78b3dec2c7512ef src/SDKConfiguration.php: - last_write_checksum: sha1:173a42d3f25b734c175524888318a21c747aa42b + last_write_checksum: sha1:d94629e6785e23d2f3eae32160d246604ef5724d src/Utils/BigDecimalHandler.php: last_write_checksum: sha1:2d36b5ae690b042acfcdfe7e7277d44c5055416f src/Utils/BigIntHandler.php: @@ -1860,7 +1872,7 @@ trackedFiles: src/Webhooks.php: last_write_checksum: sha1:bcaee6b9579d83bca24b0082b34d43af8ae3ec48 src/Wordlist.php: - last_write_checksum: sha1:6da5968931e849b59a3edd523ca051f261a4b424 + last_write_checksum: sha1:a29d7b86819721c6991a9495b83f454fff5f12dc src/Words.php: last_write_checksum: sha1:4637eb2d0b501a92de44a21f70e7326408ff892b examples: @@ -2912,4 +2924,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 dd9d618..9b167f1 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -32,7 +32,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false php: - version: 1.3.0 + version: 1.4.0 additionalDependencies: autoload: {} autoload-dev: {} diff --git a/.speakeasy/openapi.json b/.speakeasy/openapi.json index 9a2cf7e..e6db07f 100644 --- a/.speakeasy/openapi.json +++ b/.speakeasy/openapi.json @@ -3033,7 +3033,7 @@ "get": { "operationId": "listQueueItems", "summary": "List queue items", - "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` to resolve or unresolve an item.", + "description": "List the items of a review queue, with the filters and the date window of the queue applied. By default only pending items. The list is paginated. Use the item `id` or `contentId` to resolve or unresolve an item.", "tags": [ "Review queues" ], @@ -3281,7 +3281,7 @@ "post": { "operationId": "resolveQueueItem", "summary": "Resolve a queue item", - "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. To also take a moderation action, use `POST /actions/execute`.", + "description": "Mark an item of a queue as resolved. It is the same as a check-off in the dashboard: the item leaves the pending list and a QUEUE_ITEM_COMPLETED webhook is sent. `itemId` is the item `id` or your `contentId`. To also take a moderation action, use `POST /actions/execute`.", "tags": [ "Review queues" ], @@ -3306,10 +3306,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to resolve." + "description": "The item to resolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -3414,7 +3414,7 @@ "post": { "operationId": "resolveQueueItems", "summary": "Resolve queue items", - "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`. IDs that do not exist in the project are skipped and returned in `notFoundIds`.", + "description": "Mark up to 100 items of a queue as resolved in one request. Each item is resolved the same as with `POST /queue/{id}/items/{itemId}/resolve`, and each ID is an item `id` or your `contentId`. IDs that match no item in the project are skipped and returned in `notFoundIds`.", "tags": [ "Review queues" ], @@ -3459,7 +3459,7 @@ "items": { "type": "string" }, - "description": "The item IDs to resolve. Up to 100." + "description": "The items to resolve, up to 100. Each is the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." } }, "required": [ @@ -3492,7 +3492,7 @@ "items": { "type": "string" }, - "description": "Item IDs that do not exist in the project." + "description": "IDs from `itemIds` that match no item or content ID in the project." } }, "required": [ @@ -3571,7 +3571,7 @@ "post": { "operationId": "unresolveQueueItem", "summary": "Unresolve a queue item", - "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list.", + "description": "Mark a resolved item of a queue as pending again. It is the same as removing a check-off in the dashboard: the item comes back in the pending list. `itemId` is the item `id` or your `contentId`.", "tags": [ "Review queues" ], @@ -3596,10 +3596,10 @@ "name": "itemId", "schema": { "type": "string", - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, "required": true, - "description": "The item ID to unresolve." + "description": "The item to unresolve: the item `id` from `GET /queue/{id}/items`, or the `contentId` you sent to `POST /moderate` (webhooks send it as `item.id`). For a content ID, the newest submission with that content ID is used, as the queue shows it." }, { "in": "header", @@ -8622,6 +8622,116 @@ "readOnlyHint": false, "destructiveHint": true } + }, + "delete": { + "operationId": "deleteWordlist", + "summary": "Delete wordlist", + "description": "Delete a wordlist and its words. Channels that use the wordlist do not block the delete: the wordlist is removed from their policies. `detachedChannelIds` lists those channels. This cannot be undone.", + "tags": [ + "Wordlists" + ], + "security": [ + { + "Authorization": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "id", + "schema": { + "type": "string", + "description": "ID of the wordlist to delete" + }, + "required": true, + "description": "ID of the wordlist to delete" + }, + { + "in": "header", + "name": "Project-Id", + "required": false, + "schema": { + "type": "string" + }, + "description": "The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.", + "x-speakeasy-name-override": "projectId" + } + ], + "responses": { + "200": { + "description": "Wordlist deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "ID of the deleted wordlist" + }, + "deleted": { + "type": "boolean", + "description": "Whether the wordlist was deleted" + }, + "detachedChannelIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "IDs of the channels that used the wordlist. It was removed from them." + } + }, + "required": [ + "id", + "deleted", + "detachedChannelIds" + ], + "additionalProperties": false + } + } + } + }, + "401": { + "description": "Authorization not provided", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthenticationError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + }, + "429": { + "description": "Too many requests. Retry after the number of seconds in the `Retry-After` header.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RateLimitError" + } + } + } + } + }, + "x-speakeasy-group": "wordlist", + "x-speakeasy-name-override": "delete", + "x-speakeasy-mcp": { + "title": "Delete wordlist", + "scopes": [ + "destructive" + ], + "readOnlyHint": false, + "destructiveHint": true + } } }, "/wordlist/{id}/embedding-status": { @@ -10174,13 +10284,15 @@ "const": "unicode_spoofing" }, "signals": { - "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack. A disabled signal is still detected and reported as a label, but does not by itself flag the policy.", + "description": "Per-signal flag toggles. Omitted spoofing signals are enabled; encoding_damage defaults to off because decode damage (U+FFFD) marks a broken pipeline, not an attack, and hidden_lookalike and leetspeak default to off because they are opt-in. A disabled signal is still detected and reported as a label, but does not by itself flag the policy. Lookalike words are only spelled out in the cleaned text when their signal is enabled.", "type": "object", "propertyNames": { "type": "string", "enum": [ "mixed_script", "confusable_word", + "hidden_lookalike", + "leetspeak", "invisible", "zalgo", "illegal", @@ -13528,11 +13640,11 @@ "properties": { "id": { "type": "string", - "description": "The item ID. Use it to resolve or unresolve the item in this queue." + "description": "The item ID: the ID of this submission. Use it, or `contentId`, to resolve or unresolve the item in this queue." }, "contentId": { "type": "string", - "description": "Your content ID, as you sent it to `POST /moderate`." + "description": "Your content ID, as you sent it to `POST /moderate`. Webhooks send it as `item.id`. The resolve endpoints accept it in place of `id`." }, "content": { "anyOf": [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d399d8..6f1c2c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 1.4.0 (2026-10-29) + +Full Changelog: [v1.3.0...v1.4.0](https://github.com/moderation-api/sdk-php/compare/v1.3.0...v1.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 + ## 1.3.0 (2026-10-28) Full Changelog: [v1.2.0...v1.3.0](https://github.com/moderation-api/sdk-php/compare/v1.2.0...v1.3.0) diff --git a/README.md b/README.md index ef3669b..41922ec 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ if ($response->object !== null) { Use `content->submit` to moderate text, images, video, audio, or objects with several fields. All parameters except `content` are optional. -Pass your API key to `setSecurity`. 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, call `setSecurity`. ```php declare(strict_types=1); @@ -105,9 +105,7 @@ require 'vendor/autoload.php'; use ModerationApi\ModerationApi; use ModerationApi\Models\Operations; -$sdk = ModerationApi::builder() - ->setSecurity(getenv('MODAPI_SECRET_KEY')) - ->build(); +$sdk = ModerationApi::builder()->build(); // reads MODAPI_SECRET_KEY // Text $sdk->content->submit(new Operations\SubmitContentRequestBody( @@ -252,10 +250,8 @@ A project key can't call the management API: the API returns `403` with the code ```php use ModerationApi\ModerationApi; -// Project key -$sdk = ModerationApi::builder() - ->setSecurity(getenv('MODAPI_SECRET_KEY')) - ->build(); +// Project key, from MODAPI_SECRET_KEY +$sdk = ModerationApi::builder()->build(); // Organization key $management = ModerationApi::builder() @@ -375,6 +371,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 * [getEmbeddingStatus](docs/sdks/wordlist/README.md#getembeddingstatus) - Get embedding status #### [Wordlist.Words](docs/sdks/words/README.md) @@ -539,7 +536,6 @@ The SDK sends requests with [Guzzle](https://docs.guzzlephp.org). To set a timeo ```php $sdk = ModerationApi::builder() - ->setSecurity(getenv('MODAPI_SECRET_KEY')) ->setClient(new \GuzzleHttp\Client(['timeout' => 10])) ->build(); ``` diff --git a/docs/Models/Components/QueueItem.md b/docs/Models/Components/QueueItem.md index f5c037f..528352e 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. | -| `contentId` | *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. | +| `contentId` | *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` | [Components\QueueItemText\|Components\QueueItemImage\|Components\QueueItemVideo\|Components\QueueItemAudio\|Components\QueueItemObject](../../Models/Components/QueueItemContent.md) | :heavy_check_mark: | The submitted content. | | `labels` | array<[Components\Label](../../Models/Components/Label.md)> | :heavy_check_mark: | The moderation labels of the content. | | `flagged` | *bool* | :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 0000000..599ca0b --- /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 | +| `projectId` | *?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 0000000..ffdfe95 --- /dev/null +++ b/docs/Models/Operations/DeleteWordlistResponse.md @@ -0,0 +1,11 @@ +# DeleteWordlistResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `contentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [\Psr\Http\Message\ResponseInterface](https://www.php-fig.org/psr/psr-7/#33-psrhttpmessageresponseinterface) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `object` | [?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 0000000..53d1963 --- /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` | *bool* | :heavy_check_mark: | Whether the wordlist was deleted | +| `detachedChannelIds` | 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 c20fe88..7b6055b 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. | -| `itemId` | *string* | :heavy_check_mark: | The item ID to resolve. | -| `projectId` | *?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. | +| `itemId` | *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. | +| `projectId` | *?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 0290f2e..f85b571 100644 --- a/docs/Models/Operations/ResolveQueueItemsRequestBody.md +++ b/docs/Models/Operations/ResolveQueueItemsRequestBody.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `itemIds` | array<*string*> | :heavy_check_mark: | The item IDs to resolve. Up to 100. | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `itemIds` | 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 a8eb8a5..31f2fbd 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` | *int* | :heavy_check_mark: | Number of items resolved. | -| `notFoundIds` | 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` | *int* | :heavy_check_mark: | Number of items resolved. | +| `notFoundIds` | 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 a719f8b..8c2a4a0 100644 --- a/docs/Models/Operations/UnicodeSpoofing.md +++ b/docs/Models/Operations/UnicodeSpoofing.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `flag` | *bool* | :heavy_check_mark: | N/A | -| `threshold` | *?float* | :heavy_minus_sign: | N/A | -| `id` | *string* | :heavy_check_mark: | N/A | -| `signals` | array | :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` | *?float* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_check_mark: | N/A | +| `signals` | array | :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 40e66b4..8f47e02 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. | -| `itemId` | *string* | :heavy_check_mark: | The item ID to unresolve. | -| `projectId` | *?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. | +| `itemId` | *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. | +| `projectId` | *?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 9980f5b..38aaefa 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 @@ foreach ($responses as $response) { ## 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 @@ -103,11 +103,11 @@ if ($response->object !== null) { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | The queue ID. | -| `itemId` | *string* | :heavy_check_mark: | The item ID to resolve. | -| `projectId` | *?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. | +| `itemId` | *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. | +| `projectId` | *?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 @@ -126,7 +126,7 @@ if ($response->object !== null) { ## resolveMany -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 @@ -188,7 +188,7 @@ if ($response->object !== null) { ## 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 @@ -221,11 +221,11 @@ if ($response->object !== null) { ### Parameters -| Parameter | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *string* | :heavy_check_mark: | The queue ID. | -| `itemId` | *string* | :heavy_check_mark: | The item ID to unresolve. | -| `projectId` | *?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. | +| `itemId` | *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. | +| `projectId` | *?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 6a051db..02c6ca6 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 * [getEmbeddingStatus](#getembeddingstatus) - Get embedding status ## list @@ -234,6 +235,57 @@ if ($response->object !== null) { | Errors\RateLimitError | 429 | application/json | | Errors\APIException | 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 + + +```php +declare(strict_types=1); + +require 'vendor/autoload.php'; + +use ModerationApi; + +$sdk = ModerationApi\ModerationApi::builder() + ->setSecurity( + '' + ) + ->build(); + + + +$response = $sdk->wordlist->delete( + id: '' +); + +if ($response->object !== null) { + // handle response +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | ID of the wordlist to delete | +| `projectId` | *?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 + +**[?Operations\DeleteWordlistResponse](../../Models/Operations/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\APIException | 4XX, 5XX | \*/\* | + ## getEmbeddingStatus Get the current embedding progress status for a wordlist diff --git a/src/Items.php b/src/Items.php index 9ef4ddd..7a88313 100644 --- a/src/Items.php +++ b/src/Items.php @@ -47,7 +47,7 @@ public function getUrl(string $baseUrl, array $urlVariables): string /** * 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 \ModerationApi\Models\Operations\ListQueueItemsRequest $request * @return \ModerationApi\Models\Operations\ListQueueItemsResponse @@ -232,7 +232,7 @@ private function listIndividual(Operations\ListQueueItemsRequest $request, ?Opti /** * 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 \ModerationApi\Models\Operations\ListQueueItemsRequest $request * @return \Generator<\ModerationApi\Models\Operations\ListQueueItemsResponse> @@ -250,7 +250,7 @@ public function list(Operations\ListQueueItemsRequest $request, ?Options $option /** * 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 string $id * @param string $itemId @@ -383,7 +383,7 @@ public function resolve(string $id, string $itemId, ?string $projectId = null, ? /** * 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 \ModerationApi\Models\Operations\ResolveQueueItemsRequestBody $body * @param string $id @@ -521,7 +521,7 @@ public function resolveMany(Operations\ResolveQueueItemsRequestBody $body, strin /** * 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 string $id * @param string $itemId diff --git a/src/Models/Components/QueueItem.php b/src/Models/Components/QueueItem.php index bc1f4ee..908ca39 100644 --- a/src/Models/Components/QueueItem.php +++ b/src/Models/Components/QueueItem.php @@ -12,7 +12,7 @@ class QueueItem { /** - * 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. * * @var string $id */ @@ -20,7 +20,7 @@ class QueueItem public string $id; /** - * 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`. * * @var string $contentId */ diff --git a/src/Models/Operations/DeleteWordlistRequest.php b/src/Models/Operations/DeleteWordlistRequest.php new file mode 100644 index 0000000..5fccede --- /dev/null +++ b/src/Models/Operations/DeleteWordlistRequest.php @@ -0,0 +1,40 @@ +id = $id; + $this->projectId = $projectId; + } +} \ No newline at end of file diff --git a/src/Models/Operations/DeleteWordlistResponse.php b/src/Models/Operations/DeleteWordlistResponse.php new file mode 100644 index 0000000..7862c07 --- /dev/null +++ b/src/Models/Operations/DeleteWordlistResponse.php @@ -0,0 +1,56 @@ +contentType = $contentType; + $this->statusCode = $statusCode; + $this->rawResponse = $rawResponse; + $this->object = $object; + } +} \ No newline at end of file diff --git a/src/Models/Operations/DeleteWordlistResponseBody.php b/src/Models/Operations/DeleteWordlistResponseBody.php new file mode 100644 index 0000000..e2b9530 --- /dev/null +++ b/src/Models/Operations/DeleteWordlistResponseBody.php @@ -0,0 +1,52 @@ + $detachedChannelIds + */ + #[\Speakeasy\Serializer\Annotation\SerializedName('detachedChannelIds')] + #[\Speakeasy\Serializer\Annotation\Type('array')] + public array $detachedChannelIds; + + /** + * @param string $id + * @param bool $deleted + * @param array $detachedChannelIds + * @phpstan-pure + */ + public function __construct(string $id, bool $deleted, array $detachedChannelIds) + { + $this->id = $id; + $this->deleted = $deleted; + $this->detachedChannelIds = $detachedChannelIds; + } +} \ No newline at end of file diff --git a/src/Models/Operations/ResolveQueueItemRequest.php b/src/Models/Operations/ResolveQueueItemRequest.php index 3df6526..df9c42f 100644 --- a/src/Models/Operations/ResolveQueueItemRequest.php +++ b/src/Models/Operations/ResolveQueueItemRequest.php @@ -20,7 +20,7 @@ class ResolveQueueItemRequest public string $id; /** - * 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. * * @var string $itemId */ diff --git a/src/Models/Operations/ResolveQueueItemsRequestBody.php b/src/Models/Operations/ResolveQueueItemsRequestBody.php index 219d6bf..735e052 100644 --- a/src/Models/Operations/ResolveQueueItemsRequestBody.php +++ b/src/Models/Operations/ResolveQueueItemsRequestBody.php @@ -12,7 +12,7 @@ class ResolveQueueItemsRequestBody { /** - * 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. * * @var array $itemIds */ diff --git a/src/Models/Operations/ResolveQueueItemsResponseBody.php b/src/Models/Operations/ResolveQueueItemsResponseBody.php index a10360f..6506715 100644 --- a/src/Models/Operations/ResolveQueueItemsResponseBody.php +++ b/src/Models/Operations/ResolveQueueItemsResponseBody.php @@ -21,7 +21,7 @@ class ResolveQueueItemsResponseBody public int $resolved; /** - * Item IDs that do not exist in the project. + * IDs from `itemIds` that match no item or content ID in the project. * * @var array $notFoundIds */ diff --git a/src/Models/Operations/UnicodeSpoofing.php b/src/Models/Operations/UnicodeSpoofing.php index ab38037..c1ef0b6 100644 --- a/src/Models/Operations/UnicodeSpoofing.php +++ b/src/Models/Operations/UnicodeSpoofing.php @@ -27,7 +27,7 @@ class UnicodeSpoofing public ?float $threshold = null; /** - * 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. * * @var ?array $signals */ diff --git a/src/Models/Operations/UnresolveQueueItemRequest.php b/src/Models/Operations/UnresolveQueueItemRequest.php index 5a75811..a075c13 100644 --- a/src/Models/Operations/UnresolveQueueItemRequest.php +++ b/src/Models/Operations/UnresolveQueueItemRequest.php @@ -20,7 +20,7 @@ class UnresolveQueueItemRequest public string $id; /** - * 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. * * @var string $itemId */ diff --git a/src/ModerationApiBuilder.php b/src/ModerationApiBuilder.php index ab866ef..2be45bb 100644 --- a/src/ModerationApiBuilder.php +++ b/src/ModerationApiBuilder.php @@ -110,6 +110,13 @@ public function build(): ModerationApi ]); } + if (! $this->sdkConfig->hasSecurity()) { + $secretKey = getenv('MODAPI_SECRET_KEY'); + if (is_string($secretKey) && $secretKey !== '') { + $this->setSecurity($secretKey); + } + } + $this->sdkConfig->defaultClient = $this->sdkConfig->client; if ($this->sdkConfig->hasSecurity()) { $this->sdkConfig->client = Utils\Utils::configureSecurityClient($this->sdkConfig->client, $this->sdkConfig->getSecurity()); diff --git a/src/SDKConfiguration.php b/src/SDKConfiguration.php index c60625c..211e520 100644 --- a/src/SDKConfiguration.php +++ b/src/SDKConfiguration.php @@ -26,11 +26,11 @@ class SDKConfiguration public string $openapiDocVersion = '1.1.0'; - public string $sdkVersion = '1.3.0'; + public string $sdkVersion = '1.4.0'; public string $genVersion = 'internal'; - public string $userAgent = 'speakeasy-sdk/php 1.3.0 internal 1.1.0 moderation-api/sdk-php'; + public string $userAgent = 'speakeasy-sdk/php 1.4.0 internal 1.1.0 moderation-api/sdk-php'; public ?RetryConfig $retryConfig = null; diff --git a/src/Wordlist.php b/src/Wordlist.php index 20cf140..f448e89 100644 --- a/src/Wordlist.php +++ b/src/Wordlist.php @@ -159,6 +159,113 @@ public function create(Operations\CreateWordlistRequestBody $body, ?string $proj } } + /** + * 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 string $id + * @param ?string $projectId + * @return \ModerationApi\Models\Operations\DeleteWordlistResponse + * @throws \ModerationApi\Models\Errors\APIException + */ + public function delete(string $id, ?string $projectId = null, ?Options $options = null): Operations\DeleteWordlistResponse + { + $request = new Operations\DeleteWordlistRequest( + id: $id, + projectId: $projectId, + ); + $baseUrl = $this->sdkConfiguration->getTemplatedServerUrl(); + $url = Utils\Utils::generateUrl($baseUrl, '/wordlist/{id}', Operations\DeleteWordlistRequest::class, $request); + $urlOverride = null; + $httpOptions = ['http_errors' => false]; + $httpOptions = array_merge_recursive($httpOptions, Utils\Utils::getHeaders($request)); + if (! array_key_exists('headers', $httpOptions)) { + $httpOptions['headers'] = []; + } + $httpOptions['headers']['Accept'] = 'application/json'; + $httpOptions['headers']['user-agent'] = $this->sdkConfiguration->userAgent; + $httpRequest = new \GuzzleHttp\Psr7\Request('DELETE', $url); + $hookContext = new HookContext($this->sdkConfiguration, $baseUrl, 'deleteWordlist', null, $this->sdkConfiguration->securitySource); + $httpRequest = $this->sdkConfiguration->hooks->beforeRequest(new Hooks\BeforeRequestContext($hookContext), $httpRequest); + $httpOptions = Utils\Utils::convertHeadersToOptions($httpRequest, $httpOptions); + $httpRequest = Utils\Utils::removeHeaders($httpRequest); + try { + $httpResponse = $this->sdkConfiguration->client->send($httpRequest, $httpOptions); + } catch (\GuzzleHttp\Exception\GuzzleException $error) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), null, $error); + $httpResponse = $res; + } + $contentType = $httpResponse->getHeader('Content-Type')[0] ?? ''; + + if (Utils\Utils::matchStatusCodes($httpResponse->getStatusCode(), ['4XX', '5XX'])) { + $res = $this->sdkConfiguration->hooks->afterError(new Hooks\AfterErrorContext($hookContext), $httpResponse, null); + $httpResponse = $res; + } + + $statusCode = $httpResponse->getStatusCode(); + if (Utils\Utils::matchStatusCodes($statusCode, ['200'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\ModerationApi\Models\Operations\DeleteWordlistResponseBody', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $response = new Operations\DeleteWordlistResponse( + statusCode: $statusCode, + contentType: $contentType, + rawResponse: $httpResponse, + object: $obj); + + return $response; + } else { + throw new \ModerationApi\Models\Errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['401'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\ModerationApi\Models\Errors\AuthenticationError', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $obj->rawResponse = $httpResponse; + throw $obj->toException(); + } else { + throw new \ModerationApi\Models\Errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['404'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\ModerationApi\Models\Errors\NotFoundError', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $obj->rawResponse = $httpResponse; + throw $obj->toException(); + } else { + throw new \ModerationApi\Models\Errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['429'])) { + if (Utils\Utils::matchContentType($contentType, 'application/json')) { + $httpResponse = $this->sdkConfiguration->hooks->afterSuccess(new Hooks\AfterSuccessContext($hookContext), $httpResponse); + + $serializer = Utils\JSON::createSerializer(); + $responseData = (string) $httpResponse->getBody(); + $obj = $serializer->deserialize($responseData, '\ModerationApi\Models\Errors\RateLimitError', 'json', DeserializationContext::create()->setRequireAllRequiredProperties(true)); + $obj->rawResponse = $httpResponse; + throw $obj->toException(); + } else { + throw new \ModerationApi\Models\Errors\APIException('Unknown content type received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['4XX'])) { + throw new \ModerationApi\Models\Errors\APIException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } elseif (Utils\Utils::matchStatusCodes($statusCode, ['5XX'])) { + throw new \ModerationApi\Models\Errors\APIException('API error occurred', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } else { + throw new \ModerationApi\Models\Errors\APIException('Unknown status code received', $statusCode, $httpResponse->getBody()->getContents(), $httpResponse); + } + } + /** * Get wordlist *