Class: Privy::Resources::Apps::Allowlist

Inherits:
Object
  • Object
show all
Defined in:
lib/privy/resources/apps/allowlist.rb

Overview

Operations related to app settings and allowlist management

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Allowlist

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Allowlist.

Parameters:



80
81
82
# File 'lib/privy/resources/apps/allowlist.rb', line 80

def initialize(client:)
  @client = client
end

Instance Method Details

#create(app_id, user_invite_input:, request_options: {}) ⇒ Privy::Models::AllowlistEntry

Add a new entry to the allowlist for an app. The allowlist must be enabled.

Parameters:

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/privy/resources/apps/allowlist.rb', line 21

def create(app_id, params)
  parsed, options = Privy::Apps::AllowlistCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/apps/%1$s/allowlist", app_id],
    body: parsed[:user_invite_input],
    model: Privy::AllowlistEntry,
    options: options
  )
end

#delete(app_id, user_invite_input:, request_options: {}) ⇒ Privy::Models::AllowlistDeletionResponse

Remove an entry from the allowlist for an app. The allowlist must be enabled.

Parameters:

Returns:

See Also:



66
67
68
69
70
71
72
73
74
75
# File 'lib/privy/resources/apps/allowlist.rb', line 66

def delete(app_id, params)
  parsed, options = Privy::Apps::AllowlistDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/apps/%1$s/allowlist", app_id],
    body: parsed[:user_invite_input],
    model: Privy::AllowlistDeletionResponse,
    options: options
  )
end

#list(app_id, request_options: {}) ⇒ Array<Privy::Models::AllowlistEntry>

Get all allowlist entries for an app. Returns the list of users allowed to access the app when the allowlist is enabled.

Parameters:

  • app_id (String)

    The ID of the app.

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



44
45
46
47
48
49
50
51
# File 'lib/privy/resources/apps/allowlist.rb', line 44

def list(app_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/apps/%1$s/allowlist", app_id],
    model: Privy::Internal::Type::ArrayOf[Privy::AllowlistEntry],
    options: params[:request_options]
  )
end