Class: Telnyx::Resources::OAuthClients

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

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:



172
173
174
# File 'lib/telnyx/resources/oauth_clients.rb', line 172

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

Create a new OAuth 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:



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

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

Delete an OAuth client

Parameters:

Returns:

  • (nil)

See Also:



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

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:



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

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

Retrieve a single OAuth client by ID

Parameters:

Returns:

See Also:



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

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

Update an existing OAuth 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:



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

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