Skip to content

Latest commit

 

History

History
225 lines (159 loc) · 6.8 KB

InvitationsApi.md

File metadata and controls

225 lines (159 loc) · 6.8 KB

ClerkBackend::InvitationsApi

All URIs are relative to https://api.clerk.com/v1

Method HTTP request Description
create_invitation POST /invitations Create an invitation
list_invitations GET /invitations List all invitations
revoke_invitation POST /invitations/{invitation_id}/revoke Revokes an invitation

create_invitation

create_invitation(opts)

Create an invitation

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.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::InvitationsApi.new
opts = {
  create_invitation_request: ClerkBackend::CreateInvitationRequest.new({email_address: 'email_address_example'}) # CreateInvitationRequest | Required parameters
}

begin
  # Create an invitation
  result = api_instance.create_invitation(opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->create_invitation: #{e}"
end

Using the create_invitation_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_invitation_with_http_info(opts)

begin
  # Create an invitation
  data, status_code, headers = api_instance.create_invitation_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Invitation>
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->create_invitation_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_invitation_request CreateInvitationRequest Required parameters [optional]

Return type

Invitation

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

list_invitations

<Array> list_invitations(opts)

List all invitations

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

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::InvitationsApi.new
opts = {
  limit: 8.14, # Float | Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`.
  offset: 8.14, # Float | Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`.
  status: 'pending' # String | Filter invitations based on their status
}

begin
  # List all invitations
  result = api_instance.list_invitations(opts)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->list_invitations: #{e}"
end

Using the list_invitations_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(<Array>, Integer, Hash)> list_invitations_with_http_info(opts)

begin
  # List all invitations
  data, status_code, headers = api_instance.list_invitations_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Array<Invitation>>
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->list_invitations_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
limit Float Applies a limit to the number of results returned. Can be used for paginating the results together with `offset`. [optional][default to 10]
offset Float Skip the first `offset` results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with `limit`. [optional][default to 0]
status String Filter invitations based on their status [optional]

Return type

Array<Invitation>

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

revoke_invitation

revoke_invitation(invitation_id)

Revokes an invitation

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.

Examples

require 'time'
require 'clerk-sdk-ruby-backend'
# setup authorization
ClerkBackend.configure do |config|
  # Configure Bearer authorization (sk_<environment>_<secret value>): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = ClerkBackend::InvitationsApi.new
invitation_id = 'invitation_id_example' # String | The ID of the invitation to be revoked

begin
  # Revokes an invitation
  result = api_instance.revoke_invitation(invitation_id)
  p result
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->revoke_invitation: #{e}"
end

Using the revoke_invitation_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> revoke_invitation_with_http_info(invitation_id)

begin
  # Revokes an invitation
  data, status_code, headers = api_instance.revoke_invitation_with_http_info(invitation_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <RevokeInvitation200Response>
rescue ClerkBackend::ApiError => e
  puts "Error when calling InvitationsApi->revoke_invitation_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
invitation_id String The ID of the invitation to be revoked

Return type

RevokeInvitation200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json