cadenya 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +1 -1
  4. data/lib/cadenya/client.rb +14 -0
  5. data/lib/cadenya/internal/cursor_pagination.rb +1 -1
  6. data/lib/cadenya/internal/transport/base_client.rb +2 -0
  7. data/lib/cadenya/models/agent_spec.rb +19 -4
  8. data/lib/cadenya/models/agents/webhook_delivery_data.rb +3 -1
  9. data/lib/cadenya/models/agents/webhook_delivery_list_params.rb +3 -1
  10. data/lib/cadenya/models/approval_requirement_filter.rb +26 -0
  11. data/lib/cadenya/models/attribute_filter.rb +38 -0
  12. data/lib/cadenya/models/objective_create_params.rb +3 -3
  13. data/lib/cadenya/models/objective_data.rb +21 -1
  14. data/lib/cadenya/models/objective_event_data.rb +43 -5
  15. data/lib/cadenya/models/objective_list_events_params.rb +9 -1
  16. data/lib/cadenya/models/objective_list_params.rb +2 -1
  17. data/lib/cadenya/models/objective_status.rb +2 -1
  18. data/lib/cadenya/models/profile_spec.rb +1 -0
  19. data/lib/cadenya/models/string_matcher.rb +47 -0
  20. data/lib/cadenya/models/sub_agent_spawned.rb +35 -0
  21. data/lib/cadenya/models/sub_agent_updated.rb +66 -0
  22. data/lib/cadenya/models/tool_filter.rb +35 -0
  23. data/lib/cadenya/models/tool_set_adapter.rb +7 -1
  24. data/lib/cadenya/models/tool_set_adapter_mcp.rb +11 -33
  25. data/lib/cadenya/models/tool_set_adapter_openapi.rb +79 -0
  26. data/lib/cadenya/models/tool_set_get_openapi_spec_params.rb +26 -0
  27. data/lib/cadenya/models/tool_set_get_openapi_spec_response.rb +17 -0
  28. data/lib/cadenya/models/tool_sets/config_openapi.rb +29 -0
  29. data/lib/cadenya/models/tool_sets/tool_spec_config.rb +7 -1
  30. data/lib/cadenya/models/workspace.rb +27 -1
  31. data/lib/cadenya/models/workspace_admin/member_add_params.rb +39 -0
  32. data/lib/cadenya/models/workspace_admin/member_list_params.rb +39 -0
  33. data/lib/cadenya/models/workspace_admin/member_remove_params.rb +28 -0
  34. data/lib/cadenya/models/workspace_admin/profile_list_params.rb +44 -0
  35. data/lib/cadenya/models/workspace_admin_archive_params.rb +20 -0
  36. data/lib/cadenya/models/workspace_admin_create_params.rb +70 -0
  37. data/lib/cadenya/models/workspace_admin_list_params.rb +42 -0
  38. data/lib/cadenya/models/workspace_admin_retrieve_params.rb +20 -0
  39. data/lib/cadenya/models/workspace_admin_update_params.rb +85 -0
  40. data/lib/cadenya/models/workspace_member.rb +53 -0
  41. data/lib/cadenya/models.rb +29 -3
  42. data/lib/cadenya/resources/objectives.rb +5 -2
  43. data/lib/cadenya/resources/tool_sets.rb +31 -0
  44. data/lib/cadenya/resources/workspace_admin/members.rb +107 -0
  45. data/lib/cadenya/resources/workspace_admin/profiles.rb +54 -0
  46. data/lib/cadenya/resources/workspace_admin.rb +173 -0
  47. data/lib/cadenya/resources/workspaces.rb +4 -0
  48. data/lib/cadenya/version.rb +1 -1
  49. data/lib/cadenya.rb +23 -2
  50. data/rbi/cadenya/client.rbi +13 -0
  51. data/rbi/cadenya/models/agent_spec.rbi +21 -4
  52. data/rbi/cadenya/models/agents/webhook_delivery_data.rbi +15 -5
  53. data/rbi/cadenya/models/agents/webhook_delivery_list_params.rbi +15 -5
  54. data/rbi/cadenya/models/approval_requirement_filter.rbi +45 -0
  55. data/rbi/cadenya/models/attribute_filter.rbi +84 -0
  56. data/rbi/cadenya/models/objective_create_params.rbi +2 -2
  57. data/rbi/cadenya/models/objective_data.rbi +26 -0
  58. data/rbi/cadenya/models/objective_event_data.rbi +68 -9
  59. data/rbi/cadenya/models/objective_list_events_params.rbi +11 -0
  60. data/rbi/cadenya/models/objective_list_params.rbi +7 -2
  61. data/rbi/cadenya/models/objective_status.rbi +4 -2
  62. data/rbi/cadenya/models/profile_spec.rbi +5 -0
  63. data/rbi/cadenya/models/string_matcher.rbi +84 -0
  64. data/rbi/cadenya/models/sub_agent_spawned.rbi +62 -0
  65. data/rbi/cadenya/models/sub_agent_updated.rbi +127 -0
  66. data/rbi/cadenya/models/tool_filter.rbi +66 -0
  67. data/rbi/cadenya/models/tool_set_adapter.rbi +14 -3
  68. data/rbi/cadenya/models/tool_set_adapter_mcp.rbi +16 -62
  69. data/rbi/cadenya/models/tool_set_adapter_openapi.rbi +127 -0
  70. data/rbi/cadenya/models/tool_set_get_openapi_spec_params.rbi +46 -0
  71. data/rbi/cadenya/models/tool_set_get_openapi_spec_response.rbi +33 -0
  72. data/rbi/cadenya/models/tool_sets/config_openapi.rbi +48 -0
  73. data/rbi/cadenya/models/tool_sets/tool_spec_config.rbi +11 -3
  74. data/rbi/cadenya/models/workspace.rbi +39 -3
  75. data/rbi/cadenya/models/workspace_admin/member_add_params.rbi +68 -0
  76. data/rbi/cadenya/models/workspace_admin/member_list_params.rbi +68 -0
  77. data/rbi/cadenya/models/workspace_admin/member_remove_params.rbi +48 -0
  78. data/rbi/cadenya/models/workspace_admin/profile_list_params.rbi +75 -0
  79. data/rbi/cadenya/models/workspace_admin_archive_params.rbi +38 -0
  80. data/rbi/cadenya/models/workspace_admin_create_params.rbi +127 -0
  81. data/rbi/cadenya/models/workspace_admin_list_params.rbi +70 -0
  82. data/rbi/cadenya/models/workspace_admin_retrieve_params.rbi +38 -0
  83. data/rbi/cadenya/models/workspace_admin_update_params.rbi +144 -0
  84. data/rbi/cadenya/models/workspace_member.rbi +80 -0
  85. data/rbi/cadenya/models.rbi +29 -3
  86. data/rbi/cadenya/resources/objectives.rbi +4 -1
  87. data/rbi/cadenya/resources/tool_sets.rbi +18 -0
  88. data/rbi/cadenya/resources/workspace_admin/members.rbi +83 -0
  89. data/rbi/cadenya/resources/workspace_admin/profiles.rbi +42 -0
  90. data/rbi/cadenya/resources/workspace_admin.rbi +131 -0
  91. data/rbi/cadenya/resources/workspaces.rbi +4 -0
  92. data/sig/cadenya/client.rbs +2 -0
  93. data/sig/cadenya/models/agent_spec.rbs +12 -5
  94. data/sig/cadenya/models/agents/webhook_delivery_data.rbs +6 -2
  95. data/sig/cadenya/models/agents/webhook_delivery_list_params.rbs +6 -2
  96. data/sig/cadenya/models/approval_requirement_filter.rbs +20 -0
  97. data/sig/cadenya/models/attribute_filter.rbs +44 -0
  98. data/sig/cadenya/models/objective_create_params.rbs +6 -2
  99. data/sig/cadenya/models/objective_data.rbs +14 -0
  100. data/sig/cadenya/models/objective_event_data.rbs +37 -7
  101. data/sig/cadenya/models/objective_list_events_params.rbs +7 -0
  102. data/sig/cadenya/models/objective_list_params.rbs +4 -2
  103. data/sig/cadenya/models/objective_status.rbs +4 -2
  104. data/sig/cadenya/models/profile_spec.rbs +5 -1
  105. data/sig/cadenya/models/string_matcher.rbs +57 -0
  106. data/sig/cadenya/models/sub_agent_spawned.rbs +36 -0
  107. data/sig/cadenya/models/sub_agent_updated.rbs +66 -0
  108. data/sig/cadenya/models/tool_filter.rbs +41 -0
  109. data/sig/cadenya/models/tool_set_adapter.rbs +15 -3
  110. data/sig/cadenya/models/tool_set_adapter_mcp.rbs +16 -32
  111. data/sig/cadenya/models/tool_set_adapter_openapi.rbs +73 -0
  112. data/sig/cadenya/models/tool_set_get_openapi_spec_params.rbs +28 -0
  113. data/sig/cadenya/models/tool_set_get_openapi_spec_response.rbs +15 -0
  114. data/sig/cadenya/models/tool_sets/config_openapi.rbs +30 -0
  115. data/sig/cadenya/models/tool_sets/tool_spec_config.rbs +12 -3
  116. data/sig/cadenya/models/workspace.rbs +24 -3
  117. data/sig/cadenya/models/workspace_admin/member_add_params.rbs +38 -0
  118. data/sig/cadenya/models/workspace_admin/member_list_params.rbs +38 -0
  119. data/sig/cadenya/models/workspace_admin/member_remove_params.rbs +30 -0
  120. data/sig/cadenya/models/workspace_admin/profile_list_params.rbs +40 -0
  121. data/sig/cadenya/models/workspace_admin_archive_params.rbs +23 -0
  122. data/sig/cadenya/models/workspace_admin_create_params.rbs +58 -0
  123. data/sig/cadenya/models/workspace_admin_list_params.rbs +38 -0
  124. data/sig/cadenya/models/workspace_admin_retrieve_params.rbs +23 -0
  125. data/sig/cadenya/models/workspace_admin_update_params.rbs +76 -0
  126. data/sig/cadenya/models/workspace_member.rbs +46 -0
  127. data/sig/cadenya/models.rbs +29 -3
  128. data/sig/cadenya/resources/objectives.rbs +2 -1
  129. data/sig/cadenya/resources/tool_sets.rbs +6 -0
  130. data/sig/cadenya/resources/workspace_admin/members.rbs +29 -0
  131. data/sig/cadenya/resources/workspace_admin/profiles.rbs +16 -0
  132. data/sig/cadenya/resources/workspace_admin.rbs +42 -0
  133. metadata +71 -8
  134. data/lib/cadenya/models/mcp_tool_filter.rb +0 -111
  135. data/lib/cadenya/models/sub_objective_created.rb +0 -20
  136. data/rbi/cadenya/models/mcp_tool_filter.rbi +0 -235
  137. data/rbi/cadenya/models/sub_objective_created.rbi +0 -36
  138. data/sig/cadenya/models/mcp_tool_filter.rbs +0 -138
  139. data/sig/cadenya/models/sub_objective_created.rbs +0 -15
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ # @see Cadenya::Resources::WorkspaceAdmin#update
6
+ class WorkspaceAdminUpdateParams < Cadenya::Internal::Type::BaseModel
7
+ extend Cadenya::Internal::Type::RequestParameters::Converter
8
+ include Cadenya::Internal::Type::RequestParameters
9
+
10
+ # @!attribute workspace_id
11
+ #
12
+ # @return [String]
13
+ required :workspace_id, String
14
+
15
+ # @!attribute metadata
16
+ # UpdateAccountResourceMetadata contains the user-provided fields for updating an
17
+ # account-scoped resource. Read-only fields (id, account_id, profile_id) are
18
+ # excluded since they are set by the server.
19
+ #
20
+ # @return [Cadenya::Models::WorkspaceAdminUpdateParams::Metadata, nil]
21
+ optional :metadata, -> { Cadenya::WorkspaceAdminUpdateParams::Metadata }
22
+
23
+ # @!attribute spec
24
+ #
25
+ # @return [Cadenya::Models::WorkspaceSpec, nil]
26
+ optional :spec, -> { Cadenya::WorkspaceSpec }
27
+
28
+ # @!attribute update_mask
29
+ # Fields to update.
30
+ #
31
+ # @return [String, nil]
32
+ optional :update_mask, String, api_name: :updateMask
33
+
34
+ # @!method initialize(workspace_id:, metadata: nil, spec: nil, update_mask: nil, request_options: {})
35
+ # Some parameter documentations has been truncated, see
36
+ # {Cadenya::Models::WorkspaceAdminUpdateParams} for more details.
37
+ #
38
+ # @param workspace_id [String]
39
+ #
40
+ # @param metadata [Cadenya::Models::WorkspaceAdminUpdateParams::Metadata] UpdateAccountResourceMetadata contains the user-provided fields for updating
41
+ #
42
+ # @param spec [Cadenya::Models::WorkspaceSpec]
43
+ #
44
+ # @param update_mask [String] Fields to update.
45
+ #
46
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}]
47
+
48
+ class Metadata < Cadenya::Internal::Type::BaseModel
49
+ # @!attribute name
50
+ # Human-readable name for the resource (e.g., "Production API Key", "Staging
51
+ # Workspace")
52
+ #
53
+ # @return [String]
54
+ required :name, String
55
+
56
+ # @!attribute external_id
57
+ # External ID for the resource (e.g., a workflow ID from an external system)
58
+ #
59
+ # @return [String, nil]
60
+ optional :external_id, String, api_name: :externalId
61
+
62
+ # @!attribute labels
63
+ # Arbitrary key-value pairs for categorization and filtering Examples:
64
+ # {"environment": "production", "team": "platform", "version": "v2"}
65
+ #
66
+ # @return [Hash{Symbol=>String}, nil]
67
+ optional :labels, Cadenya::Internal::Type::HashOf[String]
68
+
69
+ # @!method initialize(name:, external_id: nil, labels: nil)
70
+ # Some parameter documentations has been truncated, see
71
+ # {Cadenya::Models::WorkspaceAdminUpdateParams::Metadata} for more details.
72
+ #
73
+ # UpdateAccountResourceMetadata contains the user-provided fields for updating an
74
+ # account-scoped resource. Read-only fields (id, account_id, profile_id) are
75
+ # excluded since they are set by the server.
76
+ #
77
+ # @param name [String] Human-readable name for the resource (e.g., "Production API Key", "Staging Works
78
+ #
79
+ # @param external_id [String] External ID for the resource (e.g., a workflow ID from an external system)
80
+ #
81
+ # @param labels [Hash{Symbol=>String}] Arbitrary key-value pairs for categorization and filtering
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Models
5
+ class WorkspaceMember < Cadenya::Internal::Type::BaseModel
6
+ response_only do
7
+ # @!attribute actor_id
8
+ # The actor row linking the profile to the workspace (the junction record).
9
+ #
10
+ # @return [String]
11
+ required :actor_id, String, api_name: :actorId
12
+
13
+ # @!attribute profile_id
14
+ # The account profile that has access to the workspace.
15
+ #
16
+ # @return [String]
17
+ required :profile_id, String, api_name: :profileId
18
+
19
+ # @!attribute added_at
20
+ # When the member was added to the workspace.
21
+ #
22
+ # @return [Time, nil]
23
+ optional :added_at, Time, api_name: :addedAt
24
+
25
+ # @!attribute email
26
+ # Email address of the member's profile.
27
+ #
28
+ # @return [String, nil]
29
+ optional :email, String
30
+
31
+ # @!attribute name
32
+ # Display name of the member's profile.
33
+ #
34
+ # @return [String, nil]
35
+ optional :name, String
36
+ end
37
+
38
+ # @!method initialize(actor_id:, profile_id:, added_at: nil, email: nil, name: nil)
39
+ # A member of a workspace: the profile granted access plus the actor row that
40
+ # links it to the workspace. Returned by member list/add operations.
41
+ #
42
+ # @param actor_id [String] The actor row linking the profile to the workspace (the junction record).
43
+ #
44
+ # @param profile_id [String] The account profile that has access to the workspace.
45
+ #
46
+ # @param added_at [Time] When the member was added to the workspace.
47
+ #
48
+ # @param email [String] Email address of the member's profile.
49
+ #
50
+ # @param name [String] Display name of the member's profile.
51
+ end
52
+ end
53
+ end
@@ -95,10 +95,14 @@ module Cadenya
95
95
 
96
96
  APIKeyUpdateParams = Cadenya::Models::APIKeyUpdateParams
97
97
 
98
+ ApprovalRequirementFilter = Cadenya::Models::ApprovalRequirementFilter
99
+
98
100
  AssistantMessage = Cadenya::Models::AssistantMessage
99
101
 
100
102
  AssistantToolCall = Cadenya::Models::AssistantToolCall
101
103
 
104
+ AttributeFilter = Cadenya::Models::AttributeFilter
105
+
102
106
  BareMetadata = Cadenya::Models::BareMetadata
103
107
 
104
108
  BulkWorkspaceApply = Cadenya::Models::BulkWorkspaceApply
@@ -125,8 +129,6 @@ module Cadenya
125
129
 
126
130
  CreateResourceMetadata = Cadenya::Models::CreateResourceMetadata
127
131
 
128
- McpToolFilter = Cadenya::Models::McpToolFilter
129
-
130
132
  MemoryEntryItem = Cadenya::Models::MemoryEntryItem
131
133
 
132
134
  MemoryLayer = Cadenya::Models::MemoryLayer
@@ -217,7 +219,11 @@ module Cadenya
217
219
 
218
220
  SearchSearchToolsOrToolSetsParams = Cadenya::Models::SearchSearchToolsOrToolSetsParams
219
221
 
220
- SubObjectiveCreated = Cadenya::Models::SubObjectiveCreated
222
+ StringMatcher = Cadenya::Models::StringMatcher
223
+
224
+ SubAgentSpawned = Cadenya::Models::SubAgentSpawned
225
+
226
+ SubAgentUpdated = Cadenya::Models::SubAgentUpdated
221
227
 
222
228
  SyncCompleted = Cadenya::Models::SyncCompleted
223
229
 
@@ -237,6 +243,8 @@ module Cadenya
237
243
 
238
244
  ToolError = Cadenya::Models::ToolError
239
245
 
246
+ ToolFilter = Cadenya::Models::ToolFilter
247
+
240
248
  ToolResult = Cadenya::Models::ToolResult
241
249
 
242
250
  ToolSet = Cadenya::Models::ToolSet
@@ -247,6 +255,8 @@ module Cadenya
247
255
 
248
256
  ToolSetAdapterMcp = Cadenya::Models::ToolSetAdapterMcp
249
257
 
258
+ ToolSetAdapterOpenAPI = Cadenya::Models::ToolSetAdapterOpenAPI
259
+
250
260
  ToolSetCreateParams = Cadenya::Models::ToolSetCreateParams
251
261
 
252
262
  ToolSetDeleteParams = Cadenya::Models::ToolSetDeleteParams
@@ -257,6 +267,8 @@ module Cadenya
257
267
 
258
268
  ToolSetEventData = Cadenya::Models::ToolSetEventData
259
269
 
270
+ ToolSetGetOpenAPISpecParams = Cadenya::Models::ToolSetGetOpenAPISpecParams
271
+
260
272
  ToolSetInfo = Cadenya::Models::ToolSetInfo
261
273
 
262
274
  ToolSetListEventsParams = Cadenya::Models::ToolSetListEventsParams
@@ -299,10 +311,24 @@ module Cadenya
299
311
 
300
312
  Workspace = Cadenya::Models::Workspace
301
313
 
314
+ WorkspaceAdmin = Cadenya::Models::WorkspaceAdmin
315
+
316
+ WorkspaceAdminArchiveParams = Cadenya::Models::WorkspaceAdminArchiveParams
317
+
318
+ WorkspaceAdminCreateParams = Cadenya::Models::WorkspaceAdminCreateParams
319
+
320
+ WorkspaceAdminListParams = Cadenya::Models::WorkspaceAdminListParams
321
+
322
+ WorkspaceAdminRetrieveParams = Cadenya::Models::WorkspaceAdminRetrieveParams
323
+
324
+ WorkspaceAdminUpdateParams = Cadenya::Models::WorkspaceAdminUpdateParams
325
+
302
326
  WorkspaceGetParams = Cadenya::Models::WorkspaceGetParams
303
327
 
304
328
  WorkspaceListParams = Cadenya::Models::WorkspaceListParams
305
329
 
330
+ WorkspaceMember = Cadenya::Models::WorkspaceMember
331
+
306
332
  WorkspaceSecret = Cadenya::Models::WorkspaceSecret
307
333
 
308
334
  WorkspaceSecretCreateParams = Cadenya::Models::WorkspaceSecretCreateParams
@@ -20,7 +20,7 @@ module Cadenya
20
20
  #
21
21
  # Creates a new objective in the workspace
22
22
  #
23
- # @overload create(workspace_id, agent_id:, data:, metadata:, variation_id: nil, request_options: {})
23
+ # @overload create(workspace_id, agent_id:, data:, metadata: nil, variation_id: nil, request_options: {})
24
24
  #
25
25
  # @param workspace_id [String]
26
26
  #
@@ -269,7 +269,7 @@ module Cadenya
269
269
 
270
270
  # Lists all events for an objective
271
271
  #
272
- # @overload list_events(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, sort_order: nil, window_id: nil, request_options: {})
272
+ # @overload list_events(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, since_event_id: nil, sort_order: nil, window_id: nil, request_options: {})
273
273
  #
274
274
  # @param objective_id [String] Path param: Objective ID for filtering
275
275
  #
@@ -281,6 +281,8 @@ module Cadenya
281
281
  #
282
282
  # @param limit [Integer] Query param: Maximum number of results to return
283
283
  #
284
+ # @param since_event_id [String] Query param: Optional string to fetch events since an ID
285
+ #
284
286
  # @param sort_order [String] Query param: Sort order for results (asc or desc by creation time)
285
287
  #
286
288
  # @param window_id [String] Query param: Optional context window ID to filter events by
@@ -302,6 +304,7 @@ module Cadenya
302
304
  path: ["v1/workspaces/%1$s/objectives/%2$s/events", workspace_id, objective_id],
303
305
  query: query.transform_keys(
304
306
  include_info: "includeInfo",
307
+ since_event_id: "sinceEventId",
305
308
  sort_order: "sortOrder",
306
309
  window_id: "windowId"
307
310
  ),
@@ -184,6 +184,37 @@ module Cadenya
184
184
  )
185
185
  end
186
186
 
187
+ # Some parameter documentations has been truncated, see
188
+ # {Cadenya::Models::ToolSetGetOpenAPISpecParams} for more details.
189
+ #
190
+ # Retrieves the current OpenAPI specification JSON that has been consumed by the
191
+ # tool set. Only applicable to tool sets using the OpenAPI adapter.
192
+ #
193
+ # @overload get_openapi_spec(tool_set_id, workspace_id:, request_options: {})
194
+ #
195
+ # @param tool_set_id [String] Tool set ID. Accepts the canonical ts\_… form or the
196
+ #
197
+ # @param workspace_id [String] Workspace ID.
198
+ #
199
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
200
+ #
201
+ # @return [Cadenya::Models::ToolSetGetOpenAPISpecResponse]
202
+ #
203
+ # @see Cadenya::Models::ToolSetGetOpenAPISpecParams
204
+ def get_openapi_spec(tool_set_id, params)
205
+ parsed, options = Cadenya::ToolSetGetOpenAPISpecParams.dump_request(params)
206
+ workspace_id =
207
+ parsed.delete(:workspace_id) do
208
+ raise ArgumentError.new("missing required path argument #{_1}")
209
+ end
210
+ @client.request(
211
+ method: :get,
212
+ path: ["v1/workspaces/%1$s/tool_sets/%2$s/openapi_spec", workspace_id, tool_set_id],
213
+ model: Cadenya::Models::ToolSetGetOpenAPISpecResponse,
214
+ options: options
215
+ )
216
+ end
217
+
187
218
  # Some parameter documentations has been truncated, see
188
219
  # {Cadenya::Models::ToolSetListEventsParams} for more details.
189
220
  #
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Resources
5
+ class WorkspaceAdmin
6
+ # Administer workspaces across the account: create and archive workspaces and
7
+ # manage their membership. These operations are account-scoped and require the
8
+ # admin role (a token whose profile holds the WorkOS admin role); they live under
9
+ # /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so
10
+ # an admin can manage any workspace in the account, including ones they are not
11
+ # themselves a member of.
12
+ class Members
13
+ # Lists the members of a workspace. Admin only.
14
+ #
15
+ # @overload list(workspace_id, cursor: nil, limit: nil, request_options: {})
16
+ #
17
+ # @param workspace_id [String] The workspace whose members will be listed (path).
18
+ #
19
+ # @param cursor [String] Pagination cursor from previous response
20
+ #
21
+ # @param limit [Integer] Maximum number of results to return
22
+ #
23
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
24
+ #
25
+ # @return [Cadenya::Internal::CursorPagination<Cadenya::Models::WorkspaceMember>]
26
+ #
27
+ # @see Cadenya::Models::WorkspaceAdmin::MemberListParams
28
+ def list(workspace_id, params = {})
29
+ parsed, options = Cadenya::WorkspaceAdmin::MemberListParams.dump_request(params)
30
+ query = Cadenya::Internal::Util.encode_query_params(parsed)
31
+ @client.request(
32
+ method: :get,
33
+ path: ["v1/account/workspaces/%1$s/members", workspace_id],
34
+ query: query,
35
+ page: Cadenya::Internal::CursorPagination,
36
+ model: Cadenya::WorkspaceMember,
37
+ options: options
38
+ )
39
+ end
40
+
41
+ # Grants a profile access to the workspace by creating (or reactivating) the actor
42
+ # that links the profile to the workspace. Accepts either an existing profile_id
43
+ # or an email to resolve-or-invite. Idempotent for an already-active member. Admin
44
+ # only.
45
+ #
46
+ # @overload add(workspace_id, email: nil, profile_id: nil, request_options: {})
47
+ #
48
+ # @param workspace_id [String] The workspace to add the member to (path).
49
+ #
50
+ # @param email [String] Email address to add (resolve-or-invite). Mutually exclusive with profile_id.
51
+ #
52
+ # @param profile_id [String] An existing account profile to add. Mutually exclusive with email.
53
+ #
54
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
55
+ #
56
+ # @return [Cadenya::Models::WorkspaceMember]
57
+ #
58
+ # @see Cadenya::Models::WorkspaceAdmin::MemberAddParams
59
+ def add(workspace_id, params = {})
60
+ parsed, options = Cadenya::WorkspaceAdmin::MemberAddParams.dump_request(params)
61
+ @client.request(
62
+ method: :post,
63
+ path: ["v1/account/workspaces/%1$s/members", workspace_id],
64
+ body: parsed,
65
+ model: Cadenya::WorkspaceMember,
66
+ options: options
67
+ )
68
+ end
69
+
70
+ # Revokes a member's access by deactivating their actor; the member is immediately
71
+ # cut off. The underlying profile is not deleted. Admin only.
72
+ #
73
+ # @overload remove(profile_id, workspace_id:, request_options: {})
74
+ #
75
+ # @param profile_id [String] The profile to remove from the workspace (path).
76
+ #
77
+ # @param workspace_id [String] The workspace to remove the member from (path).
78
+ #
79
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
80
+ #
81
+ # @return [nil]
82
+ #
83
+ # @see Cadenya::Models::WorkspaceAdmin::MemberRemoveParams
84
+ def remove(profile_id, params)
85
+ parsed, options = Cadenya::WorkspaceAdmin::MemberRemoveParams.dump_request(params)
86
+ workspace_id =
87
+ parsed.delete(:workspace_id) do
88
+ raise ArgumentError.new("missing required path argument #{_1}")
89
+ end
90
+ @client.request(
91
+ method: :delete,
92
+ path: ["v1/account/workspaces/%1$s/members/%2$s", workspace_id, profile_id],
93
+ model: NilClass,
94
+ options: options
95
+ )
96
+ end
97
+
98
+ # @api private
99
+ #
100
+ # @param client [Cadenya::Client]
101
+ def initialize(client:)
102
+ @client = client
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Resources
5
+ class WorkspaceAdmin
6
+ # Administer workspaces across the account: create and archive workspaces and
7
+ # manage their membership. These operations are account-scoped and require the
8
+ # admin role (a token whose profile holds the WorkOS admin role); they live under
9
+ # /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so
10
+ # an admin can manage any workspace in the account, including ones they are not
11
+ # themselves a member of.
12
+ class Profiles
13
+ # Some parameter documentations has been truncated, see
14
+ # {Cadenya::Models::WorkspaceAdmin::ProfileListParams} for more details.
15
+ #
16
+ # Searches the account's profiles for a member picker, with free-form name/email
17
+ # search and an optional type filter. Account-scoped; admin only.
18
+ #
19
+ # @overload list(cursor: nil, limit: nil, query: nil, request_options: {})
20
+ #
21
+ # @param cursor [String] Pagination cursor from previous response
22
+ #
23
+ # @param limit [Integer] Maximum number of results to return
24
+ #
25
+ # @param query [String] Free-form search over profile name and email. Case-insensitive substring
26
+ #
27
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
28
+ #
29
+ # @return [Cadenya::Internal::CursorPagination<Cadenya::Models::Profile>]
30
+ #
31
+ # @see Cadenya::Models::WorkspaceAdmin::ProfileListParams
32
+ def list(params = {})
33
+ parsed, options = Cadenya::WorkspaceAdmin::ProfileListParams.dump_request(params)
34
+ query = Cadenya::Internal::Util.encode_query_params(parsed)
35
+ @client.request(
36
+ method: :get,
37
+ path: "v1/account/profiles",
38
+ query: query,
39
+ page: Cadenya::Internal::CursorPagination,
40
+ model: Cadenya::Profile,
41
+ options: options
42
+ )
43
+ end
44
+
45
+ # @api private
46
+ #
47
+ # @param client [Cadenya::Client]
48
+ def initialize(client:)
49
+ @client = client
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,173 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cadenya
4
+ module Resources
5
+ # Administer workspaces across the account: create and archive workspaces and
6
+ # manage their membership. These operations are account-scoped and require the
7
+ # admin role (a token whose profile holds the WorkOS admin role); they live under
8
+ # /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so
9
+ # an admin can manage any workspace in the account, including ones they are not
10
+ # themselves a member of.
11
+ class WorkspaceAdmin
12
+ # Administer workspaces across the account: create and archive workspaces and
13
+ # manage their membership. These operations are account-scoped and require the
14
+ # admin role (a token whose profile holds the WorkOS admin role); they live under
15
+ # /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so
16
+ # an admin can manage any workspace in the account, including ones they are not
17
+ # themselves a member of.
18
+ # @return [Cadenya::Resources::WorkspaceAdmin::Members]
19
+ attr_reader :members
20
+
21
+ # Administer workspaces across the account: create and archive workspaces and
22
+ # manage their membership. These operations are account-scoped and require the
23
+ # admin role (a token whose profile holds the WorkOS admin role); they live under
24
+ # /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so
25
+ # an admin can manage any workspace in the account, including ones they are not
26
+ # themselves a member of.
27
+ # @return [Cadenya::Resources::WorkspaceAdmin::Profiles]
28
+ attr_reader :profiles
29
+
30
+ # Some parameter documentations has been truncated, see
31
+ # {Cadenya::Models::WorkspaceAdminCreateParams} for more details.
32
+ #
33
+ # Creates a new workspace in the account. Admin only.
34
+ #
35
+ # @overload create(metadata:, spec:, request_options: {})
36
+ #
37
+ # @param metadata [Cadenya::Models::WorkspaceAdminCreateParams::Metadata] CreateAccountResourceMetadata contains the user-provided fields for creating
38
+ #
39
+ # @param spec [Cadenya::Models::WorkspaceSpec]
40
+ #
41
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
42
+ #
43
+ # @return [Cadenya::Models::Workspace]
44
+ #
45
+ # @see Cadenya::Models::WorkspaceAdminCreateParams
46
+ def create(params)
47
+ parsed, options = Cadenya::WorkspaceAdminCreateParams.dump_request(params)
48
+ @client.request(
49
+ method: :post,
50
+ path: "v1/account/workspaces",
51
+ body: parsed,
52
+ model: Cadenya::Workspace,
53
+ options: options
54
+ )
55
+ end
56
+
57
+ # Retrieves a workspace in the account by ID. Admin only.
58
+ #
59
+ # @overload retrieve(workspace_id, request_options: {})
60
+ #
61
+ # @param workspace_id [String] Workspace ID to retrieve (path).
62
+ #
63
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
64
+ #
65
+ # @return [Cadenya::Models::Workspace]
66
+ #
67
+ # @see Cadenya::Models::WorkspaceAdminRetrieveParams
68
+ def retrieve(workspace_id, params = {})
69
+ @client.request(
70
+ method: :get,
71
+ path: ["v1/account/workspaces/%1$s", workspace_id],
72
+ model: Cadenya::Workspace,
73
+ options: params[:request_options]
74
+ )
75
+ end
76
+
77
+ # Some parameter documentations has been truncated, see
78
+ # {Cadenya::Models::WorkspaceAdminUpdateParams} for more details.
79
+ #
80
+ # Updates a workspace's metadata (e.g. name) and spec. Admin only.
81
+ #
82
+ # @overload update(workspace_id, metadata: nil, spec: nil, update_mask: nil, request_options: {})
83
+ #
84
+ # @param workspace_id [String] Workspace ID to update (path).
85
+ #
86
+ # @param metadata [Cadenya::Models::WorkspaceAdminUpdateParams::Metadata] UpdateAccountResourceMetadata contains the user-provided fields for updating
87
+ #
88
+ # @param spec [Cadenya::Models::WorkspaceSpec]
89
+ #
90
+ # @param update_mask [String] Fields to update.
91
+ #
92
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
93
+ #
94
+ # @return [Cadenya::Models::Workspace]
95
+ #
96
+ # @see Cadenya::Models::WorkspaceAdminUpdateParams
97
+ def update(workspace_id, params = {})
98
+ parsed, options = Cadenya::WorkspaceAdminUpdateParams.dump_request(params)
99
+ @client.request(
100
+ method: :patch,
101
+ path: ["v1/account/workspaces/%1$s", workspace_id],
102
+ body: parsed,
103
+ model: Cadenya::Workspace,
104
+ options: options
105
+ )
106
+ end
107
+
108
+ # Some parameter documentations has been truncated, see
109
+ # {Cadenya::Models::WorkspaceAdminListParams} for more details.
110
+ #
111
+ # Lists every workspace in the account, optionally including archived ones. Admin
112
+ # only.
113
+ #
114
+ # @overload list(cursor: nil, include_archived: nil, limit: nil, request_options: {})
115
+ #
116
+ # @param cursor [String] Pagination cursor from previous response
117
+ #
118
+ # @param include_archived [Boolean] When true, archived workspaces are included in the results. Defaults to
119
+ #
120
+ # @param limit [Integer] Maximum number of results to return
121
+ #
122
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
123
+ #
124
+ # @return [Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>]
125
+ #
126
+ # @see Cadenya::Models::WorkspaceAdminListParams
127
+ def list(params = {})
128
+ parsed, options = Cadenya::WorkspaceAdminListParams.dump_request(params)
129
+ query = Cadenya::Internal::Util.encode_query_params(parsed)
130
+ @client.request(
131
+ method: :get,
132
+ path: "v1/account/workspaces",
133
+ query: query.transform_keys(include_archived: "includeArchived"),
134
+ page: Cadenya::Internal::CursorPagination,
135
+ model: Cadenya::Workspace,
136
+ options: options
137
+ )
138
+ end
139
+
140
+ # Archives a workspace (soft delete). The workspace is retained, but any
141
+ # subsequent request scoped to it returns a permission error. Archiving the
142
+ # account's last active (non-archived) workspace is not allowed and returns
143
+ # FailedPrecondition. Admin only.
144
+ #
145
+ # @overload archive(workspace_id, request_options: {})
146
+ #
147
+ # @param workspace_id [String] Workspace ID to archive (path).
148
+ #
149
+ # @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
150
+ #
151
+ # @return [nil]
152
+ #
153
+ # @see Cadenya::Models::WorkspaceAdminArchiveParams
154
+ def archive(workspace_id, params = {})
155
+ @client.request(
156
+ method: :delete,
157
+ path: ["v1/account/workspaces/%1$s", workspace_id],
158
+ model: NilClass,
159
+ options: params[:request_options]
160
+ )
161
+ end
162
+
163
+ # @api private
164
+ #
165
+ # @param client [Cadenya::Client]
166
+ def initialize(client:)
167
+ @client = client
168
+ @members = Cadenya::Resources::WorkspaceAdmin::Members.new(client: client)
169
+ @profiles = Cadenya::Resources::WorkspaceAdmin::Profiles.new(client: client)
170
+ end
171
+ end
172
+ end
173
+ end
@@ -4,6 +4,10 @@ module Cadenya
4
4
  module Resources
5
5
  # Manage workspaces within an account. Workspaces provide organizational grouping
6
6
  # and isolation for resources such as agents, tools, and API keys.
7
+ #
8
+ # This is the workspace-scoped, end-user surface. Administrative operations
9
+ # (create / archive workspaces, manage members) live in WorkspaceAdminService
10
+ # under /v1/account/workspaces and require the admin role.
7
11
  class Workspaces
8
12
  # Lists all workspaces for the current account
9
13
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end