## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Oauth # This is the public Twilio REST API. # # NOTE: This class is auto generated by OpenAPI Generator. # https://openapi-generator.tech # Do not edit the class manually. # module Twilio module REST class Oauth < OauthBase class V1 < Version class TokenList < ListResource ## # Initialize the TokenList # @param [Version] version Version that contains the resource # @return [TokenList] TokenList def initialize(version) super(version) # Path Solution @solution = { } @uri = "/token" end ## # Create the TokenInstance # @param [String] grant_type Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. # @param [String] client_id A 34 character string that uniquely identifies this OAuth App. # @param [String] client_secret The credential for confidential OAuth App. # @param [String] code JWT token related to the authorization code grant type. # @param [String] redirect_uri The redirect uri # @param [String] audience The targeted audience uri # @param [String] refresh_token JWT token related to refresh access token. # @param [String] scope The scope of token # @return [TokenInstance] Created TokenInstance def create( grant_type: nil, client_id: nil, client_secret: :unset, code: :unset, redirect_uri: :unset, audience: :unset, refresh_token: :unset, scope: :unset ) data = Twilio::Values.of({ 'GrantType' => grant_type, 'ClientId' => client_id, 'ClientSecret' => client_secret, 'Code' => code, 'RedirectUri' => redirect_uri, 'Audience' => audience, 'RefreshToken' => refresh_token, 'Scope' => scope, }) payload = @version.create('POST', @uri, data: data) TokenInstance.new( @version, payload, ) end # Provide a user friendly representation def to_s '#' end end class TokenPage < Page ## # Initialize the TokenPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [TokenPage] TokenPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of TokenInstance # @param [Hash] payload Payload response from the API # @return [TokenInstance] TokenInstance def get_instance(payload) TokenInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class TokenInstance < InstanceResource ## # Initialize the TokenInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The SID of the # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Token # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [TokenInstance] TokenInstance def initialize(version, payload ) super(version) # Marshaled Properties @properties = { 'access_token' => payload['access_token'], 'refresh_token' => payload['refresh_token'], 'id_token' => payload['id_token'], 'token_type' => payload['token_type'], 'expires_in' => payload['expires_in'], } end ## # @return [String] Token which carries the necessary information to access a Twilio resource directly. def access_token @properties['access_token'] end ## # @return [String] Token which carries the information necessary to get a new access token. def refresh_token @properties['refresh_token'] end ## # @return [String] Token which carries the information necessary of user profile. def id_token @properties['id_token'] end ## # @return [String] Token type def token_type @properties['token_type'] end ## # @return [String] def expires_in @properties['expires_in'] end ## # Provide a user friendly representation def to_s "" end ## # Provide a detailed, user friendly representation def inspect "" end end end end end end