workos 10.2.1 → 10.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 (216) hide show
  1. checksums.yaml +4 -4
  2. data/.last-synced-sha +1 -1
  3. data/.oagen-manifest.json +311 -0
  4. data/.release-please-manifest.json +1 -1
  5. data/CHANGELOG.md +154 -0
  6. data/Gemfile.lock +2 -2
  7. data/lib/workos/agents/agent_blueprint.rb +43 -0
  8. data/lib/workos/agents/agent_blueprint_invocable_by.rb +7 -0
  9. data/lib/workos/agents/agent_blueprint_session_setting.rb +25 -0
  10. data/lib/workos/agents/agent_blueprints_create_request.rb +31 -0
  11. data/lib/workos/agents/agent_blueprints_create_request_invocable_by.rb +22 -0
  12. data/lib/workos/agents/agent_blueprints_create_request_session_setting.rb +7 -0
  13. data/lib/workos/agents/agent_blueprints_token_mint_token_request.rb +34 -0
  14. data/lib/workos/agents/agent_blueprints_token_validate_token_request.rb +18 -0
  15. data/lib/workos/agents/agent_blueprints_update_request.rb +31 -0
  16. data/lib/workos/agents/agent_blueprints_update_request_invocable_by.rb +7 -0
  17. data/lib/workos/agents/agent_blueprints_update_request_session_setting.rb +25 -0
  18. data/lib/workos/agents/agent_instance.rb +40 -0
  19. data/lib/workos/agents/agent_instance_session.rb +40 -0
  20. data/lib/workos/agents/agent_token.rb +40 -0
  21. data/lib/workos/agents/agent_token_validation.rb +40 -0
  22. data/lib/workos/agents.rb +395 -0
  23. data/lib/workos/api_keys/validate_api_key.rb +1 -12
  24. data/lib/workos/audit_logs.rb +23 -5
  25. data/lib/workos/authorization.rb +3 -3
  26. data/lib/workos/client.rb +4 -0
  27. data/lib/workos/inflections.rb +15 -0
  28. data/lib/workos/organizations/create_it_contact.rb +18 -0
  29. data/lib/workos/organizations/invite_it_contact.rb +18 -0
  30. data/lib/workos/organizations/it_contact.rb +31 -0
  31. data/lib/workos/organizations/it_contact_list.rb +25 -0
  32. data/lib/workos/organizations/organization_input.rb +10 -1
  33. data/lib/workos/organizations/update_audit_logs_retention.rb +13 -1
  34. data/lib/workos/organizations.rb +110 -1
  35. data/lib/workos/platform_teams/create_team.rb +22 -0
  36. data/lib/workos/platform_teams/team.rb +37 -0
  37. data/lib/workos/platform_teams.rb +58 -0
  38. data/lib/workos/shared/agent_blueprint_created.rb +34 -0
  39. data/lib/workos/shared/agent_blueprint_created_data.rb +43 -0
  40. data/lib/workos/shared/agent_blueprint_created_data_invocable_by.rb +22 -0
  41. data/lib/workos/shared/agent_blueprint_created_data_session_setting.rb +25 -0
  42. data/lib/workos/shared/agent_blueprint_deleted.rb +34 -0
  43. data/lib/workos/shared/agent_blueprint_deleted_data.rb +31 -0
  44. data/lib/workos/shared/agent_blueprint_updated.rb +34 -0
  45. data/lib/workos/shared/agent_blueprint_updated_data.rb +7 -0
  46. data/lib/workos/shared/agent_blueprint_updated_data_invocable_by.rb +7 -0
  47. data/lib/workos/shared/agent_blueprint_updated_data_session_setting.rb +7 -0
  48. data/lib/workos/shared/agent_instance_created.rb +34 -0
  49. data/lib/workos/shared/agent_instance_created_data.rb +40 -0
  50. data/lib/workos/shared/agent_instance_deleted.rb +34 -0
  51. data/lib/workos/shared/agent_instance_deleted_data.rb +40 -0
  52. data/lib/workos/shared/agent_instance_session_created.rb +34 -0
  53. data/lib/workos/shared/agent_instance_session_created_data.rb +43 -0
  54. data/lib/workos/shared/agent_instance_session_revoked.rb +34 -0
  55. data/lib/workos/shared/agent_instance_session_revoked_data.rb +40 -0
  56. data/lib/workos/shared/resource_export_completed.rb +34 -0
  57. data/lib/workos/shared/resource_export_completed_data.rb +22 -0
  58. data/lib/workos/shared/resource_export_created.rb +34 -0
  59. data/lib/workos/shared/resource_export_created_data.rb +22 -0
  60. data/lib/workos/shared/resource_export_downloaded.rb +34 -0
  61. data/lib/workos/shared/resource_export_downloaded_data.rb +22 -0
  62. data/lib/workos/shared/resource_export_failed.rb +34 -0
  63. data/lib/workos/shared/resource_export_failed_data.rb +22 -0
  64. data/lib/workos/shared/waitlist_user.rb +8 -5
  65. data/lib/workos/sso/create_connection.rb +37 -0
  66. data/lib/workos/sso/create_connection_attribute_maps.rb +22 -0
  67. data/lib/workos/sso/create_connection_key_pair.rb +22 -0
  68. data/lib/workos/sso/create_connection_oidc_options.rb +43 -0
  69. data/lib/workos/sso/create_connection_saml_options.rb +40 -0
  70. data/lib/workos/sso/create_connection_standard_attributes.rb +34 -0
  71. data/lib/workos/sso/create_saml_idp_signing_certificate.rb +18 -0
  72. data/lib/workos/sso/patch_connection.rb +34 -0
  73. data/lib/workos/sso/patch_connection_attribute_maps.rb +22 -0
  74. data/lib/workos/sso/patch_connection_oidc_options.rb +40 -0
  75. data/lib/workos/sso/patch_connection_saml_options.rb +31 -0
  76. data/lib/workos/sso/patch_connection_standard_attributes.rb +7 -0
  77. data/lib/workos/sso/saml_idp_signing_certificate.rb +34 -0
  78. data/lib/workos/sso/saml_idp_signing_certificate_list.rb +22 -0
  79. data/lib/workos/sso/saml_sp_encryption_certificate.rb +34 -0
  80. data/lib/workos/sso/saml_sp_encryption_certificate_list.rb +22 -0
  81. data/lib/workos/sso/saml_sp_signing_certificate.rb +34 -0
  82. data/lib/workos/sso/token_query.rb +11 -2
  83. data/lib/workos/sso.rb +305 -4
  84. data/lib/workos/types/agent_blueprints_token_mint_token_request_type.rb +15 -0
  85. data/lib/workos/types/agent_instance_created_data_type.rb +13 -0
  86. data/lib/workos/types/agent_instance_deleted_data_type.rb +9 -0
  87. data/lib/workos/types/agent_instance_session_status.rb +14 -0
  88. data/lib/workos/types/agent_instance_type.rb +9 -0
  89. data/lib/workos/types/authenticate_response_authentication_method.rb +1 -4
  90. data/lib/workos/types/connection_activated_data_connection_type.rb +1 -4
  91. data/lib/workos/types/connection_type.rb +1 -4
  92. data/lib/workos/types/connections_connection_type.rb +1 -4
  93. data/lib/workos/types/create_connection_oidc_options_id_token_signature_algorithm.rb +24 -0
  94. data/lib/workos/types/create_connection_oidc_options_token_authentication_method.rb +14 -0
  95. data/lib/workos/types/create_webhook_endpoint_events.rb +8 -1
  96. data/lib/workos/types/invite_it_contact_intents.rb +16 -0
  97. data/lib/workos/types/patch_connection_oidc_options_id_token_signature_algorithm.rb +9 -0
  98. data/lib/workos/types/patch_connection_oidc_options_token_authentication_method.rb +9 -0
  99. data/lib/workos/types/resource_export_completed_data_resource_type.rb +16 -0
  100. data/lib/workos/types/resource_export_created_data_resource_type.rb +9 -0
  101. data/lib/workos/types/resource_export_downloaded_data_resource_type.rb +9 -0
  102. data/lib/workos/types/resource_export_failed_data_resource_type.rb +9 -0
  103. data/lib/workos/types/session_created_data_status.rb +1 -6
  104. data/lib/workos/types/session_revoked_data_status.rb +1 -1
  105. data/lib/workos/types/sso_grant_type.rb +13 -0
  106. data/lib/workos/types/team_production_state.rb +15 -0
  107. data/lib/workos/types/token_query_grant_type.rb +9 -0
  108. data/lib/workos/types/update_audit_logs_retention_retention_period.rb +32 -0
  109. data/lib/workos/types/user_identities_get_item_provider.rb +1 -4
  110. data/lib/workos/types/user_management_waitlists_state.rb +14 -0
  111. data/lib/workos/types/user_sessions_status.rb +1 -1
  112. data/lib/workos/types/waitlist_entry_state.rb +9 -0
  113. data/lib/workos/types/waitlist_user_state.rb +1 -6
  114. data/lib/workos/user_management/authentication_oauth_failed_data.rb +5 -2
  115. data/lib/workos/user_management/authentication_oauth_succeeded_data.rb +5 -2
  116. data/lib/workos/user_management/create_password_reset_token.rb +1 -12
  117. data/lib/workos/user_management/create_waitlist_entry.rb +25 -0
  118. data/lib/workos/user_management/email_completion_session_authenticate_request.rb +43 -0
  119. data/lib/workos/user_management/waitlist.rb +28 -0
  120. data/lib/workos/user_management/waitlist_entry.rb +43 -0
  121. data/lib/workos/user_management.rb +176 -0
  122. data/lib/workos/version.rb +1 -1
  123. data/lib/workos.rb +1 -0
  124. data/rbi/workos/agent_blueprint.rbi +72 -0
  125. data/rbi/workos/agent_blueprint_created.rbi +54 -0
  126. data/rbi/workos/agent_blueprint_created_data.rbi +72 -0
  127. data/rbi/workos/agent_blueprint_created_data_invocable_by.rbi +30 -0
  128. data/rbi/workos/agent_blueprint_created_data_session_setting.rbi +36 -0
  129. data/rbi/workos/agent_blueprint_deleted.rbi +54 -0
  130. data/rbi/workos/agent_blueprint_deleted_data.rbi +48 -0
  131. data/rbi/workos/agent_blueprint_invocable_by.rbi +30 -0
  132. data/rbi/workos/agent_blueprint_session_setting.rbi +36 -0
  133. data/rbi/workos/agent_blueprint_updated.rbi +54 -0
  134. data/rbi/workos/agent_blueprint_updated_data.rbi +72 -0
  135. data/rbi/workos/agent_blueprint_updated_data_invocable_by.rbi +30 -0
  136. data/rbi/workos/agent_blueprint_updated_data_session_setting.rbi +36 -0
  137. data/rbi/workos/agent_blueprints_create_request.rbi +48 -0
  138. data/rbi/workos/agent_blueprints_create_request_invocable_by.rbi +30 -0
  139. data/rbi/workos/agent_blueprints_create_request_session_setting.rbi +36 -0
  140. data/rbi/workos/agent_blueprints_token_mint_token_request.rbi +54 -0
  141. data/rbi/workos/agent_blueprints_token_validate_token_request.rbi +24 -0
  142. data/rbi/workos/agent_blueprints_update_request.rbi +48 -0
  143. data/rbi/workos/agent_blueprints_update_request_invocable_by.rbi +30 -0
  144. data/rbi/workos/agent_blueprints_update_request_session_setting.rbi +36 -0
  145. data/rbi/workos/agent_instance.rbi +66 -0
  146. data/rbi/workos/agent_instance_created.rbi +54 -0
  147. data/rbi/workos/agent_instance_created_data.rbi +66 -0
  148. data/rbi/workos/agent_instance_deleted.rbi +54 -0
  149. data/rbi/workos/agent_instance_deleted_data.rbi +66 -0
  150. data/rbi/workos/agent_instance_session.rbi +66 -0
  151. data/rbi/workos/agent_instance_session_created.rbi +54 -0
  152. data/rbi/workos/agent_instance_session_created_data.rbi +72 -0
  153. data/rbi/workos/agent_instance_session_revoked.rbi +54 -0
  154. data/rbi/workos/agent_instance_session_revoked_data.rbi +66 -0
  155. data/rbi/workos/agent_token.rbi +66 -0
  156. data/rbi/workos/agent_token_validation.rbi +66 -0
  157. data/rbi/workos/agents.rbi +133 -0
  158. data/rbi/workos/audit_logs.rbi +26 -2
  159. data/rbi/workos/authentication_oauth_failed_data.rbi +6 -0
  160. data/rbi/workos/authentication_oauth_succeeded_data.rbi +6 -0
  161. data/rbi/workos/client.rbi +3 -0
  162. data/rbi/workos/create_connection.rbi +60 -0
  163. data/rbi/workos/create_connection_attribute_maps.rbi +30 -0
  164. data/rbi/workos/create_connection_key_pair.rbi +30 -0
  165. data/rbi/workos/create_connection_oidc_options.rbi +72 -0
  166. data/rbi/workos/create_connection_saml_options.rbi +66 -0
  167. data/rbi/workos/create_connection_standard_attributes.rbi +54 -0
  168. data/rbi/workos/create_it_contact.rbi +24 -0
  169. data/rbi/workos/create_saml_idp_signing_certificate.rbi +24 -0
  170. data/rbi/workos/create_team.rbi +30 -0
  171. data/rbi/workos/create_waitlist_entry.rbi +36 -0
  172. data/rbi/workos/email_completion_session_authenticate_request.rbi +72 -0
  173. data/rbi/workos/invite_it_contact.rbi +24 -0
  174. data/rbi/workos/it_contact.rbi +48 -0
  175. data/rbi/workos/organizations.rbi +45 -0
  176. data/rbi/workos/patch_connection.rbi +54 -0
  177. data/rbi/workos/patch_connection_attribute_maps.rbi +30 -0
  178. data/rbi/workos/patch_connection_oidc_options.rbi +66 -0
  179. data/rbi/workos/patch_connection_saml_options.rbi +48 -0
  180. data/rbi/workos/patch_connection_standard_attributes.rbi +54 -0
  181. data/rbi/workos/platform_teams.rbi +30 -0
  182. data/rbi/workos/resource_export_completed.rbi +54 -0
  183. data/rbi/workos/resource_export_completed_data.rbi +30 -0
  184. data/rbi/workos/resource_export_created.rbi +54 -0
  185. data/rbi/workos/resource_export_created_data.rbi +30 -0
  186. data/rbi/workos/resource_export_downloaded.rbi +54 -0
  187. data/rbi/workos/resource_export_downloaded_data.rbi +30 -0
  188. data/rbi/workos/resource_export_failed.rbi +54 -0
  189. data/rbi/workos/resource_export_failed_data.rbi +30 -0
  190. data/rbi/workos/saml_idp_signing_certificate.rbi +54 -0
  191. data/rbi/workos/saml_idp_signing_certificate_list.rbi +30 -0
  192. data/rbi/workos/saml_sp_encryption_certificate.rbi +54 -0
  193. data/rbi/workos/saml_sp_encryption_certificate_list.rbi +30 -0
  194. data/rbi/workos/saml_sp_signing_certificate.rbi +54 -0
  195. data/rbi/workos/sso.rbi +155 -2
  196. data/rbi/workos/team.rbi +60 -0
  197. data/rbi/workos/token_query.rbi +20 -2
  198. data/rbi/workos/update_audit_logs_retention.rbi +8 -2
  199. data/rbi/workos/user_management.rbi +64 -0
  200. data/rbi/workos/waitlist.rbi +42 -0
  201. data/rbi/workos/waitlist_entry.rbi +72 -0
  202. data/rbi/workos/waitlist_user.rbi +12 -6
  203. data/test/workos/test_agents.rb +105 -1
  204. data/test/workos/test_agents_model_round_trip.rb +245 -0
  205. data/test/workos/test_audit_logs.rb +11 -2
  206. data/test/workos/test_authorization.rb +6 -6
  207. data/test/workos/test_organizations.rb +41 -1
  208. data/test/workos/test_organizations_model_round_trip.rb +40 -1
  209. data/test/workos/test_platform_teams.rb +41 -0
  210. data/test/workos/test_platform_teams_model_round_trip.rb +41 -0
  211. data/test/workos/test_shared_model_round_trip.rb +449 -2
  212. data/test/workos/test_sso.rb +108 -2
  213. data/test/workos/test_sso_model_round_trip.rb +262 -2
  214. data/test/workos/test_user_management.rb +56 -0
  215. data/test/workos/test_user_management_model_round_trip.rb +78 -2
  216. metadata +160 -1
data/lib/workos/agents.rb CHANGED
@@ -10,6 +10,223 @@ module WorkOS
10
10
  @client = client
11
11
  end
12
12
 
13
+ # List agent blueprints
14
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
15
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
16
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
17
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records).
18
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
19
+ # @return [WorkOS::Types::ListStruct<WorkOS::AgentBlueprint>]
20
+ def list_blueprints(
21
+ before: nil,
22
+ after: nil,
23
+ limit: 10,
24
+ order: "desc",
25
+ request_options: {}
26
+ )
27
+ params = {
28
+ "before" => before,
29
+ "after" => after,
30
+ "limit" => limit,
31
+ "order" => order
32
+ }.compact
33
+ response = @client.request(
34
+ method: :get,
35
+ path: "/agents/blueprints",
36
+ auth: true,
37
+ params: params,
38
+ request_options: request_options
39
+ )
40
+ fetch_next = ->(cursor) {
41
+ list_blueprints(
42
+ before: before,
43
+ after: cursor,
44
+ limit: limit,
45
+ order: order,
46
+ request_options: request_options
47
+ )
48
+ }
49
+ WorkOS::Types::ListStruct.from_response(
50
+ response,
51
+ model: WorkOS::AgentBlueprint,
52
+ filters: {before: before, limit: limit, order: order},
53
+ fetch_next: fetch_next
54
+ )
55
+ end
56
+
57
+ # Create an agent blueprint
58
+ # @param name [String] Human-readable name of the agent blueprint.
59
+ # @param description [String, nil] Human-readable description of the agent blueprint.
60
+ # @param permissions [Array<String>, nil] Permission slugs forming the ceiling on what sessions minted from this blueprint may do. Each slug must exist in the environment.
61
+ # @param invocable_by [WorkOS::AgentBlueprintsCreateRequestInvocableBy, nil] Who may mint sessions from this blueprint.
62
+ # @param session_settings [WorkOS::AgentBlueprintsCreateRequestSessionSetting, nil] Token and session lifetimes for sessions minted from this blueprint.
63
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
64
+ # @return [WorkOS::AgentBlueprint]
65
+ def create_blueprint(
66
+ name:,
67
+ description: nil,
68
+ permissions: nil,
69
+ invocable_by: nil,
70
+ session_settings: nil,
71
+ request_options: {}
72
+ )
73
+ body = {
74
+ "name" => name,
75
+ "description" => description,
76
+ "permissions" => permissions,
77
+ "invocable_by" => invocable_by,
78
+ "session_settings" => session_settings
79
+ }.compact
80
+ response = @client.request(
81
+ method: :post,
82
+ path: "/agents/blueprints",
83
+ auth: true,
84
+ body: body,
85
+ request_options: request_options
86
+ )
87
+ result = WorkOS::AgentBlueprint.new(response.body)
88
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
89
+ result
90
+ end
91
+
92
+ # Get an agent blueprint
93
+ # @param agent_blueprint_id [String] The unique ID of the agent blueprint.
94
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
95
+ # @return [WorkOS::AgentBlueprint]
96
+ def get_blueprint(
97
+ agent_blueprint_id:,
98
+ request_options: {}
99
+ )
100
+ response = @client.request(
101
+ method: :get,
102
+ path: "/agents/blueprints/#{WorkOS::Util.encode_path(agent_blueprint_id)}",
103
+ auth: true,
104
+ request_options: request_options
105
+ )
106
+ result = WorkOS::AgentBlueprint.new(response.body)
107
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
108
+ result
109
+ end
110
+
111
+ # Update an agent blueprint
112
+ # @param agent_blueprint_id [String] The unique ID of the agent blueprint.
113
+ # @param name [String, nil] Human-readable name of the agent blueprint.
114
+ # @param description [String, nil] Human-readable description of the agent blueprint. Pass `null` to clear it.
115
+ # @param permissions [Array<String>, nil] Permission slugs forming the ceiling on what sessions minted from this blueprint may do. Each slug must exist in the environment.
116
+ # @param invocable_by [WorkOS::AgentBlueprintsUpdateRequestInvocableBy, nil] Who may mint sessions from this blueprint. Omitted lists are left unchanged.
117
+ # @param session_settings [WorkOS::AgentBlueprintsUpdateRequestSessionSetting, nil] Token and session lifetimes for sessions minted from this blueprint. Omitted fields are left unchanged.
118
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
119
+ # @return [WorkOS::AgentBlueprint]
120
+ def update_blueprint(
121
+ agent_blueprint_id:,
122
+ name: nil,
123
+ description: WorkOS::OMIT,
124
+ permissions: nil,
125
+ invocable_by: nil,
126
+ session_settings: nil,
127
+ request_options: {}
128
+ )
129
+ body = {
130
+ "name" => name,
131
+ "permissions" => permissions,
132
+ "invocable_by" => invocable_by,
133
+ "session_settings" => session_settings
134
+ }.compact
135
+ body["description"] = description unless description.equal?(WorkOS::OMIT)
136
+ response = @client.request(
137
+ method: :patch,
138
+ path: "/agents/blueprints/#{WorkOS::Util.encode_path(agent_blueprint_id)}",
139
+ auth: true,
140
+ body: body,
141
+ request_options: request_options
142
+ )
143
+ result = WorkOS::AgentBlueprint.new(response.body)
144
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
145
+ result
146
+ end
147
+
148
+ # Delete an agent blueprint
149
+ # @param agent_blueprint_id [String] The unique ID of the agent blueprint.
150
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
151
+ # @return [void]
152
+ def delete_blueprint(
153
+ agent_blueprint_id:,
154
+ request_options: {}
155
+ )
156
+ @client.request(
157
+ method: :delete,
158
+ path: "/agents/blueprints/#{WorkOS::Util.encode_path(agent_blueprint_id)}",
159
+ auth: true,
160
+ request_options: request_options
161
+ )
162
+ nil
163
+ end
164
+
165
+ # Mint an agent token
166
+ # @param agent_blueprint_id [String] The unique ID of the agent blueprint.
167
+ # @param type [WorkOS::Types::AgentBlueprintsTokenMintTokenRequestType] How the session is minted: `user_delegated`, `autonomous`, `agent_delegated`, or `refresh`.
168
+ # @param user_access_token [String, nil] The access token of the user delegating to the agent. The token identifies the user and organization; effective permissions are resolved server-side.
169
+ # @param intent [String, nil] Optional caller-supplied context, echoed as an object with a `text` field in the `intent` claim of the minted access token.
170
+ # @param organization_id [String, nil] The organization the agent acts within when operating as itself.
171
+ # @param agent_access_token [String, nil] The agent's own access token to exchange for a new session on the same instance. The token must have been minted from this blueprint; permissions are re-derived from current authority.
172
+ # @param refresh_token [String, nil] The refresh token issued with a previous agent access token. Refresh tokens are single-use: each refresh rotates it.
173
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
174
+ # @return [WorkOS::AgentToken]
175
+ def create_blueprint_token(
176
+ agent_blueprint_id:,
177
+ type:,
178
+ user_access_token: nil,
179
+ intent: nil,
180
+ organization_id: nil,
181
+ agent_access_token: nil,
182
+ refresh_token: nil,
183
+ request_options: {}
184
+ )
185
+ body = {
186
+ "type" => type,
187
+ "user_access_token" => user_access_token,
188
+ "intent" => intent,
189
+ "organization_id" => organization_id,
190
+ "agent_access_token" => agent_access_token,
191
+ "refresh_token" => refresh_token
192
+ }.compact
193
+ response = @client.request(
194
+ method: :post,
195
+ path: "/agents/blueprints/#{WorkOS::Util.encode_path(agent_blueprint_id)}/tokens",
196
+ auth: true,
197
+ body: body,
198
+ request_options: request_options
199
+ )
200
+ result = WorkOS::AgentToken.new(response.body)
201
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
202
+ result
203
+ end
204
+
205
+ # Validate an agent token
206
+ # @param agent_blueprint_id [String] The unique ID of the agent blueprint.
207
+ # @param agent_access_token [String] The agent access token (a JWT) to validate.
208
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
209
+ # @return [WorkOS::AgentTokenValidation]
210
+ def validate_blueprint_token(
211
+ agent_blueprint_id:,
212
+ agent_access_token:,
213
+ request_options: {}
214
+ )
215
+ body = {
216
+ "agent_access_token" => agent_access_token
217
+ }
218
+ response = @client.request(
219
+ method: :post,
220
+ path: "/agents/blueprints/#{WorkOS::Util.encode_path(agent_blueprint_id)}/tokens/validate",
221
+ auth: true,
222
+ body: body,
223
+ request_options: request_options
224
+ )
225
+ result = WorkOS::AgentTokenValidation.new(response.body)
226
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
227
+ result
228
+ end
229
+
13
230
  # Link a claim attempt to an external user
14
231
  # @param type [String] The operation to perform on the claim attempt. Currently only `link_external_user` is supported.
15
232
  # @param claim_attempt_token [String] The token identifying the claim attempt.
@@ -89,5 +306,183 @@ module WorkOS
89
306
  result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
90
307
  result
91
308
  end
309
+
310
+ # List agent instances
311
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
312
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
313
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
314
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records).
315
+ # @param organization_id [String, nil] Only return instances acting within this organization.
316
+ # @param agent_blueprint_id [String, nil] Only return instances minted from this blueprint.
317
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
318
+ # @return [WorkOS::Types::ListStruct<WorkOS::AgentInstance>]
319
+ def list_instances(
320
+ before: nil,
321
+ after: nil,
322
+ limit: 10,
323
+ order: "desc",
324
+ organization_id: nil,
325
+ agent_blueprint_id: nil,
326
+ request_options: {}
327
+ )
328
+ params = {
329
+ "before" => before,
330
+ "after" => after,
331
+ "limit" => limit,
332
+ "order" => order,
333
+ "organization_id" => organization_id,
334
+ "agent_blueprint_id" => agent_blueprint_id
335
+ }.compact
336
+ response = @client.request(
337
+ method: :get,
338
+ path: "/agents/instances",
339
+ auth: true,
340
+ params: params,
341
+ request_options: request_options
342
+ )
343
+ fetch_next = ->(cursor) {
344
+ list_instances(
345
+ before: before,
346
+ after: cursor,
347
+ limit: limit,
348
+ order: order,
349
+ organization_id: organization_id,
350
+ agent_blueprint_id: agent_blueprint_id,
351
+ request_options: request_options
352
+ )
353
+ }
354
+ WorkOS::Types::ListStruct.from_response(
355
+ response,
356
+ model: WorkOS::AgentInstance,
357
+ filters: {before: before, limit: limit, order: order, organization_id: organization_id, agent_blueprint_id: agent_blueprint_id},
358
+ fetch_next: fetch_next
359
+ )
360
+ end
361
+
362
+ # Get an agent instance
363
+ # @param agent_instance_id [String] The unique ID of the agent instance.
364
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
365
+ # @return [WorkOS::AgentInstance]
366
+ def get_instance(
367
+ agent_instance_id:,
368
+ request_options: {}
369
+ )
370
+ response = @client.request(
371
+ method: :get,
372
+ path: "/agents/instances/#{WorkOS::Util.encode_path(agent_instance_id)}",
373
+ auth: true,
374
+ request_options: request_options
375
+ )
376
+ result = WorkOS::AgentInstance.new(response.body)
377
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
378
+ result
379
+ end
380
+
381
+ # Delete an agent instance
382
+ # @param agent_instance_id [String] The unique ID of the agent instance.
383
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
384
+ # @return [void]
385
+ def delete_instance(
386
+ agent_instance_id:,
387
+ request_options: {}
388
+ )
389
+ @client.request(
390
+ method: :delete,
391
+ path: "/agents/instances/#{WorkOS::Util.encode_path(agent_instance_id)}",
392
+ auth: true,
393
+ request_options: request_options
394
+ )
395
+ nil
396
+ end
397
+
398
+ # List agent instance sessions
399
+ # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`.
400
+ # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
401
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
402
+ # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records).
403
+ # @param agent_blueprint_id [String, nil] Only return sessions of instances minted from this blueprint.
404
+ # @param agent_instance_id [String, nil] Only return sessions belonging to this agent instance.
405
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
406
+ # @return [WorkOS::Types::ListStruct<WorkOS::AgentInstanceSession>]
407
+ def list_sessions(
408
+ before: nil,
409
+ after: nil,
410
+ limit: 10,
411
+ order: "desc",
412
+ agent_blueprint_id: nil,
413
+ agent_instance_id: nil,
414
+ request_options: {}
415
+ )
416
+ params = {
417
+ "before" => before,
418
+ "after" => after,
419
+ "limit" => limit,
420
+ "order" => order,
421
+ "agent_blueprint_id" => agent_blueprint_id,
422
+ "agent_instance_id" => agent_instance_id
423
+ }.compact
424
+ response = @client.request(
425
+ method: :get,
426
+ path: "/agents/sessions",
427
+ auth: true,
428
+ params: params,
429
+ request_options: request_options
430
+ )
431
+ fetch_next = ->(cursor) {
432
+ list_sessions(
433
+ before: before,
434
+ after: cursor,
435
+ limit: limit,
436
+ order: order,
437
+ agent_blueprint_id: agent_blueprint_id,
438
+ agent_instance_id: agent_instance_id,
439
+ request_options: request_options
440
+ )
441
+ }
442
+ WorkOS::Types::ListStruct.from_response(
443
+ response,
444
+ model: WorkOS::AgentInstanceSession,
445
+ filters: {before: before, limit: limit, order: order, agent_blueprint_id: agent_blueprint_id, agent_instance_id: agent_instance_id},
446
+ fetch_next: fetch_next
447
+ )
448
+ end
449
+
450
+ # Get an agent instance session
451
+ # @param agent_instance_session_id [String] The unique ID of the agent instance session.
452
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
453
+ # @return [WorkOS::AgentInstanceSession]
454
+ def get_session(
455
+ agent_instance_session_id:,
456
+ request_options: {}
457
+ )
458
+ response = @client.request(
459
+ method: :get,
460
+ path: "/agents/sessions/#{WorkOS::Util.encode_path(agent_instance_session_id)}",
461
+ auth: true,
462
+ request_options: request_options
463
+ )
464
+ result = WorkOS::AgentInstanceSession.new(response.body)
465
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
466
+ result
467
+ end
468
+
469
+ # Revoke an agent instance session
470
+ # @param agent_instance_session_id [String] The unique ID of the agent instance session.
471
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
472
+ # @return [WorkOS::AgentInstanceSession]
473
+ def revoke_session(
474
+ agent_instance_session_id:,
475
+ request_options: {}
476
+ )
477
+ response = @client.request(
478
+ method: :post,
479
+ path: "/agents/sessions/#{WorkOS::Util.encode_path(agent_instance_session_id)}/revoke",
480
+ auth: true,
481
+ request_options: request_options
482
+ )
483
+ result = WorkOS::AgentInstanceSession.new(response.body)
484
+ result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"])
485
+ result
486
+ end
92
487
  end
93
488
  end
@@ -3,16 +3,5 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- class ValidateApiKey < WorkOS::Types::BaseModel
7
- HASH_ATTRS = {
8
- value: :value
9
- }.freeze
10
-
11
- attr_accessor :value
12
-
13
- def initialize(json)
14
- hash = self.class.normalize(json)
15
- @value = hash[:value]
16
- end
17
- end
6
+ ValidateApiKey = CreateSAMLIdpSigningCertificate
18
7
  end
@@ -6,6 +6,18 @@ require "json"
6
6
 
7
7
  module WorkOS
8
8
  class AuditLogs
9
+ # Identifies the retention (period variant).
10
+ #
11
+ # @!attribute [r] retention_period
12
+ # @return [WorkOS::Types::UpdateAuditLogsRetentionRetentionPeriod]
13
+ RetentionPeriod = Data.define(:retention_period)
14
+
15
+ # Identifies the retention (period in days variant).
16
+ #
17
+ # @!attribute [r] retention_period_in_days
18
+ # @return [Integer]
19
+ RetentionPeriodInDays = Data.define(:retention_period_in_days)
20
+
9
21
  def initialize(client)
10
22
  @client = client
11
23
  end
@@ -31,17 +43,23 @@ module WorkOS
31
43
 
32
44
  # Set Retention
33
45
  # @param id [String] Unique identifier of the Organization.
34
- # @param retention_period_in_days [Integer] The number of days Audit Log events will be retained. Valid values are `30` and `365`.
46
+ # @param retention [WorkOS::AuditLogs::RetentionPeriod, WorkOS::AuditLogs::RetentionPeriodInDays] Identifies the retention.
35
47
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
36
48
  # @return [WorkOS::AuditLogsRetention]
37
49
  def update_organization_audit_logs_retention(
38
50
  id:,
39
- retention_period_in_days:,
51
+ retention:,
40
52
  request_options: {}
41
53
  )
42
- body = {
43
- "retention_period_in_days" => retention_period_in_days
44
- }
54
+ body = {}
55
+ case retention
56
+ when WorkOS::AuditLogs::RetentionPeriod
57
+ body["retention_period"] = retention.retention_period
58
+ when WorkOS::AuditLogs::RetentionPeriodInDays
59
+ body["retention_period_in_days"] = retention.retention_period_in_days
60
+ else
61
+ raise ArgumentError, "expected retention to be one of: WorkOS::AuditLogs::RetentionPeriod, WorkOS::AuditLogs::RetentionPeriodInDays, got #{retention.class}"
62
+ end
45
63
  response = @client.request(
46
64
  method: :put,
47
65
  path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention",
@@ -834,8 +834,8 @@ module WorkOS
834
834
  when WorkOS::Authorization::ParentResourceById
835
835
  body["parent_resource_id"] = parent_resource.parent_resource_id
836
836
  when WorkOS::Authorization::ParentResourceByExternalId
837
- body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
838
837
  body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug
838
+ body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
839
839
  else
840
840
  raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}"
841
841
  end
@@ -1097,8 +1097,8 @@ module WorkOS
1097
1097
  when WorkOS::Authorization::ParentResourceById
1098
1098
  body["parent_resource_id"] = parent_resource.parent_resource_id
1099
1099
  when WorkOS::Authorization::ParentResourceByExternalId
1100
- body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
1101
1100
  body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug
1101
+ body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
1102
1102
  else
1103
1103
  raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}"
1104
1104
  end
@@ -1157,8 +1157,8 @@ module WorkOS
1157
1157
  when WorkOS::Authorization::ParentResourceById
1158
1158
  body["parent_resource_id"] = parent_resource.parent_resource_id
1159
1159
  when WorkOS::Authorization::ParentResourceByExternalId
1160
- body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
1161
1160
  body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug
1161
+ body["parent_resource_external_id"] = parent_resource.parent_resource_external_id
1162
1162
  else
1163
1163
  raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}"
1164
1164
  end
data/lib/workos/client.rb CHANGED
@@ -64,6 +64,10 @@ module WorkOS
64
64
  @groups ||= WorkOS::Groups.new(self)
65
65
  end
66
66
 
67
+ def platform_teams
68
+ @platform_teams ||= WorkOS::PlatformTeams.new(self)
69
+ end
70
+
67
71
  def admin_portal
68
72
  @admin_portal ||= WorkOS::AdminPortal.new(self)
69
73
  end
@@ -45,15 +45,30 @@ WORKOS_INFLECTIONS = {
45
45
  "connection_saml_certificate_renewed_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewedDataCertificateCertificateType",
46
46
  "connection_saml_certificate_renewed_data_connection" => "ConnectionSAMLCertificateRenewedDataConnection",
47
47
  "cors_origin_response" => "CORSOriginResponse",
48
+ "create_connection_oidc_options" => "CreateConnectionOIDCOptions",
49
+ "create_connection_oidc_options_id_token_signature_algorithm" => "CreateConnectionOIDCOptionsIdTokenSignatureAlgorithm",
50
+ "create_connection_oidc_options_token_authentication_method" => "CreateConnectionOIDCOptionsTokenAuthenticationMethod",
51
+ "create_connection_saml_options" => "CreateConnectionSAMLOptions",
48
52
  "create_cors_origin" => "CreateCORSOrigin",
49
53
  "create_m2m_application" => "CreateM2MApplication",
50
54
  "create_oauth_application" => "CreateOAuthApplication",
55
+ "create_saml_idp_signing_certificate" => "CreateSAMLIdpSigningCertificate",
51
56
  "jwt_template_response" => "JWTTemplateResponse",
52
57
  "mfa_totp_session_authenticate_request" => "MFATotpSessionAuthenticateRequest",
58
+ "patch_connection_oidc_options" => "PatchConnectionOIDCOptions",
59
+ "patch_connection_oidc_options_id_token_signature_algorithm" => "PatchConnectionOIDCOptionsIdTokenSignatureAlgorithm",
60
+ "patch_connection_oidc_options_token_authentication_method" => "PatchConnectionOIDCOptionsTokenAuthenticationMethod",
61
+ "patch_connection_saml_options" => "PatchConnectionSAMLOptions",
53
62
  "pkce" => "PKCE",
63
+ "saml_idp_signing_certificate" => "SAMLIdpSigningCertificate",
64
+ "saml_idp_signing_certificate_list" => "SAMLIdpSigningCertificateList",
65
+ "saml_sp_encryption_certificate" => "SAMLSpEncryptionCertificate",
66
+ "saml_sp_encryption_certificate_list" => "SAMLSpEncryptionCertificateList",
67
+ "saml_sp_signing_certificate" => "SAMLSpSigningCertificate",
54
68
  "sso" => "SSO",
55
69
  "sso_authorize_url_response" => "SSOAuthorizeUrlResponse",
56
70
  "sso_device_authorization_request" => "SSODeviceAuthorizationRequest",
71
+ "sso_grant_type" => "SSOGrantType",
57
72
  "sso_logout_authorize_request" => "SSOLogoutAuthorizeRequest",
58
73
  "sso_logout_authorize_response" => "SSOLogoutAuthorizeResponse",
59
74
  "sso_provider" => "SSOProvider",
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class CreateItContact < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ email: :email
9
+ }.freeze
10
+
11
+ attr_accessor :email
12
+
13
+ def initialize(json)
14
+ hash = self.class.normalize(json)
15
+ @email = hash[:email]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class InviteItContact < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ intents: :intents
9
+ }.freeze
10
+
11
+ attr_accessor :intents
12
+
13
+ def initialize(json)
14
+ hash = self.class.normalize(json)
15
+ @intents = hash[:intents] || []
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class ItContact < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ object: :object,
9
+ id: :id,
10
+ email: :email,
11
+ created_at: :created_at,
12
+ updated_at: :updated_at
13
+ }.freeze
14
+
15
+ attr_accessor \
16
+ :object,
17
+ :id,
18
+ :email,
19
+ :created_at,
20
+ :updated_at
21
+
22
+ def initialize(json)
23
+ hash = self.class.normalize(json)
24
+ @object = hash[:object]
25
+ @id = hash[:id]
26
+ @email = hash[:email]
27
+ @created_at = hash[:created_at]
28
+ @updated_at = hash[:updated_at]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class ItContactList < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ object: :object,
9
+ data: :data,
10
+ list_metadata: :list_metadata
11
+ }.freeze
12
+
13
+ attr_accessor \
14
+ :object,
15
+ :data,
16
+ :list_metadata
17
+
18
+ def initialize(json)
19
+ hash = self.class.normalize(json)
20
+ @object = hash[:object]
21
+ @data = (hash[:data] || []).map { |item| item ? WorkOS::ItContact.new(item) : nil }
22
+ @list_metadata = hash[:list_metadata] ? WorkOS::ItContactListListMetadata.new(hash[:list_metadata]) : nil
23
+ end
24
+ end
25
+ end
@@ -13,14 +13,23 @@ module WorkOS
13
13
  external_id: :external_id
14
14
  }.freeze
15
15
 
16
+ # @!attribute domains
17
+ # @deprecated The domains associated with the organization. Deprecated in favor of `domain_data`.
18
+
16
19
  attr_accessor \
17
20
  :name,
18
21
  :allow_profiles_outside_organization,
19
- :domains,
20
22
  :domain_data,
21
23
  :metadata,
22
24
  :external_id
23
25
 
26
+ def domains
27
+ warn "[DEPRECATION] `domains` is deprecated and will be removed in a future version.", uplevel: 1
28
+ @domains
29
+ end
30
+
31
+ attr_writer :domains
32
+
24
33
  def initialize(json)
25
34
  hash = self.class.normalize(json)
26
35
  @name = hash[:name]