Class: ModerationAPI::Resources::Actions::Execute

Inherits:
Object
  • Object
show all
Defined in:
lib/moderation_api/resources/actions/execute.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Execute

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Execute.

Parameters:



74
75
76
# File 'lib/moderation_api/resources/actions/execute.rb', line 74

def initialize(client:)
  @client = client
end

Instance Method Details

#execute(action_key:, author_ids: nil, content_ids: nil, duration: nil, queue_id: nil, value: nil, request_options: {}) ⇒ ModerationAPI::Models::Actions::ExecuteExecuteResponse

Execute a moderation action on one or more content items.

Parameters:

  • action_key (String)

    ID or key of the action to execute

  • author_ids (Array<String>)

    IDs of the authors to apply the action to. Provide this or contentIds.

  • content_ids (Array<String>)

    IDs of the content items to apply the action to. Provide this or authorIds.

  • duration (Float)

    Optional duration in milliseconds for actions with timeouts

  • queue_id (String)

    Optional queue ID if the action is queue-specific

  • value (String)

    Optional value to provide with the action

  • request_options (ModerationAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
# File 'lib/moderation_api/resources/actions/execute.rb', line 28

def execute(params)
  parsed, options = ModerationAPI::Actions::ExecuteExecuteParams.dump_request(params)
  @client.request(
    method: :post,
    path: "actions/execute",
    body: parsed,
    model: ModerationAPI::Models::Actions::ExecuteExecuteResponse,
    options: options
  )
end

#execute_by_id(action_id, author_ids: nil, content_ids: nil, queue_id: nil, value: nil, request_options: {}) ⇒ ModerationAPI::Models::Actions::ExecuteExecuteByIDResponse

Deprecated.

Execute an action on a set of content items in a queue.

Parameters:

  • action_id (String)

    The ID or key of the action to execute.

  • author_ids (Array<String>)

    IDs of the authors to apply the action to

  • content_ids (Array<String>)

    The IDs of the content items to perform the action on.

  • queue_id (String)

    The ID of the queue the action was performed from if any.

  • value (String)

    The value of the action. Useful to set a reason for the action etc.

  • request_options (ModerationAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



60
61
62
63
64
65
66
67
68
69
# File 'lib/moderation_api/resources/actions/execute.rb', line 60

def execute_by_id(action_id, params = {})
  parsed, options = ModerationAPI::Actions::ExecuteExecuteByIDParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["actions/%1$s/execute", action_id],
    body: parsed,
    model: ModerationAPI::Models::Actions::ExecuteExecuteByIDResponse,
    options: options
  )
end