Class: Telnyx::Resources::OAuthClients

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/oauth_clients.rb,
sig/telnyx/resources/oauth_clients.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ OAuthClients

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 OAuthClients.

Parameters:



174
175
176
# File 'lib/telnyx/resources/oauth_clients.rb', line 174

def initialize(client:)
  @client = client
end

Instance Method Details

#create(allowed_grant_types:, allowed_scopes:, client_type:, name:, logo_uri: nil, policy_uri: nil, redirect_uris: nil, require_pkce: nil, tos_uri: nil, request_options: {}) ⇒ Telnyx::Models::OAuthClientCreateResponse

Creates a new OAuth client on your account for authenticating third-party integrations, and returns the created client.

Parameters:

  • allowed_grant_types (Array<Symbol, Telnyx::Models::OAuthClientCreateParams::AllowedGrantType>)

    List of allowed OAuth grant types

  • allowed_scopes (Array<String>)

    List of allowed OAuth scopes

  • client_type (Symbol, Telnyx::Models::OAuthClientCreateParams::ClientType)

    OAuth client type

  • name (String)

    The name of the OAuth client

  • logo_uri (String)

    URL of the client logo

  • policy_uri (String)

    URL of the client's privacy policy

  • redirect_uris (Array<String>)

    List of redirect URIs (required for authorization_code flow)

  • require_pkce (Boolean)

    Whether PKCE (Proof Key for Code Exchange) is required for this client

  • tos_uri (String)

    URL of the client's terms of service

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

Returns:

See Also:



34
35
36
37
38
39
40
41
42
43
# File 'lib/telnyx/resources/oauth_clients.rb', line 34

def create(params)
  parsed, options = Telnyx::OAuthClientCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "oauth_clients",
    body: parsed,
    model: Telnyx::Models::OAuthClientCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Permanently deletes the specified OAuth client from your account.

Parameters:

  • id (String)

    OAuth client ID

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

Returns:

  • (nil)

See Also:



162
163
164
165
166
167
168
169
# File 'lib/telnyx/resources/oauth_clients.rb', line 162

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["oauth_clients/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(filter_allowed_grant_types_contains: nil, filter_client_id: nil, filter_client_type: nil, filter_name: nil, filter_name_contains: nil, filter_verified: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::OAuthClient>

Retrieve a paginated list of OAuth clients for the authenticated user

Parameters:

Returns:

See Also:



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/telnyx/resources/oauth_clients.rb', line 129

def list(params = {})
  parsed, options = Telnyx::OAuthClientListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "oauth_clients",
    query: query.transform_keys(
      filter_allowed_grant_types_contains: "filter[allowed_grant_types][contains]",
      filter_client_id: "filter[client_id]",
      filter_client_type: "filter[client_type]",
      filter_name: "filter[name]",
      filter_name_contains: "filter[name][contains]",
      filter_verified: "filter[verified]",
      page_number: "page[number]",
      page_size: "page[size]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::OAuthClient,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::OAuthClientRetrieveResponse

Returns the details of a single OAuth client on your account by its ID.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
# File 'lib/telnyx/resources/oauth_clients.rb', line 56

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["oauth_clients/%1$s", id],
    model: Telnyx::Models::OAuthClientRetrieveResponse,
    options: params[:request_options]
  )
end

#update(id, allowed_grant_types: nil, allowed_scopes: nil, logo_uri: nil, name: nil, policy_uri: nil, redirect_uris: nil, require_pkce: nil, tos_uri: nil, request_options: {}) ⇒ Telnyx::Models::OAuthClientUpdateResponse

Updates the specified OAuth client's configuration and returns the updated client.

Parameters:

  • id (String)

    OAuth client ID

  • allowed_grant_types (Array<Symbol, Telnyx::Models::OAuthClientUpdateParams::AllowedGrantType>)

    List of allowed OAuth grant types

  • allowed_scopes (Array<String>)

    List of allowed OAuth scopes

  • logo_uri (String)

    URL of the client logo

  • name (String)

    The name of the OAuth client

  • policy_uri (String)

    URL of the client's privacy policy

  • redirect_uris (Array<String>)

    List of redirect URIs

  • require_pkce (Boolean)

    Whether PKCE (Proof Key for Code Exchange) is required for this client

  • tos_uri (String)

    URL of the client's terms of service

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

Returns:

See Also:



93
94
95
96
97
98
99
100
101
102
# File 'lib/telnyx/resources/oauth_clients.rb', line 93

def update(id, params = {})
  parsed, options = Telnyx::OAuthClientUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["oauth_clients/%1$s", id],
    body: parsed,
    model: Telnyx::Models::OAuthClientUpdateResponse,
    options: options
  )
end