You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ef994b6
Browse filesBrowse the repository at this point in the historyBrowse files
A new major version of the Ruby SDK. Read the breaking changes before you upgrade.
4
+
5
+
```bash
6
+
gem install moderation_api -v "~> 3.0"
7
+
```
8
+
9
+
### Ruby-specific changes
10
+
11
+
- The module is `ModerationApi` (was `ModerationAPI`). Create the client with `ModerationApi::ModerationApi.new(secret_key: ENV.fetch("MODAPI_SECRET_KEY"))`.
12
+
- Requests are typed objects, for example `Operations::SubmitContentRequest.new(content: Operations::TextRequest.new(text: "..."))`, and responses carry the result in `.object`. Sorbet type signatures are included.
13
+
- Verify webhooks with `require "moderation_api/webhook_signature"` and `ModerationApi::WebhookSignature.construct_event(payload, signature)`.
14
+
### What's new
15
+
16
+
-**Covers the whole API**, including the management API (`projects`, `channels`), wordlists and the review queue.
17
+
-**Automatic pagination.** List methods return an iterator that fetches the next page for you.
18
+
-**Clear errors.** One error class per HTTP status (`BadRequestError`, `NotFoundError`, `RateLimitError`, ...). Every error has a specific `code` (for example `invalid_api_key`, `quota_exceeded` or `author_not_found`), a `request_id` and a `doc_url`. See [Errors](https://docs.moderationapi.com/api-reference/errors).
19
+
-**Retries** with exponential backoff on `429` and `5xx`, and timeouts per client or per request.
20
+
-**Webhook verification** that reads the secret from `MODAPI_WEBHOOK_SECRET`.
21
+
22
+
### Breaking changes
23
+
24
+
The SDK is now generated from our OpenAPI spec with a new generator. Most calls keep their names, but check these:
25
+
26
+
-**List responses** are `{ data, pagination }` instead of a plain array or a resource-specific shape, and list methods take `page` and `pageSize`.
27
+
-**Errors** have a new body: `code` is the specific error code, not the HTTP category. The old `data` field is gone.
28
+
-**Renamed:**`account.list` is now `account.retrieve`, and `actions.execute.execute` is now `actions.execute`.
29
+
-**Removed:**`actions.execute.executeByID` (use `actions.execute` with `actionId` or `actionKey`), `auth.*`, and `content.stream` (see [Real-time voice](https://docs.moderationapi.com/content-moderation/real-time-voice)).
30
+
-**Organization keys** work only with `projects` and `channels`; project keys work with everything else. Use one client per key. See the README.
0 commit comments