Class: ClerkHttpClient::OrganizationInvitationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/clerk-http-client/api/organization_invitations_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OrganizationInvitationsApi

Returns a new instance of OrganizationInvitationsApi.



19
20
21
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_organization_invitation(organization_id, opts = {}) ⇒ OrganizationInvitation

Create and send an organization invitation Creates a new organization invitation and sends an email to the provided ‘email_address` with a link to accept the invitation and join the organization. You can specify the `role` for the invited organization member. New organization invitations get a "pending" status until they are revoked by an organization administrator or accepted by the invitee. The request body supports passing an optional `redirect_url` parameter. When the invited user clicks the link to accept the invitation, they will be redirected to the URL provided. Use this parameter to implement a custom invitation acceptance flow. You can specify the ID of the user that will send the invitation with the `inviter_user_id` parameter. That user must be a member with administrator privileges in the organization. Only "admin" members can create organization invitations. You can optionally provide public and private metadata for the organization invitation. The public metadata are visible by both the Frontend and the Backend whereas the private ones only by the Backend. When the organization invitation is accepted, the metadata will be transferred to the newly created organization membership.

Parameters:

  • organization_id (String)

    The ID of the organization for which to send the invitation

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



29
30
31
32
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 29

def create_organization_invitation(organization_id, opts = {})
  data, _status_code, _headers = create_organization_invitation_with_http_info(organization_id, opts)
  data
end

#create_organization_invitation_bulk(organization_id, create_organization_invitation_bulk_request_inner, opts = {}) ⇒ OrganizationInvitations

Bulk create and send organization invitations Creates new organization invitations in bulk and sends out emails to the provided email addresses with a link to accept the invitation and join the organization. You can specify a different ‘role` for each invited organization member. New organization invitations get a "pending" status until they are revoked by an organization administrator or accepted by the invitee. The request body supports passing an optional `redirect_url` parameter for each invitation. When the invited user clicks the link to accept the invitation, they will be redirected to the provided URL. Use this parameter to implement a custom invitation acceptance flow. You can specify the ID of the user that will send the invitation with the `inviter_user_id` parameter. Each invitation can have a different inviter user. Inviter users must be members with administrator privileges in the organization. Only "admin" members can create organization invitations. You can optionally provide public and private metadata for each organization invitation. The public metadata are visible by both the Frontend and the Backend, whereas the private metadata are only visible by the Backend. When the organization invitation is accepted, the metadata will be transferred to the newly created organization membership.

Parameters:

Returns:



101
102
103
104
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 101

def create_organization_invitation_bulk(organization_id, create_organization_invitation_bulk_request_inner, opts = {})
  data, _status_code, _headers = create_organization_invitation_bulk_with_http_info(organization_id, create_organization_invitation_bulk_request_inner, opts)
  data
end

#create_organization_invitation_bulk_with_http_info(organization_id, create_organization_invitation_bulk_request_inner, opts = {}) ⇒ Array<(OrganizationInvitations, Integer, Hash)>

Bulk create and send organization invitations Creates new organization invitations in bulk and sends out emails to the provided email addresses with a link to accept the invitation and join the organization. You can specify a different &#x60;role&#x60; for each invited organization member. New organization invitations get a &quot;pending&quot; status until they are revoked by an organization administrator or accepted by the invitee. The request body supports passing an optional &#x60;redirect_url&#x60; parameter for each invitation. When the invited user clicks the link to accept the invitation, they will be redirected to the provided URL. Use this parameter to implement a custom invitation acceptance flow. You can specify the ID of the user that will send the invitation with the &#x60;inviter_user_id&#x60; parameter. Each invitation can have a different inviter user. Inviter users must be members with administrator privileges in the organization. Only &quot;admin&quot; members can create organization invitations. You can optionally provide public and private metadata for each organization invitation. The public metadata are visible by both the Frontend and the Backend, whereas the private metadata are only visible by the Backend. When the organization invitation is accepted, the metadata will be transferred to the newly created organization membership. POST

Parameters:

Returns:

  • (Array<(OrganizationInvitations, Integer, Hash)>)

    OrganizationInvitations data, response status code and response headers



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 113

def create_organization_invitation_bulk_with_http_info(organization_id, create_organization_invitation_bulk_request_inner, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.create_organization_invitation_bulk ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.create_organization_invitation_bulk"
  end
  # verify the required parameter 'create_organization_invitation_bulk_request_inner' is set
  if @api_client.config.client_side_validation && create_organization_invitation_bulk_request_inner.nil?
    fail ArgumentError, "Missing the required parameter 'create_organization_invitation_bulk_request_inner' when calling OrganizationInvitationsApi.create_organization_invitation_bulk"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/invitations/bulk'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization_invitation_bulk_request_inner)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitations'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.create_organization_invitation_bulk",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#create_organization_invitation_bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_organization_invitation_with_http_info(organization_id, opts = {}) ⇒ Array<(OrganizationInvitation, Integer, Hash)>

Create and send an organization invitation Creates a new organization invitation and sends an email to the provided &#x60;email_address&#x60; with a link to accept the invitation and join the organization. You can specify the &#x60;role&#x60; for the invited organization member. New organization invitations get a &quot;pending&quot; status until they are revoked by an organization administrator or accepted by the invitee. The request body supports passing an optional &#x60;redirect_url&#x60; parameter. When the invited user clicks the link to accept the invitation, they will be redirected to the URL provided. Use this parameter to implement a custom invitation acceptance flow. You can specify the ID of the user that will send the invitation with the &#x60;inviter_user_id&#x60; parameter. That user must be a member with administrator privileges in the organization. Only &quot;admin&quot; members can create organization invitations. You can optionally provide public and private metadata for the organization invitation. The public metadata are visible by both the Frontend and the Backend whereas the private ones only by the Backend. When the organization invitation is accepted, the metadata will be transferred to the newly created organization membership. POST

Parameters:

  • organization_id (String)

    The ID of the organization for which to send the invitation

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(OrganizationInvitation, Integer, Hash)>)

    OrganizationInvitation data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 41

def create_organization_invitation_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.create_organization_invitation ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.create_organization_invitation"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/invitations'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_organization_invitation_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitation'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.create_organization_invitation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#create_organization_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_organization_invitation(organization_id, invitation_id, opts = {}) ⇒ OrganizationInvitation

Retrieve an organization invitation by ID Use this request to get an existing organization invitation by ID.

Parameters:

  • organization_id (String)

    The organization ID.

  • invitation_id (String)

    The organization invitation ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



177
178
179
180
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 177

def get_organization_invitation(organization_id, invitation_id, opts = {})
  data, _status_code, _headers = get_organization_invitation_with_http_info(organization_id, invitation_id, opts)
  data
end

#get_organization_invitation_with_http_info(organization_id, invitation_id, opts = {}) ⇒ Array<(OrganizationInvitation, Integer, Hash)>

Retrieve an organization invitation by ID Use this request to get an existing organization invitation by ID. GET

Parameters:

  • organization_id (String)

    The organization ID.

  • invitation_id (String)

    The organization invitation ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrganizationInvitation, Integer, Hash)>)

    OrganizationInvitation data, response status code and response headers



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 189

def get_organization_invitation_with_http_info(organization_id, invitation_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.get_organization_invitation ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.get_organization_invitation"
  end
  # verify the required parameter 'invitation_id' is set
  if @api_client.config.client_side_validation && invitation_id.nil?
    fail ArgumentError, "Missing the required parameter 'invitation_id' when calling OrganizationInvitationsApi.get_organization_invitation"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/invitations/{invitation_id}'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s)).sub('{' + 'invitation_id' + '}', CGI.escape(invitation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitation'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.get_organization_invitation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#get_organization_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_instance_organization_invitations(opts = {}) ⇒ OrganizationInvitationsWithPublicOrganizationData

Get a list of organization invitations for the current instance This request returns the list of organization invitations for the instance. Results can be paginated using the optional ‘limit` and `offset` query parameters. You can filter them by providing the ’status’ query parameter, that accepts multiple values. You can change the order by providing the ‘order’ query parameter, that accepts multiple values. You can filter by the invited user email address providing the ‘query` query parameter. The organization invitations are ordered by descending creation date by default.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :order_by (String)

    Allows to return organization invitations in a particular order. At the moment, you can order the returned organization invitations either by their &#x60;created_at&#x60; or &#x60;email_address&#x60;. In order to specify the direction, you can use the &#x60;+/-&#x60; symbols prepended in the property to order by. For example, if you want organization invitations to be returned in descending order according to their &#x60;created_at&#x60; property, you can use &#x60;-created_at&#x60;. If you don&#39;t use &#x60;+&#x60; or &#x60;-&#x60;, then &#x60;+&#x60; is implied. Defaults to &#x60;-created_at&#x60;. (default to ‘-created_at’)

  • :status (String)

    Filter organization invitations based on their status

  • :query (String)

    Filter organization invitations based on their &#x60;email_address&#x60;

Returns:



251
252
253
254
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 251

def list_instance_organization_invitations(opts = {})
  data, _status_code, _headers = list_instance_organization_invitations_with_http_info(opts)
  data
end

#list_instance_organization_invitations_with_http_info(opts = {}) ⇒ Array<(OrganizationInvitationsWithPublicOrganizationData, Integer, Hash)>

Get a list of organization invitations for the current instance This request returns the list of organization invitations for the instance. Results can be paginated using the optional &#x60;limit&#x60; and &#x60;offset&#x60; query parameters. You can filter them by providing the &#39;status&#39; query parameter, that accepts multiple values. You can change the order by providing the &#39;order&#39; query parameter, that accepts multiple values. You can filter by the invited user email address providing the &#x60;query&#x60; query parameter. The organization invitations are ordered by descending creation date by default. GET

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :order_by (String)

    Allows to return organization invitations in a particular order. At the moment, you can order the returned organization invitations either by their &#x60;created_at&#x60; or &#x60;email_address&#x60;. In order to specify the direction, you can use the &#x60;+/-&#x60; symbols prepended in the property to order by. For example, if you want organization invitations to be returned in descending order according to their &#x60;created_at&#x60; property, you can use &#x60;-created_at&#x60;. If you don&#39;t use &#x60;+&#x60; or &#x60;-&#x60;, then &#x60;+&#x60; is implied. Defaults to &#x60;-created_at&#x60;. (default to ‘-created_at’)

  • :status (String)

    Filter organization invitations based on their status

  • :query (String)

    Filter organization invitations based on their &#x60;email_address&#x60;

Returns:



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 266

def list_instance_organization_invitations_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.list_instance_organization_invitations ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_instance_organization_invitations, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_instance_organization_invitations, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling OrganizationInvitationsApi.list_instance_organization_invitations, must be greater than or equal to 0.'
  end

  allowable_values = ["pending", "accepted", "revoked"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/organization_invitations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitationsWithPublicOrganizationData'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.list_instance_organization_invitations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#list_instance_organization_invitations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_organization_invitations(organization_id, opts = {}) ⇒ OrganizationInvitations

Get a list of organization invitations This request returns the list of organization invitations. Results can be paginated using the optional ‘limit` and `offset` query parameters. You can filter them by providing the ’status’ query parameter, that accepts multiple values. The organization invitations are ordered by descending creation date. Most recent invitations will be returned first. Any invitations created as a result of an Organization Domain are not included in the results.

Parameters:

  • organization_id (String)

    The organization ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :status (String)

    Filter organization invitations based on their status

Returns:



340
341
342
343
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 340

def list_organization_invitations(organization_id, opts = {})
  data, _status_code, _headers = list_organization_invitations_with_http_info(organization_id, opts)
  data
end

#list_organization_invitations_with_http_info(organization_id, opts = {}) ⇒ Array<(OrganizationInvitations, Integer, Hash)>

Get a list of organization invitations This request returns the list of organization invitations. Results can be paginated using the optional &#x60;limit&#x60; and &#x60;offset&#x60; query parameters. You can filter them by providing the &#39;status&#39; query parameter, that accepts multiple values. The organization invitations are ordered by descending creation date. Most recent invitations will be returned first. Any invitations created as a result of an Organization Domain are not included in the results. GET

Parameters:

  • organization_id (String)

    The organization ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

  • :status (String)

    Filter organization invitations based on their status

Returns:

  • (Array<(OrganizationInvitations, Integer, Hash)>)

    OrganizationInvitations data, response status code and response headers



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 354

def list_organization_invitations_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.list_organization_invitations ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.list_organization_invitations"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_organization_invitations, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_organization_invitations, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling OrganizationInvitationsApi.list_organization_invitations, must be greater than or equal to 0.'
  end

  allowable_values = ["pending", "accepted", "revoked"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/invitations'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitations'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.list_organization_invitations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#list_organization_invitations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_pending_organization_invitations(organization_id, opts = {}) ⇒ OrganizationInvitations

Get a list of pending organization invitations This request returns the list of organization invitations with "pending" status. These are the organization invitations that can still be used to join the organization, but have not been accepted by the invited user yet. Results can be paginated using the optional ‘limit` and `offset` query parameters. The organization invitations are ordered by descending creation date. Most recent invitations will be returned first. Any invitations created as a result of an Organization Domain are not included in the results.

Parameters:

  • organization_id (String)

    The organization ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

Returns:



429
430
431
432
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 429

def list_pending_organization_invitations(organization_id, opts = {})
  data, _status_code, _headers = list_pending_organization_invitations_with_http_info(organization_id, opts)
  data
end

#list_pending_organization_invitations_with_http_info(organization_id, opts = {}) ⇒ Array<(OrganizationInvitations, Integer, Hash)>

Get a list of pending organization invitations This request returns the list of organization invitations with &quot;pending&quot; status. These are the organization invitations that can still be used to join the organization, but have not been accepted by the invited user yet. Results can be paginated using the optional &#x60;limit&#x60; and &#x60;offset&#x60; query parameters. The organization invitations are ordered by descending creation date. Most recent invitations will be returned first. Any invitations created as a result of an Organization Domain are not included in the results. GET

Parameters:

  • organization_id (String)

    The organization ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Float)

    Applies a limit to the number of results returned. Can be used for paginating the results together with &#x60;offset&#x60;. (default to 10)

  • :offset (Float)

    Skip the first &#x60;offset&#x60; results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with &#x60;limit&#x60;. (default to 0)

Returns:

  • (Array<(OrganizationInvitations, Integer, Hash)>)

    OrganizationInvitations data, response status code and response headers



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 442

def list_pending_organization_invitations_with_http_info(organization_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.list_pending_organization_invitations ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.list_pending_organization_invitations"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_pending_organization_invitations, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling OrganizationInvitationsApi.list_pending_organization_invitations, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling OrganizationInvitationsApi.list_pending_organization_invitations, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = '/organizations/{organization_id}/invitations/pending'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitations'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.list_pending_organization_invitations",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#list_pending_organization_invitations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#revoke_organization_invitation(organization_id, invitation_id, opts = {}) ⇒ OrganizationInvitation

Revoke a pending organization invitation Use this request to revoke a previously issued organization invitation. Revoking an organization invitation makes it invalid; the invited user will no longer be able to join the organization with the revoked invitation. Only organization invitations with "pending" status can be revoked. The request accepts the ‘requesting_user_id` parameter to specify the user which revokes the invitation. Only users with "admin" role can revoke invitations.

Parameters:

  • organization_id (String)

    The organization ID.

  • invitation_id (String)

    The organization invitation ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



512
513
514
515
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 512

def revoke_organization_invitation(organization_id, invitation_id, opts = {})
  data, _status_code, _headers = revoke_organization_invitation_with_http_info(organization_id, invitation_id, opts)
  data
end

#revoke_organization_invitation_with_http_info(organization_id, invitation_id, opts = {}) ⇒ Array<(OrganizationInvitation, Integer, Hash)>

Revoke a pending organization invitation Use this request to revoke a previously issued organization invitation. Revoking an organization invitation makes it invalid; the invited user will no longer be able to join the organization with the revoked invitation. Only organization invitations with &quot;pending&quot; status can be revoked. The request accepts the &#x60;requesting_user_id&#x60; parameter to specify the user which revokes the invitation. Only users with &quot;admin&quot; role can revoke invitations. POST

Parameters:

  • organization_id (String)

    The organization ID.

  • invitation_id (String)

    The organization invitation ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(OrganizationInvitation, Integer, Hash)>)

    OrganizationInvitation data, response status code and response headers



525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/clerk-http-client/api/organization_invitations_api.rb', line 525

def revoke_organization_invitation_with_http_info(organization_id, invitation_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationInvitationsApi.revoke_organization_invitation ...'
  end
  # verify the required parameter 'organization_id' is set
  if @api_client.config.client_side_validation && organization_id.nil?
    fail ArgumentError, "Missing the required parameter 'organization_id' when calling OrganizationInvitationsApi.revoke_organization_invitation"
  end
  # verify the required parameter 'invitation_id' is set
  if @api_client.config.client_side_validation && invitation_id.nil?
    fail ArgumentError, "Missing the required parameter 'invitation_id' when calling OrganizationInvitationsApi.revoke_organization_invitation"
  end
  # resource path
  local_var_path = '/organizations/{organization_id}/invitations/{invitation_id}/revoke'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s)).sub('{' + 'invitation_id' + '}', CGI.escape(invitation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'revoke_organization_invitation_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationInvitation'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"OrganizationInvitationsApi.revoke_organization_invitation",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationInvitationsApi#revoke_organization_invitation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end