Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,44 @@ on:
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/moderation-api-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/moderation-api-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: moderation_api
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.9.0"
".": "2.9.1"
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 2.9.1 (2026-03-07)

Full Changelog: [v2.9.0...v2.9.1](https://github.com/moderation-api/sdk-ruby/compare/v2.9.0...v2.9.1)

### Chores

* **ci:** add build step ([5c55bf8](https://github.com/moderation-api/sdk-ruby/commit/5c55bf8514f2c832772d10e7b55ba72eae983de2))
* **ci:** skip uploading artifacts on stainless-internal branches ([3228178](https://github.com/moderation-api/sdk-ruby/commit/3228178bf38e7382080b702b25be5b9007b522ea))
* **internal:** codegen related update ([1ba0c9c](https://github.com/moderation-api/sdk-ruby/commit/1ba0c9c906772f0ea6e7e06d88ceaf30f0677f84))
* **internal:** codegen related update ([9f1e242](https://github.com/moderation-api/sdk-ruby/commit/9f1e24274f62d4fb313ca30e267a5496c97a9339))

## 2.9.0 (2026-03-03)

Full Changelog: [v2.8.1...v2.9.0](https://github.com/moderation-api/sdk-ruby/compare/v2.8.1...v2.9.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
moderation_api (2.9.0)
moderation_api (2.9.1)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "moderation_api", "~> 2.9.0"
gem "moderation_api", "~> 2.9.1"
```

<!-- x-release-please-end -->
Expand Down
31 changes: 31 additions & 0 deletions lib/moderation_api/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/action_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ class ActionDeleteParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# The ID of the action to delete.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String] The ID of the action to delete.
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/action_retrieve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ class ActionRetrieveParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# The ID of the action to get.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String] The ID of the action to get.
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/action_update_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class ActionUpdateParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!attribute id
# The ID of the action to update.
#
# @return [String]
required :id, String

# @!attribute built_in
# Whether the action is a built-in action or a custom one.
#
Expand Down Expand Up @@ -92,10 +98,12 @@ class ActionUpdateParams < ModerationAPI::Internal::Type::BaseModel
optional :webhooks,
-> { ModerationAPI::Internal::Type::ArrayOf[ModerationAPI::ActionUpdateParams::Webhook] }

# @!method initialize(built_in: nil, description: nil, filter_in_queue_ids: nil, free_text: nil, key: nil, name: nil, position: nil, possible_values: nil, queue_behaviour: nil, type: nil, value_required: nil, webhooks: nil, request_options: {})
# @!method initialize(id:, built_in: nil, description: nil, filter_in_queue_ids: nil, free_text: nil, key: nil, name: nil, position: nil, possible_values: nil, queue_behaviour: nil, type: nil, value_required: nil, webhooks: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {ModerationAPI::Models::ActionUpdateParams} for more details.
#
# @param id [String] The ID of the action to update.
#
# @param built_in [Boolean, nil] Whether the action is a built-in action or a custom one.
#
# @param description [String, nil] The description of the action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class ExecuteExecuteByIDParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!attribute action_id
# The ID or key of the action to execute.
#
# @return [String]
required :action_id, String

# @!attribute author_ids
# IDs of the authors to apply the action to
#
Expand All @@ -32,7 +38,9 @@ class ExecuteExecuteByIDParams < ModerationAPI::Internal::Type::BaseModel
# @return [String, nil]
optional :value, String

# @!method initialize(author_ids: nil, content_ids: nil, queue_id: nil, value: nil, request_options: {})
# @!method initialize(action_id:, author_ids: nil, content_ids: nil, queue_id: nil, value: nil, request_options: {})
# @param action_id [String] The ID or key of the action to execute.
#
# @param author_ids [Array<String>] IDs of the authors to apply the action to
#
# @param content_ids [Array<String>] The IDs of the content items to perform the action on.
Expand Down
8 changes: 7 additions & 1 deletion lib/moderation_api/models/author_delete_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class AuthorDeleteParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String]
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/author_retrieve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ class AuthorRetrieveParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# Either external ID or the ID assigned by moderation API.
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String] Either external ID or the ID assigned by moderation API.
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/author_update_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class AuthorUpdateParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!attribute id
# Either external ID or the ID assigned by moderation API.
#
# @return [String]
required :id, String

# @!attribute email
# Author email address
#
Expand Down Expand Up @@ -55,10 +61,12 @@ class AuthorUpdateParams < ModerationAPI::Internal::Type::BaseModel
# @return [String, nil]
optional :profile_picture, String, nil?: true

# @!method initialize(email: nil, external_link: nil, first_seen: nil, last_seen: nil, manual_trust_level: nil, metadata: nil, name: nil, profile_picture: nil, request_options: {})
# @!method initialize(id:, email: nil, external_link: nil, first_seen: nil, last_seen: nil, manual_trust_level: nil, metadata: nil, name: nil, profile_picture: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {ModerationAPI::Models::AuthorUpdateParams} for more details.
#
# @param id [String] Either external ID or the ID assigned by moderation API.
#
# @param email [String, nil] Author email address
#
# @param external_link [String, nil] URL of the author's external profile
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/queue/item_list_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ class ItemListParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!attribute id
# The queue ID
#
# @return [String]
required :id, String

# @!attribute after_date
#
# @return [String, nil]
Expand Down Expand Up @@ -66,7 +72,9 @@ class ItemListParams < ModerationAPI::Internal::Type::BaseModel
# @return [Symbol, ModerationAPI::Models::Queue::ItemListParams::SortField, nil]
optional :sort_field, enum: -> { ModerationAPI::Queue::ItemListParams::SortField }

# @!method initialize(after_date: nil, author_id: nil, before_date: nil, conversation_ids: nil, filtered_action_ids: nil, include_resolved: nil, labels: nil, page_number: nil, page_size: nil, sort_direction: nil, sort_field: nil, request_options: {})
# @!method initialize(id:, after_date: nil, author_id: nil, before_date: nil, conversation_ids: nil, filtered_action_ids: nil, include_resolved: nil, labels: nil, page_number: nil, page_size: nil, sort_direction: nil, sort_field: nil, request_options: {})
# @param id [String] The queue ID
#
# @param after_date [String]
#
# @param author_id [String]
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/queue/item_resolve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ class ItemResolveParams < ModerationAPI::Internal::Type::BaseModel
# @return [String]
required :id, String

# @!attribute item_id
# The item ID to resolve
#
# @return [String]
required :item_id, String

# @!attribute comment
# Optional comment
#
# @return [String, nil]
optional :comment, String

# @!method initialize(id:, comment: nil, request_options: {})
# @!method initialize(id:, item_id:, comment: nil, request_options: {})
# @param id [String] The queue ID
#
# @param item_id [String] The item ID to resolve
#
# @param comment [String] Optional comment
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/queue/item_unresolve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ class ItemUnresolveParams < ModerationAPI::Internal::Type::BaseModel
# @return [String]
required :id, String

# @!attribute item_id
# The item ID to unresolve
#
# @return [String]
required :item_id, String

# @!attribute comment
# Optional reason for unresolving the item
#
# @return [String, nil]
optional :comment, String

# @!method initialize(id:, comment: nil, request_options: {})
# @!method initialize(id:, item_id:, comment: nil, request_options: {})
# @param id [String] The queue ID
#
# @param item_id [String] The item ID to unresolve
#
# @param comment [String] Optional reason for unresolving the item
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/queue_get_stats_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ class QueueGetStatsParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!attribute id
# The queue ID
#
# @return [String]
required :id, String

# @!attribute within_days
# Number of days to analyze statistics for
#
# @return [String, nil]
optional :within_days, String

# @!method initialize(within_days: nil, request_options: {})
# @!method initialize(id:, within_days: nil, request_options: {})
# @param id [String] The queue ID
#
# @param within_days [String] Number of days to analyze statistics for
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
Expand Down
10 changes: 9 additions & 1 deletion lib/moderation_api/models/queue_retrieve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ class QueueRetrieveParams < ModerationAPI::Internal::Type::BaseModel
extend ModerationAPI::Internal::Type::RequestParameters::Converter
include ModerationAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute id
# The queue ID
#
# @return [String]
required :id, String

# @!method initialize(id:, request_options: {})
# @param id [String] The queue ID
#
# @param request_options [ModerationAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
Loading