Class: Cadenya::Resources::Workspaces
- Inherits:
-
Object
- Object
- Cadenya::Resources::Workspaces
- 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
-
#get(request_options: {}) ⇒ Cadenya::Models::Workspace
Retrieves the workspace associated with the current API token.
-
#initialize(client:) ⇒ Workspaces
constructor
private
A new instance of Workspaces.
-
#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.
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.
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.
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
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cadenya/resources/workspaces.rb', line 25 def list(params = {}) parsed, = 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: ) end |