Skip to content

Latest commit

 

History

History
187 lines (127 loc) · 9.14 KB

File metadata and controls

187 lines (127 loc) · 9.14 KB

Invitations

Overview

Available Operations

create

Creates a new invitation for the given email address and sends the invitation email. Keep in mind that you cannot create an invitation if there is already one for the given email address. Also, trying to create an invitation for an email address that already exists in your application will result to an error.

Example Usage

require 'clerk_sdk_ruby'

Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)

req = Models::Operations::CreateInvitationRequest.new(
  email_address: 'user@example.com',
  public_metadata: {

  },
  redirect_url: 'https://example.com/welcome'
)
res = s.invitations.create(request: req)

unless res.invitation.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request Models::Operations::CreateInvitationRequest ✔️ The request object to use for the request.

Response

Crystalline::Nilable.new(Models::Operations::CreateInvitationResponse)

Errors

Error Type Status Code Content Type
Models::Errors::ClerkErrors 400, 422 application/json
Errors::APIError 4XX, 5XX */*

list

Returns all non-revoked invitations for your application, sorted by creation date

Example Usage

require 'clerk_sdk_ruby'

Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)

req = Models::Operations::ListInvitationsRequest.new
res = s.invitations.list(request: req)

unless res.invitation_list.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request Models::Operations::ListInvitationsRequest ✔️ The request object to use for the request.

Response

Crystalline::Nilable.new(Models::Operations::ListInvitationsResponse)

Errors

Error Type Status Code Content Type
Errors::APIError 4XX, 5XX */*

bulk_create

Use this API operation to create multiple invitations for the provided email addresses. You can choose to send the invitations as emails by setting the notify parameter to true. There cannot be an existing invitation for any of the email addresses you provide unless you set ignore_existing to true for specific email addresses. Please note that there must be no existing user for any of the email addresses you provide, and this rule cannot be bypassed.

This endpoint is limited to a maximum of 10 invitations per API call. If you need to send more invitations, please make multiple requests.

Example Usage

require 'clerk_sdk_ruby'

Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)

req = nil
res = s.invitations.bulk_create(request: req)

unless res.invitation_list.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request Crystalline::Array.new(Models::Operations::CreateBulkInvitationsRequestBody) ✔️ The request object to use for the request.

Response

Crystalline::Nilable.new(Models::Operations::CreateBulkInvitationsResponse)

Errors

Error Type Status Code Content Type
Models::Errors::ClerkErrors 400, 422 application/json
Errors::APIError 4XX, 5XX */*

revoke

Revokes the given invitation. Revoking an invitation will prevent the user from using the invitation link that was sent to them. However, it doesn't prevent the user from signing up if they follow the sign up flow. Only active (i.e. non-revoked) invitations can be revoked.

Example Usage

require 'clerk_sdk_ruby'

Models = ::Clerk::Models
s = ::Clerk::OpenAPIClient.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)
res = s.invitations.revoke(invitation_id: 'inv_123')

unless res.invitation_revoked.nil?
  # handle response
end

Parameters

Parameter Type Required Description
invitation_id ::String ✔️ The ID of the invitation to be revoked

Response

Crystalline::Nilable.new(Models::Operations::RevokeInvitationResponse)

Errors

Error Type Status Code Content Type
Models::Errors::ClerkErrors 400, 404 application/json
Errors::APIError 4XX, 5XX */*