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.

This is the workspace-scoped, end-user surface. Administrative operations (create / archive workspaces, manage members) live in WorkspaceAdminService under /v1/account/workspaces and require the admin role.

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:



64
65
66
# File 'lib/cadenya/resources/workspaces.rb', line 64

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:



52
53
54
55
56
57
58
59
# File 'lib/cadenya/resources/workspaces.rb', line 52

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:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cadenya/resources/workspaces.rb', line 29

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