Class: ReveAI::Resources::Effects

Inherits:
Base
  • Object
show all
Defined in:
lib/reve_ai/resources/effects.rb

Overview

Note:

The list returns effect names only — effect parameter definitions are not included. Configure effect presets in the Reve application, save them with a name, and apply that name from the API.

Effects listing operations.

Lists the effects available to the project associated with the API key, including saved project effects and built-in presets. Names from this list can be applied to any generation via the postprocessing parameter of the image resources (see Images#create).

Examples:

List all effects

client = ReveAI::Client.new(api_key: "your-key")
result = client.effects.list
result.body[:effects].each { |effect| puts effect[:name] }

See Also:

Constant Summary collapse

LIST_ENDPOINT =

Returns API endpoint for listing effects.

Returns:

  • (String)

    API endpoint for listing effects

"/v1/image/effect"
VALID_SOURCES =

Returns Valid values for the source filter.

Returns:

  • (Array<String>)

    Valid values for the source filter

%w[all project preset].freeze

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ReveAI::Resources::Base

Instance Method Details

#list(source: nil, breadcrumb: nil) ⇒ Response

Lists effects available to the project.

The default response includes both saved project effects (+source+ "saved") and built-in presets (+source+ "builtin"). Each entry in body[:effects] carries name and source, plus optional description and category (e.g., "color", "textures") when available. Use a returned name as effect_name in postprocessing requests.

Examples:

List all effects

result = client.effects.list
result.body[:effects].map { |effect| effect[:name] }

List only saved project effects

result = client.effects.list(source: "project")

Parameters:

  • source (String, nil) (defaults to: nil)

    Filter by effect origin: "all" (default), "project" (saved project effects only), or "preset" (builtin only)

  • breadcrumb (String, nil) (defaults to: nil)

    Request tracking label sent as the breadcrumb query param; ignored by the API, searchable in the Usage page

Returns:

  • (Response)

    Response whose body[:effects] is an Array of effect Hashes with name, source, and optional description and category keys

Raises:

See Also:



59
60
61
62
63
64
65
66
67
# File 'lib/reve_ai/resources/effects.rb', line 59

def list(source: nil, breadcrumb: nil)
  validate_source!(source)

  params = {}
  params[:source] = source if source
  params[:breadcrumb] = breadcrumb if breadcrumb

  get(LIST_ENDPOINT, params: params.empty? ? nil : params)
end