workos 9.1.0 → 9.2.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release-please.yml +42 -83
  3. data/.last-synced-sha +1 -1
  4. data/.oagen-manifest.json +74 -3
  5. data/.release-please-manifest.json +1 -1
  6. data/CHANGELOG.md +56 -0
  7. data/Gemfile.lock +2 -2
  8. data/lib/workos/authorization/create_group_role_assignment.rb +7 -0
  9. data/lib/workos/authorization/delete_group_role_assignments_by_criteria.rb +7 -0
  10. data/lib/workos/authorization/group_role_assignment.rb +37 -0
  11. data/lib/workos/authorization/group_role_assignment_list.rb +25 -0
  12. data/lib/workos/authorization/group_role_assignment_resource.rb +25 -0
  13. data/lib/workos/authorization/replace_group_role_assignment_entry.rb +7 -0
  14. data/lib/workos/authorization/replace_group_role_assignments.rb +18 -0
  15. data/lib/workos/authorization/user_role_assignment_resource.rb +1 -19
  16. data/lib/workos/authorization.rb +180 -0
  17. data/lib/workos/client.rb +8 -0
  18. data/lib/workos/client_api/client_api_token.rb +22 -0
  19. data/lib/workos/client_api/client_api_token_response.rb +18 -0
  20. data/lib/workos/client_api.rb +39 -0
  21. data/lib/workos/pipes/connected_account.rb +6 -0
  22. data/lib/workos/pipes/data_integrations_list_response_data.rb +3 -0
  23. data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +6 -0
  24. data/lib/workos/pipes.rb +5 -5
  25. data/lib/workos/pipes_provider/configure_data_integration_body.rb +28 -0
  26. data/lib/workos/pipes_provider/data_integration_configuration_list_response.rb +22 -0
  27. data/lib/workos/pipes_provider/data_integration_configuration_response.rb +46 -0
  28. data/lib/workos/pipes_provider/data_integration_credentials.rb +31 -0
  29. data/lib/workos/pipes_provider.rb +68 -0
  30. data/lib/workos/types/connected_account_auth_method.rb +13 -0
  31. data/lib/workos/types/data_integration_access_token_response_error.rb +2 -2
  32. data/lib/workos/types/data_integration_credentials_credentials_type.rb +14 -0
  33. data/lib/workos/types/data_integrations_list_response_data_auth_methods.rb +9 -0
  34. data/lib/workos/types/data_integrations_list_response_data_connected_account_auth_method.rb +9 -0
  35. data/lib/workos/types/widget_session_token_scopes.rb +2 -1
  36. data/lib/workos/user_management.rb +1 -1
  37. data/lib/workos/version.rb +1 -1
  38. data/lib/workos/widgets/widget_session_token_response.rb +1 -12
  39. data/lib/workos.rb +2 -0
  40. data/rbi/workos/authorization.rbi +63 -0
  41. data/rbi/workos/authorization_code_session_authenticate_request.rbi +2 -2
  42. data/rbi/workos/client.rbi +6 -0
  43. data/rbi/workos/client_api.rbi +22 -0
  44. data/rbi/workos/client_api_token.rbi +30 -0
  45. data/rbi/workos/client_api_token_response.rbi +24 -0
  46. data/rbi/workos/configure_data_integration_body.rbi +42 -0
  47. data/rbi/workos/connected_account.rbi +12 -0
  48. data/rbi/workos/create_group_role_assignment.rbi +42 -0
  49. data/rbi/workos/data_integration_configuration_list_response.rbi +30 -0
  50. data/rbi/workos/data_integration_configuration_response.rbi +78 -0
  51. data/rbi/workos/data_integration_credentials.rbi +48 -0
  52. data/rbi/workos/data_integrations_list_response_data.rbi +6 -0
  53. data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +12 -0
  54. data/rbi/workos/delete_group_role_assignments_by_criteria.rbi +42 -0
  55. data/rbi/workos/group_role_assignment.rbi +60 -0
  56. data/rbi/workos/group_role_assignment_resource.rbi +36 -0
  57. data/rbi/workos/organization_membership_service.rbi +1 -1
  58. data/rbi/workos/pipes.rbi +2 -2
  59. data/rbi/workos/pipes_provider.rbi +34 -0
  60. data/rbi/workos/refresh_token_session_authenticate_request.rbi +2 -2
  61. data/rbi/workos/replace_group_role_assignment_entry.rbi +42 -0
  62. data/rbi/workos/replace_group_role_assignments.rbi +24 -0
  63. data/rbi/workos/user_management.rbi +3 -3
  64. data/test/workos/test_authorization.rb +48 -0
  65. data/test/workos/test_client_api.rb +33 -0
  66. data/test/workos/test_model_round_trip.rb +196 -14
  67. data/test/workos/test_pipes.rb +3 -3
  68. data/test/workos/test_pipes_provider.rb +41 -0
  69. data/test/workos/test_user_management.rb +2 -2
  70. metadata +36 -1
@@ -3,23 +3,5 @@
3
3
  # This file is auto-generated by oagen. Do not edit.
4
4
 
5
5
  module WorkOS
6
- class UserRoleAssignmentResource < WorkOS::Types::BaseModel
7
- HASH_ATTRS = {
8
- id: :id,
9
- external_id: :external_id,
10
- resource_type_slug: :resource_type_slug
11
- }.freeze
12
-
13
- attr_accessor \
14
- :id,
15
- :external_id,
16
- :resource_type_slug
17
-
18
- def initialize(json)
19
- hash = self.class.normalize(json)
20
- @id = hash[:id]
21
- @external_id = hash[:external_id]
22
- @resource_type_slug = hash[:resource_type_slug]
23
- end
24
- end
6
+ UserRoleAssignmentResource = GroupRoleAssignmentResource
25
7
  end
@@ -52,6 +52,186 @@ module WorkOS
52
52
  @client = client
53
53
  end
54
54
 
55
+ # List role assignments for a group
56
+ # @param group_id [String] The ID of the group.
57
+ # @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"`.
58
+ # @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"`.
59
+ # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`.
60
+ # @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).
61
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
62
+ # @return [WorkOS::Types::ListStruct<WorkOS::GroupRoleAssignment>]
63
+ def list_group_role_assignments(
64
+ group_id:,
65
+ before: nil,
66
+ after: nil,
67
+ limit: 10,
68
+ order: "desc",
69
+ request_options: {}
70
+ )
71
+ params = {
72
+ "before" => before,
73
+ "after" => after,
74
+ "limit" => limit,
75
+ "order" => order
76
+ }.compact
77
+ response = @client.request(
78
+ method: :get,
79
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments",
80
+ auth: true,
81
+ params: params,
82
+ request_options: request_options
83
+ )
84
+ fetch_next = ->(cursor) {
85
+ list_group_role_assignments(
86
+ group_id: group_id,
87
+ before: before,
88
+ after: cursor,
89
+ limit: limit,
90
+ order: order,
91
+ request_options: request_options
92
+ )
93
+ }
94
+ WorkOS::Types::ListStruct.from_response(
95
+ response,
96
+ model: WorkOS::GroupRoleAssignment,
97
+ filters: {group_id: group_id, before: before, limit: limit, order: order},
98
+ fetch_next: fetch_next
99
+ )
100
+ end
101
+
102
+ # Assign a role to a group
103
+ # @param group_id [String] The ID of the group.
104
+ # @param role_slug [String] The slug of the role to assign to the group.
105
+ # @param resource_id [String, nil] The ID of the resource. Omit along with the external-id fields to target the organization itself.
106
+ # @param resource_external_id [String, nil] The external ID of the resource.
107
+ # @param resource_type_slug [String, nil] The resource type slug.
108
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
109
+ # @return [WorkOS::GroupRoleAssignment]
110
+ def create_group_role_assignment(
111
+ group_id:,
112
+ role_slug:,
113
+ resource_id: nil,
114
+ resource_external_id: nil,
115
+ resource_type_slug: nil,
116
+ request_options: {}
117
+ )
118
+ body = {
119
+ "role_slug" => role_slug,
120
+ "resource_id" => resource_id,
121
+ "resource_external_id" => resource_external_id,
122
+ "resource_type_slug" => resource_type_slug
123
+ }.compact
124
+ response = @client.request(
125
+ method: :post,
126
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments",
127
+ auth: true,
128
+ body: body,
129
+ request_options: request_options
130
+ )
131
+ result = WorkOS::GroupRoleAssignment.new(response.body)
132
+ 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"])
133
+ result
134
+ end
135
+
136
+ # Replace all role assignments for a group
137
+ # @param group_id [String] The ID of the group.
138
+ # @param role_assignments [Array<WorkOS::ReplaceGroupRoleAssignmentEntry>] The list of role assignments that should exist for the group. All existing assignments will be replaced.
139
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
140
+ # @return [WorkOS::Types::ListStruct<WorkOS::GroupRoleAssignment>]
141
+ def update_group_role_assignments(
142
+ group_id:,
143
+ role_assignments:,
144
+ request_options: {}
145
+ )
146
+ body = {
147
+ "role_assignments" => role_assignments
148
+ }
149
+ response = @client.request(
150
+ method: :put,
151
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments",
152
+ auth: true,
153
+ body: body,
154
+ request_options: request_options
155
+ )
156
+ WorkOS::Types::ListStruct.from_response(
157
+ response,
158
+ model: WorkOS::GroupRoleAssignment,
159
+ filters: {group_id: group_id, role_assignments: role_assignments}
160
+ )
161
+ end
162
+
163
+ # Remove group role assignments by criteria
164
+ # @param group_id [String] The ID of the group.
165
+ # @param role_slug [String] The slug of the role to remove assignments for.
166
+ # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`.
167
+ # @param resource_external_id [String, nil] The external ID of the resource.
168
+ # @param resource_type_slug [String, nil] The resource type slug.
169
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
170
+ # @return [void]
171
+ def delete_group_role_assignments(
172
+ group_id:,
173
+ role_slug:,
174
+ resource_id: nil,
175
+ resource_external_id: nil,
176
+ resource_type_slug: nil,
177
+ request_options: {}
178
+ )
179
+ body = {
180
+ "role_slug" => role_slug,
181
+ "resource_id" => resource_id,
182
+ "resource_external_id" => resource_external_id,
183
+ "resource_type_slug" => resource_type_slug
184
+ }.compact
185
+ @client.request(
186
+ method: :delete,
187
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments",
188
+ auth: true,
189
+ body: body,
190
+ request_options: request_options
191
+ )
192
+ nil
193
+ end
194
+
195
+ # Get a group role assignment
196
+ # @param group_id [String] The ID of the group.
197
+ # @param role_assignment_id [String] The ID of the group role assignment.
198
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
199
+ # @return [WorkOS::GroupRoleAssignment]
200
+ def get_group_role_assignment(
201
+ group_id:,
202
+ role_assignment_id:,
203
+ request_options: {}
204
+ )
205
+ response = @client.request(
206
+ method: :get,
207
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments/#{WorkOS::Util.encode_path(role_assignment_id)}",
208
+ auth: true,
209
+ request_options: request_options
210
+ )
211
+ result = WorkOS::GroupRoleAssignment.new(response.body)
212
+ 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"])
213
+ result
214
+ end
215
+
216
+ # Remove a group role assignment
217
+ # @param group_id [String] The ID of the group.
218
+ # @param role_assignment_id [String] The ID of the group role assignment to remove.
219
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
220
+ # @return [void]
221
+ def delete_group_role_assignment(
222
+ group_id:,
223
+ role_assignment_id:,
224
+ request_options: {}
225
+ )
226
+ @client.request(
227
+ method: :delete,
228
+ path: "/authorization/groups/#{WorkOS::Util.encode_path(group_id)}/role_assignments/#{WorkOS::Util.encode_path(role_assignment_id)}",
229
+ auth: true,
230
+ request_options: request_options
231
+ )
232
+ nil
233
+ end
234
+
55
235
  # Check authorization
56
236
  # @param organization_membership_id [String] The ID of the organization membership to check.
57
237
  # @param permission_slug [String] The slug of the permission to check.
data/lib/workos/client.rb CHANGED
@@ -16,6 +16,10 @@ module WorkOS
16
16
  @authorization ||= WorkOS::Authorization.new(self)
17
17
  end
18
18
 
19
+ def client_api
20
+ @client_api ||= WorkOS::ClientApi.new(self)
21
+ end
22
+
19
23
  def sso
20
24
  @sso ||= WorkOS::SSO.new(self)
21
25
  end
@@ -48,6 +52,10 @@ module WorkOS
48
52
  @api_keys ||= WorkOS::ApiKeys.new(self)
49
53
  end
50
54
 
55
+ def pipes_provider
56
+ @pipes_provider ||= WorkOS::PipesProvider.new(self)
57
+ end
58
+
51
59
  def groups
52
60
  @groups ||= WorkOS::Groups.new(self)
53
61
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class ClientApiToken < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ organization_id: :organization_id,
9
+ user_id: :user_id
10
+ }.freeze
11
+
12
+ attr_accessor \
13
+ :organization_id,
14
+ :user_id
15
+
16
+ def initialize(json)
17
+ hash = self.class.normalize(json)
18
+ @organization_id = hash[:organization_id]
19
+ @user_id = hash[:user_id]
20
+ end
21
+ end
22
+ 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 ClientApiTokenResponse < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ token: :token
9
+ }.freeze
10
+
11
+ attr_accessor :token
12
+
13
+ def initialize(json)
14
+ hash = self.class.normalize(json)
15
+ @token = hash[:token]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ require "json"
6
+
7
+ module WorkOS
8
+ class ClientApi
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ # Generate a Client API token
14
+ # @param organization_id [String] The ID of the organization to scope the Client API token to.
15
+ # @param user_id [String] The ID of the user to issue the Client API token for.
16
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
17
+ # @return [WorkOS::ClientApiTokenResponse]
18
+ def create_token(
19
+ organization_id:,
20
+ user_id:,
21
+ request_options: {}
22
+ )
23
+ body = {
24
+ "organization_id" => organization_id,
25
+ "user_id" => user_id
26
+ }
27
+ response = @client.request(
28
+ method: :post,
29
+ path: "/client/token",
30
+ auth: true,
31
+ body: body,
32
+ request_options: request_options
33
+ )
34
+ result = WorkOS::ClientApiTokenResponse.new(response.body)
35
+ 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"])
36
+ result
37
+ end
38
+ end
39
+ end
@@ -10,6 +10,8 @@ module WorkOS
10
10
  user_id: :user_id,
11
11
  organization_id: :organization_id,
12
12
  scopes: :scopes,
13
+ auth_method: :auth_method,
14
+ api_key_last_4: :api_key_last_4,
13
15
  state: :state,
14
16
  created_at: :created_at,
15
17
  updated_at: :updated_at
@@ -21,6 +23,8 @@ module WorkOS
21
23
  :user_id,
22
24
  :organization_id,
23
25
  :scopes,
26
+ :auth_method,
27
+ :api_key_last_4,
24
28
  :state,
25
29
  :created_at,
26
30
  :updated_at
@@ -32,6 +36,8 @@ module WorkOS
32
36
  @user_id = hash[:user_id]
33
37
  @organization_id = hash[:organization_id]
34
38
  @scopes = hash[:scopes] || []
39
+ @auth_method = hash[:auth_method]
40
+ @api_key_last_4 = hash[:api_key_last_4]
35
41
  @state = hash[:state]
36
42
  @created_at = hash[:created_at]
37
43
  @updated_at = hash[:updated_at]
@@ -13,6 +13,7 @@ module WorkOS
13
13
  integration_type: :integration_type,
14
14
  credentials_type: :credentials_type,
15
15
  scopes: :scopes,
16
+ auth_methods: :auth_methods,
16
17
  ownership: :ownership,
17
18
  created_at: :created_at,
18
19
  updated_at: :updated_at,
@@ -28,6 +29,7 @@ module WorkOS
28
29
  :integration_type,
29
30
  :credentials_type,
30
31
  :scopes,
32
+ :auth_methods,
31
33
  :ownership,
32
34
  :created_at,
33
35
  :updated_at,
@@ -43,6 +45,7 @@ module WorkOS
43
45
  @integration_type = hash[:integration_type]
44
46
  @credentials_type = hash[:credentials_type]
45
47
  @scopes = hash[:scopes] || []
48
+ @auth_methods = hash[:auth_methods] || []
46
49
  @ownership = hash[:ownership]
47
50
  @created_at = hash[:created_at]
48
51
  @updated_at = hash[:updated_at]
@@ -10,6 +10,8 @@ module WorkOS
10
10
  user_id: :user_id,
11
11
  organization_id: :organization_id,
12
12
  scopes: :scopes,
13
+ auth_method: :auth_method,
14
+ api_key_last_4: :api_key_last_4,
13
15
  state: :state,
14
16
  created_at: :created_at,
15
17
  updated_at: :updated_at,
@@ -25,6 +27,8 @@ module WorkOS
25
27
  :user_id,
26
28
  :organization_id,
27
29
  :scopes,
30
+ :auth_method,
31
+ :api_key_last_4,
28
32
  :state,
29
33
  :created_at,
30
34
  :updated_at
@@ -43,6 +47,8 @@ module WorkOS
43
47
  @user_id = hash[:user_id]
44
48
  @organization_id = hash[:organization_id]
45
49
  @scopes = hash[:scopes] || []
50
+ @auth_method = hash[:auth_method]
51
+ @api_key_last_4 = hash[:api_key_last_4]
46
52
  @state = hash[:state]
47
53
  @created_at = hash[:created_at]
48
54
  @updated_at = hash[:updated_at]
data/lib/workos/pipes.rb CHANGED
@@ -42,13 +42,13 @@ module WorkOS
42
42
  end
43
43
 
44
44
  # Get an access token for a connected account
45
- # @param slug [String] The identifier of the integration.
45
+ # @param provider [String] The identifier of the integration.
46
46
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
47
47
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
48
48
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
49
49
  # @return [WorkOS::DataIntegrationAccessTokenResponse]
50
- def create_data_integration_token(
51
- slug:,
50
+ def get_access_token(
51
+ provider:,
52
52
  user_id:,
53
53
  organization_id: nil,
54
54
  request_options: {}
@@ -59,7 +59,7 @@ module WorkOS
59
59
  }.compact
60
60
  response = @client.request(
61
61
  method: :post,
62
- path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/token",
62
+ path: "/data-integrations/#{WorkOS::Util.encode_path(provider)}/token",
63
63
  auth: true,
64
64
  body: body,
65
65
  request_options: request_options
@@ -121,7 +121,7 @@ module WorkOS
121
121
  nil
122
122
  end
123
123
 
124
- # List providers
124
+ # List providers for a user
125
125
  # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier to list providers and connected accounts for.
126
126
  # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization.
127
127
  # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class ConfigureDataIntegrationBody < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ enabled: :enabled,
9
+ scopes: :scopes,
10
+ client_id: :client_id,
11
+ client_secret: :client_secret
12
+ }.freeze
13
+
14
+ attr_accessor \
15
+ :enabled,
16
+ :scopes,
17
+ :client_id,
18
+ :client_secret
19
+
20
+ def initialize(json)
21
+ hash = self.class.normalize(json)
22
+ @enabled = hash[:enabled]
23
+ @scopes = hash[:scopes] || []
24
+ @client_id = hash[:client_id]
25
+ @client_secret = hash[:client_secret]
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class DataIntegrationConfigurationListResponse < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ object: :object,
9
+ data: :data
10
+ }.freeze
11
+
12
+ attr_accessor \
13
+ :object,
14
+ :data
15
+
16
+ def initialize(json)
17
+ hash = self.class.normalize(json)
18
+ @object = hash[:object]
19
+ @data = (hash[:data] || []).map { |item| item ? WorkOS::DataIntegrationConfigurationResponse.new(item) : nil }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ class DataIntegrationConfigurationResponse < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ object: :object,
9
+ id: :id,
10
+ organization_id: :organization_id,
11
+ slug: :slug,
12
+ name: :name,
13
+ enabled: :enabled,
14
+ scopes: :scopes,
15
+ created_at: :created_at,
16
+ updated_at: :updated_at,
17
+ credentials: :credentials
18
+ }.freeze
19
+
20
+ attr_accessor \
21
+ :object,
22
+ :id,
23
+ :organization_id,
24
+ :slug,
25
+ :name,
26
+ :enabled,
27
+ :scopes,
28
+ :created_at,
29
+ :updated_at,
30
+ :credentials
31
+
32
+ def initialize(json)
33
+ hash = self.class.normalize(json)
34
+ @object = hash[:object]
35
+ @id = hash[:id]
36
+ @organization_id = hash[:organization_id]
37
+ @slug = hash[:slug]
38
+ @name = hash[:name]
39
+ @enabled = hash[:enabled]
40
+ @scopes = hash[:scopes] || []
41
+ @created_at = hash[:created_at]
42
+ @updated_at = hash[:updated_at]
43
+ @credentials = hash[:credentials] ? WorkOS::DataIntegrationCredentials.new(hash[:credentials]) : nil
44
+ end
45
+ end
46
+ 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 DataIntegrationCredentials < WorkOS::Types::BaseModel
7
+ HASH_ATTRS = {
8
+ credentials_type: :credentials_type,
9
+ has_credentials: :has_credentials,
10
+ client_id: :client_id,
11
+ client_secret_last_four: :client_secret_last_four,
12
+ redirect_uri: :redirect_uri
13
+ }.freeze
14
+
15
+ attr_accessor \
16
+ :credentials_type,
17
+ :has_credentials,
18
+ :client_id,
19
+ :client_secret_last_four,
20
+ :redirect_uri
21
+
22
+ def initialize(json)
23
+ hash = self.class.normalize(json)
24
+ @credentials_type = hash[:credentials_type]
25
+ @has_credentials = hash[:has_credentials]
26
+ @client_id = hash[:client_id]
27
+ @client_secret_last_four = hash[:client_secret_last_four]
28
+ @redirect_uri = hash[:redirect_uri]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ require "json"
6
+
7
+ module WorkOS
8
+ class PipesProvider
9
+ def initialize(client)
10
+ @client = client
11
+ end
12
+
13
+ # List providers for an organization
14
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier to list provider configurations for.
15
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
16
+ # @return [WorkOS::DataIntegrationConfigurationListResponse]
17
+ def list_organization_data_integration_configurations(
18
+ organization_id:,
19
+ request_options: {}
20
+ )
21
+ response = @client.request(
22
+ method: :get,
23
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_integration_configurations",
24
+ auth: true,
25
+ request_options: request_options
26
+ )
27
+ result = WorkOS::DataIntegrationConfigurationListResponse.new(response.body)
28
+ 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"])
29
+ result
30
+ end
31
+
32
+ # Configure a provider for an organization
33
+ # @param organization_id [String] An [Organization](https://workos.com/docs/reference/organization) identifier to configure the provider for.
34
+ # @param slug [String] The slug identifier of the provider to configure (e.g., `github`, `slack`, `notion`).
35
+ # @param enabled [Boolean, nil] Whether the provider is enabled for the organization.
36
+ # @param scopes [Array<String>, nil] The OAuth scopes to request for the organization. Pass `null` to inherit the provider scopes.
37
+ # @param client_id [String, nil] The OAuth client ID of the organization's own application. Must be provided together with `client_secret`, and only for providers whose credentials are supplied by the organization.
38
+ # @param client_secret [String, nil] The OAuth client secret of the organization's own application. Must be provided together with `client_id`.
39
+ # @param request_options [Hash] (see WorkOS::Types::RequestOptions)
40
+ # @return [WorkOS::DataIntegrationConfigurationResponse]
41
+ def update_organization_data_integration_configuration(
42
+ organization_id:,
43
+ slug:,
44
+ enabled: nil,
45
+ scopes: nil,
46
+ client_id: nil,
47
+ client_secret: nil,
48
+ request_options: {}
49
+ )
50
+ body = {
51
+ "enabled" => enabled,
52
+ "scopes" => scopes,
53
+ "client_id" => client_id,
54
+ "client_secret" => client_secret
55
+ }.compact
56
+ response = @client.request(
57
+ method: :put,
58
+ path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/data_integration_configurations/#{WorkOS::Util.encode_path(slug)}",
59
+ auth: true,
60
+ body: body,
61
+ request_options: request_options
62
+ )
63
+ result = WorkOS::DataIntegrationConfigurationResponse.new(response.body)
64
+ 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"])
65
+ result
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ module Types
7
+ class ConnectedAccountAuthMethod
8
+ OAUTH = "oauth"
9
+ API_KEY = "api_key"
10
+ ALL = [OAUTH, API_KEY].freeze
11
+ end
12
+ end
13
+ end
@@ -5,9 +5,9 @@
5
5
  module WorkOS
6
6
  module Types
7
7
  class DataIntegrationAccessTokenResponseError
8
- NEEDS_REAUTHORIZATION = "needs_reauthorization"
9
8
  NOT_INSTALLED = "not_installed"
10
- ALL = [NEEDS_REAUTHORIZATION, NOT_INSTALLED].freeze
9
+ NEEDS_REAUTHORIZATION = "needs_reauthorization"
10
+ ALL = [NOT_INSTALLED, NEEDS_REAUTHORIZATION].freeze
11
11
  end
12
12
  end
13
13
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ module Types
7
+ class DataIntegrationCredentialsCredentialsType
8
+ SHARED = "shared"
9
+ CUSTOM = "custom"
10
+ ORGANIZATION = "organization"
11
+ ALL = [SHARED, CUSTOM, ORGANIZATION].freeze
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is auto-generated by oagen. Do not edit.
4
+
5
+ module WorkOS
6
+ module Types
7
+ DataIntegrationsListResponseDataAuthMethods = ConnectedAccountAuthMethod
8
+ end
9
+ end