Class: Cadenya::Resources::Workspaces

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/workspaces.rb

Overview

Manage workspaces within an account. Workspaces provide organizational grouping and isolation for resources such as agents, tools, and API keys.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Workspaces

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 Workspaces.

Parameters:



60
61
62
# File 'lib/cadenya/resources/workspaces.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#get(request_options: {}) ⇒ Cadenya::Models::Workspace

Retrieves the workspace associated with the current API token. Useful for workspace-scoped tokens to identify which workspace they belong to.

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
# File 'lib/cadenya/resources/workspaces.rb', line 48

def get(params = {})
  @client.request(
    method: :get,
    path: "v1/workspaces/current",
    model: Cadenya::Workspace,
    options: params[:request_options]
  )
end

#list(cursor: nil, include_info: nil, limit: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>

Lists all workspaces for the current account

Parameters:

  • cursor (String)

    Pagination cursor from previous response

  • include_info (Boolean)

    When set to true you may use more of your alloted API rate-limit

  • limit (Integer)

    Maximum number of results to return

  • sort_order (String)

    Sort order for results (asc or desc by creation time)

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cadenya/resources/workspaces.rb', line 25

def list(params = {})
  parsed, options = Cadenya::WorkspaceListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/workspaces",
    query: query.transform_keys(include_info: "includeInfo", sort_order: "sortOrder"),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::Workspace,
    options: options
  )
end