Class: Vellum::FolderEntitiesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/folder_entities/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ FolderEntitiesClient

Parameters:



12
13
14
15
# File 'lib/vellum_ai/folder_entities/client.rb', line 12

def initialize(request_client:)
  # @type [RequestClient]
  @request_client = request_client
end

Instance Attribute Details

#request_clientObject (readonly)

Returns the value of attribute request_client.



8
9
10
# File 'lib/vellum_ai/folder_entities/client.rb', line 8

def request_client
  @request_client
end

Instance Method Details

#add_entity_to_folder(folder_id:, entity_id:, request_options: nil) ⇒ Void

Add an entity to a specific folder or root directory.

Adding an entity to a folder will remove it from any other folders it might have been a member of.

Parameters:

  • folder_id (String)

    The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root directory (e.g. “PROMPT_SANDBOX”).

  • entity_id (String)

    The ID of the entity you would like to move.

  • request_options (RequestOptions) (defaults to: nil)

Returns:

  • (Void)


25
26
27
28
29
30
31
32
33
# File 'lib/vellum_ai/folder_entities/client.rb', line 25

def add_entity_to_folder(folder_id:, entity_id:, request_options: nil)
  @request_client.conn.post do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
    req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
    req.body = { **(request_options&.additional_body_parameters || {}), entity_id: entity_id }.compact
    req.url "#{@request_client.default_environment[:Default]}/v1/folders/#{folder_id}/add-entity"
  end
end