Skip to content
Merged
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.10.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 27
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-fb621278289bf54b9c00e8cadce0cc9fa89506ec908464fdb99d66620a953f0a.yml
openapi_spec_hash: c2a3e2de6f910fc28c7ccd88bf722e06
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api%2Fmoderation-api-ad93e48ef2ee1066fe81553c7ac1f3be24037c6e1976778acb8b13baedbe5821.yml
openapi_spec_hash: 06e01ccb380f068bff3a571b58089a94
config_hash: 6b825a08e19dfb747c5dc1766502b789
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 2.10.0 (2026-03-16)

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

### Features

* **api:** api update ([d94c8d8](https://github.com/moderation-api/sdk-ruby/commit/d94c8d849f906261048e483206e4688307e04a27))


### 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.10.0)
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.10.0"
```

<!-- 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
Loading