zyphr 0.1.32 → 0.1.34

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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -0
  3. data/docs/AddOrganizationMemberRequest.md +20 -0
  4. data/docs/AuthOrganizationsApi.md +864 -0
  5. data/docs/AuthUserProfileApi.md +76 -0
  6. data/docs/CreateOrganizationRequest.md +22 -0
  7. data/docs/DomainsApi.md +73 -0
  8. data/docs/InboundAttachmentUrlResponse.md +20 -0
  9. data/docs/InboundAttachmentUrlResponseData.md +22 -0
  10. data/docs/InboundEmail.md +48 -0
  11. data/docs/InboundEmailApi.md +235 -0
  12. data/docs/InboundEmailAttachment.md +24 -0
  13. data/docs/InboundEmailFrom.md +20 -0
  14. data/docs/InboundEmailListResponse.md +20 -0
  15. data/docs/InboundEmailListResponseMeta.md +24 -0
  16. data/docs/InboundEmailResponse.md +20 -0
  17. data/docs/LoginRequest.md +3 -1
  18. data/docs/MuseApi.md +681 -0
  19. data/docs/Organization.md +34 -0
  20. data/docs/OrganizationListResponse.md +20 -0
  21. data/docs/OrganizationListResponseMeta.md +20 -0
  22. data/docs/OrganizationMembersListResponse.md +20 -0
  23. data/docs/OrganizationMembership.md +30 -0
  24. data/docs/OrganizationMembershipResponse.md +20 -0
  25. data/docs/OrganizationMembershipWithUser.md +34 -0
  26. data/docs/OrganizationResponse.md +20 -0
  27. data/docs/RegisterRequest.md +5 -1
  28. data/docs/SetDomainInboundRequest.md +18 -0
  29. data/docs/SwitchOrganizationRequest.md +20 -0
  30. data/docs/SwitchOrganizationResponse.md +20 -0
  31. data/docs/SwitchOrganizationResponseData.md +22 -0
  32. data/docs/SwitchOrganizationResponseDataTokens.md +24 -0
  33. data/docs/SwitchOrganizationResponseDataUser.md +20 -0
  34. data/docs/UpdateOrganizationMemberRoleRequest.md +18 -0
  35. data/docs/UpdateOrganizationRequest.md +22 -0
  36. data/docs/V1MuseSubjectsSuggestPostRequest.md +24 -0
  37. data/lib/zyphr/api/auth_organizations_api.rb +773 -0
  38. data/lib/zyphr/api/auth_user_profile_api.rb +61 -0
  39. data/lib/zyphr/api/domains_api.rb +72 -0
  40. data/lib/zyphr/api/inbound_email_api.rb +234 -0
  41. data/lib/zyphr/api/muse_api.rb +644 -0
  42. data/lib/zyphr/models/add_organization_member_request.rb +248 -0
  43. data/lib/zyphr/models/create_organization_request.rb +258 -0
  44. data/lib/zyphr/models/inbound_attachment_url_response.rb +229 -0
  45. data/lib/zyphr/models/inbound_attachment_url_response_data.rb +240 -0
  46. data/lib/zyphr/models/inbound_email.rb +441 -0
  47. data/lib/zyphr/models/inbound_email_attachment.rb +250 -0
  48. data/lib/zyphr/models/inbound_email_from.rb +230 -0
  49. data/lib/zyphr/models/inbound_email_list_response.rb +231 -0
  50. data/lib/zyphr/models/inbound_email_list_response_meta.rb +247 -0
  51. data/lib/zyphr/models/inbound_email_response.rb +229 -0
  52. data/lib/zyphr/models/login_request.rb +14 -4
  53. data/lib/zyphr/models/organization.rb +434 -0
  54. data/lib/zyphr/models/organization_list_response.rb +265 -0
  55. data/lib/zyphr/models/organization_list_response_meta.rb +230 -0
  56. data/lib/zyphr/models/organization_members_list_response.rb +265 -0
  57. data/lib/zyphr/models/organization_membership.rb +379 -0
  58. data/lib/zyphr/models/organization_membership_response.rb +263 -0
  59. data/lib/zyphr/models/organization_membership_with_user.rb +405 -0
  60. data/lib/zyphr/models/organization_response.rb +263 -0
  61. data/lib/zyphr/models/register_request.rb +43 -4
  62. data/lib/zyphr/models/set_domain_inbound_request.rb +220 -0
  63. data/lib/zyphr/models/switch_organization_request.rb +263 -0
  64. data/lib/zyphr/models/switch_organization_response.rb +263 -0
  65. data/lib/zyphr/models/switch_organization_response_data.rb +289 -0
  66. data/lib/zyphr/models/switch_organization_response_data_tokens.rb +339 -0
  67. data/lib/zyphr/models/switch_organization_response_data_user.rb +230 -0
  68. data/lib/zyphr/models/update_organization_member_role_request.rb +223 -0
  69. data/lib/zyphr/models/update_organization_request.rb +239 -0
  70. data/lib/zyphr/models/v1_muse_subjects_suggest_post_request.rb +326 -0
  71. data/lib/zyphr.rb +30 -0
  72. data/spec/api/auth_organizations_api_spec.rb +171 -0
  73. data/spec/api/auth_user_profile_api_spec.rb +12 -0
  74. data/spec/api/domains_api_spec.rb +13 -0
  75. data/spec/api/inbound_email_api_spec.rb +76 -0
  76. data/spec/api/muse_api_spec.rb +156 -0
  77. data/spec/models/add_organization_member_request_spec.rb +42 -0
  78. data/spec/models/create_organization_request_spec.rb +48 -0
  79. data/spec/models/inbound_attachment_url_response_data_spec.rb +48 -0
  80. data/spec/models/inbound_attachment_url_response_spec.rb +42 -0
  81. data/spec/models/inbound_email_attachment_spec.rb +54 -0
  82. data/spec/models/inbound_email_from_spec.rb +42 -0
  83. data/spec/models/inbound_email_list_response_meta_spec.rb +54 -0
  84. data/spec/models/inbound_email_list_response_spec.rb +42 -0
  85. data/spec/models/inbound_email_response_spec.rb +42 -0
  86. data/spec/models/inbound_email_spec.rb +142 -0
  87. data/spec/models/login_request_spec.rb +6 -0
  88. data/spec/models/organization_list_response_meta_spec.rb +42 -0
  89. data/spec/models/organization_list_response_spec.rb +42 -0
  90. data/spec/models/organization_members_list_response_spec.rb +42 -0
  91. data/spec/models/organization_membership_response_spec.rb +42 -0
  92. data/spec/models/organization_membership_spec.rb +72 -0
  93. data/spec/models/organization_membership_with_user_spec.rb +84 -0
  94. data/spec/models/organization_response_spec.rb +42 -0
  95. data/spec/models/organization_spec.rb +84 -0
  96. data/spec/models/register_request_spec.rb +12 -0
  97. data/spec/models/set_domain_inbound_request_spec.rb +36 -0
  98. data/spec/models/switch_organization_request_spec.rb +42 -0
  99. data/spec/models/switch_organization_response_data_spec.rb +48 -0
  100. data/spec/models/switch_organization_response_data_tokens_spec.rb +58 -0
  101. data/spec/models/switch_organization_response_data_user_spec.rb +42 -0
  102. data/spec/models/switch_organization_response_spec.rb +42 -0
  103. data/spec/models/update_organization_member_role_request_spec.rb +36 -0
  104. data/spec/models/update_organization_request_spec.rb +48 -0
  105. data/spec/models/v1_muse_subjects_suggest_post_request_spec.rb +58 -0
  106. data/zyphr.gemspec +1 -1
  107. metadata +122 -2
@@ -0,0 +1,773 @@
1
+ =begin
2
+ #Zyphr API
3
+
4
+ #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@zyphr.dev
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.12.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zyphr
16
+ class AuthOrganizationsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Add a member to an organization
23
+ # @param id [String]
24
+ # @param add_organization_member_request [AddOrganizationMemberRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [OrganizationMembershipResponse]
27
+ def add_organization_member(id, add_organization_member_request, opts = {})
28
+ data, _status_code, _headers = add_organization_member_with_http_info(id, add_organization_member_request, opts)
29
+ data
30
+ end
31
+
32
+ # Add a member to an organization
33
+ # @param id [String]
34
+ # @param add_organization_member_request [AddOrganizationMemberRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(OrganizationMembershipResponse, Integer, Hash)>] OrganizationMembershipResponse data, response status code and response headers
37
+ def add_organization_member_with_http_info(id, add_organization_member_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.add_organization_member ...'
40
+ end
41
+ # verify the required parameter 'id' is set
42
+ if @api_client.config.client_side_validation && id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.add_organization_member"
44
+ end
45
+ # verify the required parameter 'add_organization_member_request' is set
46
+ if @api_client.config.client_side_validation && add_organization_member_request.nil?
47
+ fail ArgumentError, "Missing the required parameter 'add_organization_member_request' when calling AuthOrganizationsApi.add_organization_member"
48
+ end
49
+ # resource path
50
+ local_var_path = '/auth/organizations/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
51
+
52
+ # query parameters
53
+ query_params = opts[:query_params] || {}
54
+
55
+ # header parameters
56
+ header_params = opts[:header_params] || {}
57
+ # HTTP header 'Accept' (if needed)
58
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
59
+ # HTTP header 'Content-Type'
60
+ content_type = @api_client.select_header_content_type(['application/json'])
61
+ if !content_type.nil?
62
+ header_params['Content-Type'] = content_type
63
+ end
64
+
65
+ # form parameters
66
+ form_params = opts[:form_params] || {}
67
+
68
+ # http body (model)
69
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(add_organization_member_request)
70
+
71
+ # return_type
72
+ return_type = opts[:debug_return_type] || 'OrganizationMembershipResponse'
73
+
74
+ # auth_names
75
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
76
+
77
+ new_options = opts.merge(
78
+ :operation => :"AuthOrganizationsApi.add_organization_member",
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names,
84
+ :return_type => return_type
85
+ )
86
+
87
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#add_organization_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
90
+ end
91
+ return data, status_code, headers
92
+ end
93
+
94
+ # Create an organization
95
+ # Create a new organization inside the current application × environment. Membership is many-to-many — add end users via POST /auth/organizations/{id}/members. The Default organization for the environment is auto-created at migration time and cannot be created via API.
96
+ # @param create_organization_request [CreateOrganizationRequest]
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [OrganizationResponse]
99
+ def create_organization(create_organization_request, opts = {})
100
+ data, _status_code, _headers = create_organization_with_http_info(create_organization_request, opts)
101
+ data
102
+ end
103
+
104
+ # Create an organization
105
+ # Create a new organization inside the current application × environment. Membership is many-to-many — add end users via POST /auth/organizations/{id}/members. The Default organization for the environment is auto-created at migration time and cannot be created via API.
106
+ # @param create_organization_request [CreateOrganizationRequest]
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [Array<(OrganizationResponse, Integer, Hash)>] OrganizationResponse data, response status code and response headers
109
+ def create_organization_with_http_info(create_organization_request, opts = {})
110
+ if @api_client.config.debugging
111
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.create_organization ...'
112
+ end
113
+ # verify the required parameter 'create_organization_request' is set
114
+ if @api_client.config.client_side_validation && create_organization_request.nil?
115
+ fail ArgumentError, "Missing the required parameter 'create_organization_request' when calling AuthOrganizationsApi.create_organization"
116
+ end
117
+ # resource path
118
+ local_var_path = '/auth/organizations'
119
+
120
+ # query parameters
121
+ query_params = opts[:query_params] || {}
122
+
123
+ # header parameters
124
+ header_params = opts[:header_params] || {}
125
+ # HTTP header 'Accept' (if needed)
126
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
127
+ # HTTP header 'Content-Type'
128
+ content_type = @api_client.select_header_content_type(['application/json'])
129
+ if !content_type.nil?
130
+ header_params['Content-Type'] = content_type
131
+ end
132
+
133
+ # form parameters
134
+ form_params = opts[:form_params] || {}
135
+
136
+ # http body (model)
137
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization_request)
138
+
139
+ # return_type
140
+ return_type = opts[:debug_return_type] || 'OrganizationResponse'
141
+
142
+ # auth_names
143
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
144
+
145
+ new_options = opts.merge(
146
+ :operation => :"AuthOrganizationsApi.create_organization",
147
+ :header_params => header_params,
148
+ :query_params => query_params,
149
+ :form_params => form_params,
150
+ :body => post_body,
151
+ :auth_names => auth_names,
152
+ :return_type => return_type
153
+ )
154
+
155
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
156
+ if @api_client.config.debugging
157
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#create_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
158
+ end
159
+ return data, status_code, headers
160
+ end
161
+
162
+ # Delete an organization
163
+ # Hard-deletes the org and cascades memberships. The Default organization cannot be deleted.
164
+ # @param id [String]
165
+ # @param [Hash] opts the optional parameters
166
+ # @return [nil]
167
+ def delete_organization(id, opts = {})
168
+ delete_organization_with_http_info(id, opts)
169
+ nil
170
+ end
171
+
172
+ # Delete an organization
173
+ # Hard-deletes the org and cascades memberships. The Default organization cannot be deleted.
174
+ # @param id [String]
175
+ # @param [Hash] opts the optional parameters
176
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
177
+ def delete_organization_with_http_info(id, opts = {})
178
+ if @api_client.config.debugging
179
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.delete_organization ...'
180
+ end
181
+ # verify the required parameter 'id' is set
182
+ if @api_client.config.client_side_validation && id.nil?
183
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.delete_organization"
184
+ end
185
+ # resource path
186
+ local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
187
+
188
+ # query parameters
189
+ query_params = opts[:query_params] || {}
190
+
191
+ # header parameters
192
+ header_params = opts[:header_params] || {}
193
+
194
+ # form parameters
195
+ form_params = opts[:form_params] || {}
196
+
197
+ # http body (model)
198
+ post_body = opts[:debug_body]
199
+
200
+ # return_type
201
+ return_type = opts[:debug_return_type]
202
+
203
+ # auth_names
204
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
205
+
206
+ new_options = opts.merge(
207
+ :operation => :"AuthOrganizationsApi.delete_organization",
208
+ :header_params => header_params,
209
+ :query_params => query_params,
210
+ :form_params => form_params,
211
+ :body => post_body,
212
+ :auth_names => auth_names,
213
+ :return_type => return_type
214
+ )
215
+
216
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
217
+ if @api_client.config.debugging
218
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#delete_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
219
+ end
220
+ return data, status_code, headers
221
+ end
222
+
223
+ # Get organization by id
224
+ # @param id [String]
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [OrganizationResponse]
227
+ def get_organization(id, opts = {})
228
+ data, _status_code, _headers = get_organization_with_http_info(id, opts)
229
+ data
230
+ end
231
+
232
+ # Get organization by id
233
+ # @param id [String]
234
+ # @param [Hash] opts the optional parameters
235
+ # @return [Array<(OrganizationResponse, Integer, Hash)>] OrganizationResponse data, response status code and response headers
236
+ def get_organization_with_http_info(id, opts = {})
237
+ if @api_client.config.debugging
238
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.get_organization ...'
239
+ end
240
+ # verify the required parameter 'id' is set
241
+ if @api_client.config.client_side_validation && id.nil?
242
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.get_organization"
243
+ end
244
+ # resource path
245
+ local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
246
+
247
+ # query parameters
248
+ query_params = opts[:query_params] || {}
249
+
250
+ # header parameters
251
+ header_params = opts[:header_params] || {}
252
+ # HTTP header 'Accept' (if needed)
253
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
254
+
255
+ # form parameters
256
+ form_params = opts[:form_params] || {}
257
+
258
+ # http body (model)
259
+ post_body = opts[:debug_body]
260
+
261
+ # return_type
262
+ return_type = opts[:debug_return_type] || 'OrganizationResponse'
263
+
264
+ # auth_names
265
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
266
+
267
+ new_options = opts.merge(
268
+ :operation => :"AuthOrganizationsApi.get_organization",
269
+ :header_params => header_params,
270
+ :query_params => query_params,
271
+ :form_params => form_params,
272
+ :body => post_body,
273
+ :auth_names => auth_names,
274
+ :return_type => return_type
275
+ )
276
+
277
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
278
+ if @api_client.config.debugging
279
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#get_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
280
+ end
281
+ return data, status_code, headers
282
+ end
283
+
284
+ # List organization members
285
+ # @param id [String]
286
+ # @param [Hash] opts the optional parameters
287
+ # @option opts [Integer] :limit (default to 50)
288
+ # @option opts [String] :cursor
289
+ # @return [OrganizationMembersListResponse]
290
+ def list_organization_members(id, opts = {})
291
+ data, _status_code, _headers = list_organization_members_with_http_info(id, opts)
292
+ data
293
+ end
294
+
295
+ # List organization members
296
+ # @param id [String]
297
+ # @param [Hash] opts the optional parameters
298
+ # @option opts [Integer] :limit (default to 50)
299
+ # @option opts [String] :cursor
300
+ # @return [Array<(OrganizationMembersListResponse, Integer, Hash)>] OrganizationMembersListResponse data, response status code and response headers
301
+ def list_organization_members_with_http_info(id, opts = {})
302
+ if @api_client.config.debugging
303
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organization_members ...'
304
+ end
305
+ # verify the required parameter 'id' is set
306
+ if @api_client.config.client_side_validation && id.nil?
307
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.list_organization_members"
308
+ end
309
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
310
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AuthOrganizationsApi.list_organization_members, must be smaller than or equal to 200.'
311
+ end
312
+
313
+ # resource path
314
+ local_var_path = '/auth/organizations/{id}/members'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
315
+
316
+ # query parameters
317
+ query_params = opts[:query_params] || {}
318
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
319
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
320
+
321
+ # header parameters
322
+ header_params = opts[:header_params] || {}
323
+ # HTTP header 'Accept' (if needed)
324
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
325
+
326
+ # form parameters
327
+ form_params = opts[:form_params] || {}
328
+
329
+ # http body (model)
330
+ post_body = opts[:debug_body]
331
+
332
+ # return_type
333
+ return_type = opts[:debug_return_type] || 'OrganizationMembersListResponse'
334
+
335
+ # auth_names
336
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
337
+
338
+ new_options = opts.merge(
339
+ :operation => :"AuthOrganizationsApi.list_organization_members",
340
+ :header_params => header_params,
341
+ :query_params => query_params,
342
+ :form_params => form_params,
343
+ :body => post_body,
344
+ :auth_names => auth_names,
345
+ :return_type => return_type
346
+ )
347
+
348
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
349
+ if @api_client.config.debugging
350
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organization_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
351
+ end
352
+ return data, status_code, headers
353
+ end
354
+
355
+ # List organizations
356
+ # List organizations in the current environment. Cursor-paginated.
357
+ # @param [Hash] opts the optional parameters
358
+ # @option opts [Integer] :limit (default to 50)
359
+ # @option opts [String] :cursor
360
+ # @option opts [String] :search ILIKE match on name OR slug
361
+ # @return [OrganizationListResponse]
362
+ def list_organizations(opts = {})
363
+ data, _status_code, _headers = list_organizations_with_http_info(opts)
364
+ data
365
+ end
366
+
367
+ # List organizations
368
+ # List organizations in the current environment. Cursor-paginated.
369
+ # @param [Hash] opts the optional parameters
370
+ # @option opts [Integer] :limit (default to 50)
371
+ # @option opts [String] :cursor
372
+ # @option opts [String] :search ILIKE match on name OR slug
373
+ # @return [Array<(OrganizationListResponse, Integer, Hash)>] OrganizationListResponse data, response status code and response headers
374
+ def list_organizations_with_http_info(opts = {})
375
+ if @api_client.config.debugging
376
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organizations ...'
377
+ end
378
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
379
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AuthOrganizationsApi.list_organizations, must be smaller than or equal to 200.'
380
+ end
381
+
382
+ # resource path
383
+ local_var_path = '/auth/organizations'
384
+
385
+ # query parameters
386
+ query_params = opts[:query_params] || {}
387
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
388
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
389
+ query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
390
+
391
+ # header parameters
392
+ header_params = opts[:header_params] || {}
393
+ # HTTP header 'Accept' (if needed)
394
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
395
+
396
+ # form parameters
397
+ form_params = opts[:form_params] || {}
398
+
399
+ # http body (model)
400
+ post_body = opts[:debug_body]
401
+
402
+ # return_type
403
+ return_type = opts[:debug_return_type] || 'OrganizationListResponse'
404
+
405
+ # auth_names
406
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
407
+
408
+ new_options = opts.merge(
409
+ :operation => :"AuthOrganizationsApi.list_organizations",
410
+ :header_params => header_params,
411
+ :query_params => query_params,
412
+ :form_params => form_params,
413
+ :body => post_body,
414
+ :auth_names => auth_names,
415
+ :return_type => return_type
416
+ )
417
+
418
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
419
+ if @api_client.config.debugging
420
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
421
+ end
422
+ return data, status_code, headers
423
+ end
424
+
425
+ # List organizations an end user belongs to
426
+ # Inverse of the membership list — returns all orgs the user is a member of within the current environment. Use this when the orgs[] JWT claim is omitted because the user belongs to more than 50.
427
+ # @param user_id [String]
428
+ # @param [Hash] opts the optional parameters
429
+ # @return [OrganizationListResponse]
430
+ def list_organizations_for_end_user(user_id, opts = {})
431
+ data, _status_code, _headers = list_organizations_for_end_user_with_http_info(user_id, opts)
432
+ data
433
+ end
434
+
435
+ # List organizations an end user belongs to
436
+ # Inverse of the membership list — returns all orgs the user is a member of within the current environment. Use this when the orgs[] JWT claim is omitted because the user belongs to more than 50.
437
+ # @param user_id [String]
438
+ # @param [Hash] opts the optional parameters
439
+ # @return [Array<(OrganizationListResponse, Integer, Hash)>] OrganizationListResponse data, response status code and response headers
440
+ def list_organizations_for_end_user_with_http_info(user_id, opts = {})
441
+ if @api_client.config.debugging
442
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.list_organizations_for_end_user ...'
443
+ end
444
+ # verify the required parameter 'user_id' is set
445
+ if @api_client.config.client_side_validation && user_id.nil?
446
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.list_organizations_for_end_user"
447
+ end
448
+ # resource path
449
+ local_var_path = '/auth/end-users/{user_id}/organizations'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
450
+
451
+ # query parameters
452
+ query_params = opts[:query_params] || {}
453
+
454
+ # header parameters
455
+ header_params = opts[:header_params] || {}
456
+ # HTTP header 'Accept' (if needed)
457
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
458
+
459
+ # form parameters
460
+ form_params = opts[:form_params] || {}
461
+
462
+ # http body (model)
463
+ post_body = opts[:debug_body]
464
+
465
+ # return_type
466
+ return_type = opts[:debug_return_type] || 'OrganizationListResponse'
467
+
468
+ # auth_names
469
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
470
+
471
+ new_options = opts.merge(
472
+ :operation => :"AuthOrganizationsApi.list_organizations_for_end_user",
473
+ :header_params => header_params,
474
+ :query_params => query_params,
475
+ :form_params => form_params,
476
+ :body => post_body,
477
+ :auth_names => auth_names,
478
+ :return_type => return_type
479
+ )
480
+
481
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
482
+ if @api_client.config.debugging
483
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#list_organizations_for_end_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
484
+ end
485
+ return data, status_code, headers
486
+ end
487
+
488
+ # Remove a member from an organization
489
+ # @param id [String]
490
+ # @param user_id [String]
491
+ # @param [Hash] opts the optional parameters
492
+ # @return [nil]
493
+ def remove_organization_member(id, user_id, opts = {})
494
+ remove_organization_member_with_http_info(id, user_id, opts)
495
+ nil
496
+ end
497
+
498
+ # Remove a member from an organization
499
+ # @param id [String]
500
+ # @param user_id [String]
501
+ # @param [Hash] opts the optional parameters
502
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
503
+ def remove_organization_member_with_http_info(id, user_id, opts = {})
504
+ if @api_client.config.debugging
505
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.remove_organization_member ...'
506
+ end
507
+ # verify the required parameter 'id' is set
508
+ if @api_client.config.client_side_validation && id.nil?
509
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.remove_organization_member"
510
+ end
511
+ # verify the required parameter 'user_id' is set
512
+ if @api_client.config.client_side_validation && user_id.nil?
513
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.remove_organization_member"
514
+ end
515
+ # resource path
516
+ local_var_path = '/auth/organizations/{id}/members/{user_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
517
+
518
+ # query parameters
519
+ query_params = opts[:query_params] || {}
520
+
521
+ # header parameters
522
+ header_params = opts[:header_params] || {}
523
+
524
+ # form parameters
525
+ form_params = opts[:form_params] || {}
526
+
527
+ # http body (model)
528
+ post_body = opts[:debug_body]
529
+
530
+ # return_type
531
+ return_type = opts[:debug_return_type]
532
+
533
+ # auth_names
534
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
535
+
536
+ new_options = opts.merge(
537
+ :operation => :"AuthOrganizationsApi.remove_organization_member",
538
+ :header_params => header_params,
539
+ :query_params => query_params,
540
+ :form_params => form_params,
541
+ :body => post_body,
542
+ :auth_names => auth_names,
543
+ :return_type => return_type
544
+ )
545
+
546
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
547
+ if @api_client.config.debugging
548
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#remove_organization_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
549
+ end
550
+ return data, status_code, headers
551
+ end
552
+
553
+ # Switch the active organization on a session
554
+ # Takes a valid refresh token + a target organization the user is a member of, verifies membership at mint time, revokes the old session, and mints a fresh access + refresh pair with `org_id` set to the target. The old refresh token is invalidated (jti rotated). Use this when the user's active workspace changes (the Slack/Linear workspace-switch pattern).
555
+ # @param switch_organization_request [SwitchOrganizationRequest]
556
+ # @param [Hash] opts the optional parameters
557
+ # @return [SwitchOrganizationResponse]
558
+ def switch_organization(switch_organization_request, opts = {})
559
+ data, _status_code, _headers = switch_organization_with_http_info(switch_organization_request, opts)
560
+ data
561
+ end
562
+
563
+ # Switch the active organization on a session
564
+ # Takes a valid refresh token + a target organization the user is a member of, verifies membership at mint time, revokes the old session, and mints a fresh access + refresh pair with &#x60;org_id&#x60; set to the target. The old refresh token is invalidated (jti rotated). Use this when the user&#39;s active workspace changes (the Slack/Linear workspace-switch pattern).
565
+ # @param switch_organization_request [SwitchOrganizationRequest]
566
+ # @param [Hash] opts the optional parameters
567
+ # @return [Array<(SwitchOrganizationResponse, Integer, Hash)>] SwitchOrganizationResponse data, response status code and response headers
568
+ def switch_organization_with_http_info(switch_organization_request, opts = {})
569
+ if @api_client.config.debugging
570
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.switch_organization ...'
571
+ end
572
+ # verify the required parameter 'switch_organization_request' is set
573
+ if @api_client.config.client_side_validation && switch_organization_request.nil?
574
+ fail ArgumentError, "Missing the required parameter 'switch_organization_request' when calling AuthOrganizationsApi.switch_organization"
575
+ end
576
+ # resource path
577
+ local_var_path = '/auth/sessions/switch-organization'
578
+
579
+ # query parameters
580
+ query_params = opts[:query_params] || {}
581
+
582
+ # header parameters
583
+ header_params = opts[:header_params] || {}
584
+ # HTTP header 'Accept' (if needed)
585
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
586
+ # HTTP header 'Content-Type'
587
+ content_type = @api_client.select_header_content_type(['application/json'])
588
+ if !content_type.nil?
589
+ header_params['Content-Type'] = content_type
590
+ end
591
+
592
+ # form parameters
593
+ form_params = opts[:form_params] || {}
594
+
595
+ # http body (model)
596
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(switch_organization_request)
597
+
598
+ # return_type
599
+ return_type = opts[:debug_return_type] || 'SwitchOrganizationResponse'
600
+
601
+ # auth_names
602
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
603
+
604
+ new_options = opts.merge(
605
+ :operation => :"AuthOrganizationsApi.switch_organization",
606
+ :header_params => header_params,
607
+ :query_params => query_params,
608
+ :form_params => form_params,
609
+ :body => post_body,
610
+ :auth_names => auth_names,
611
+ :return_type => return_type
612
+ )
613
+
614
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
615
+ if @api_client.config.debugging
616
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#switch_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
617
+ end
618
+ return data, status_code, headers
619
+ end
620
+
621
+ # Update an organization
622
+ # The Default organization cannot be renamed or have its slug/metadata changed.
623
+ # @param id [String]
624
+ # @param update_organization_request [UpdateOrganizationRequest]
625
+ # @param [Hash] opts the optional parameters
626
+ # @return [OrganizationResponse]
627
+ def update_organization(id, update_organization_request, opts = {})
628
+ data, _status_code, _headers = update_organization_with_http_info(id, update_organization_request, opts)
629
+ data
630
+ end
631
+
632
+ # Update an organization
633
+ # The Default organization cannot be renamed or have its slug/metadata changed.
634
+ # @param id [String]
635
+ # @param update_organization_request [UpdateOrganizationRequest]
636
+ # @param [Hash] opts the optional parameters
637
+ # @return [Array<(OrganizationResponse, Integer, Hash)>] OrganizationResponse data, response status code and response headers
638
+ def update_organization_with_http_info(id, update_organization_request, opts = {})
639
+ if @api_client.config.debugging
640
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.update_organization ...'
641
+ end
642
+ # verify the required parameter 'id' is set
643
+ if @api_client.config.client_side_validation && id.nil?
644
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.update_organization"
645
+ end
646
+ # verify the required parameter 'update_organization_request' is set
647
+ if @api_client.config.client_side_validation && update_organization_request.nil?
648
+ fail ArgumentError, "Missing the required parameter 'update_organization_request' when calling AuthOrganizationsApi.update_organization"
649
+ end
650
+ # resource path
651
+ local_var_path = '/auth/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
652
+
653
+ # query parameters
654
+ query_params = opts[:query_params] || {}
655
+
656
+ # header parameters
657
+ header_params = opts[:header_params] || {}
658
+ # HTTP header 'Accept' (if needed)
659
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
660
+ # HTTP header 'Content-Type'
661
+ content_type = @api_client.select_header_content_type(['application/json'])
662
+ if !content_type.nil?
663
+ header_params['Content-Type'] = content_type
664
+ end
665
+
666
+ # form parameters
667
+ form_params = opts[:form_params] || {}
668
+
669
+ # http body (model)
670
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_request)
671
+
672
+ # return_type
673
+ return_type = opts[:debug_return_type] || 'OrganizationResponse'
674
+
675
+ # auth_names
676
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
677
+
678
+ new_options = opts.merge(
679
+ :operation => :"AuthOrganizationsApi.update_organization",
680
+ :header_params => header_params,
681
+ :query_params => query_params,
682
+ :form_params => form_params,
683
+ :body => post_body,
684
+ :auth_names => auth_names,
685
+ :return_type => return_type
686
+ )
687
+
688
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
689
+ if @api_client.config.debugging
690
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#update_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
691
+ end
692
+ return data, status_code, headers
693
+ end
694
+
695
+ # Update a member's role
696
+ # @param id [String]
697
+ # @param user_id [String]
698
+ # @param update_organization_member_role_request [UpdateOrganizationMemberRoleRequest]
699
+ # @param [Hash] opts the optional parameters
700
+ # @return [OrganizationMembershipResponse]
701
+ def update_organization_member_role(id, user_id, update_organization_member_role_request, opts = {})
702
+ data, _status_code, _headers = update_organization_member_role_with_http_info(id, user_id, update_organization_member_role_request, opts)
703
+ data
704
+ end
705
+
706
+ # Update a member&#39;s role
707
+ # @param id [String]
708
+ # @param user_id [String]
709
+ # @param update_organization_member_role_request [UpdateOrganizationMemberRoleRequest]
710
+ # @param [Hash] opts the optional parameters
711
+ # @return [Array<(OrganizationMembershipResponse, Integer, Hash)>] OrganizationMembershipResponse data, response status code and response headers
712
+ def update_organization_member_role_with_http_info(id, user_id, update_organization_member_role_request, opts = {})
713
+ if @api_client.config.debugging
714
+ @api_client.config.logger.debug 'Calling API: AuthOrganizationsApi.update_organization_member_role ...'
715
+ end
716
+ # verify the required parameter 'id' is set
717
+ if @api_client.config.client_side_validation && id.nil?
718
+ fail ArgumentError, "Missing the required parameter 'id' when calling AuthOrganizationsApi.update_organization_member_role"
719
+ end
720
+ # verify the required parameter 'user_id' is set
721
+ if @api_client.config.client_side_validation && user_id.nil?
722
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling AuthOrganizationsApi.update_organization_member_role"
723
+ end
724
+ # verify the required parameter 'update_organization_member_role_request' is set
725
+ if @api_client.config.client_side_validation && update_organization_member_role_request.nil?
726
+ fail ArgumentError, "Missing the required parameter 'update_organization_member_role_request' when calling AuthOrganizationsApi.update_organization_member_role"
727
+ end
728
+ # resource path
729
+ local_var_path = '/auth/organizations/{id}/members/{user_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
730
+
731
+ # query parameters
732
+ query_params = opts[:query_params] || {}
733
+
734
+ # header parameters
735
+ header_params = opts[:header_params] || {}
736
+ # HTTP header 'Accept' (if needed)
737
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
738
+ # HTTP header 'Content-Type'
739
+ content_type = @api_client.select_header_content_type(['application/json'])
740
+ if !content_type.nil?
741
+ header_params['Content-Type'] = content_type
742
+ end
743
+
744
+ # form parameters
745
+ form_params = opts[:form_params] || {}
746
+
747
+ # http body (model)
748
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_organization_member_role_request)
749
+
750
+ # return_type
751
+ return_type = opts[:debug_return_type] || 'OrganizationMembershipResponse'
752
+
753
+ # auth_names
754
+ auth_names = opts[:debug_auth_names] || ['ApplicationSecret', 'ApplicationPublicKey']
755
+
756
+ new_options = opts.merge(
757
+ :operation => :"AuthOrganizationsApi.update_organization_member_role",
758
+ :header_params => header_params,
759
+ :query_params => query_params,
760
+ :form_params => form_params,
761
+ :body => post_body,
762
+ :auth_names => auth_names,
763
+ :return_type => return_type
764
+ )
765
+
766
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
767
+ if @api_client.config.debugging
768
+ @api_client.config.logger.debug "API called: AuthOrganizationsApi#update_organization_member_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
769
+ end
770
+ return data, status_code, headers
771
+ end
772
+ end
773
+ end