## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Iam # 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 Iam < IamBase class V1 < Version class NewApiKeyList < ListResource ## # Initialize the NewApiKeyList # @param [Version] version Version that contains the resource # @return [NewApiKeyList] NewApiKeyList def initialize(version) super(version) # Path Solution @solution = { } @uri = "/Keys" end ## # Create the NewApiKeyInstance # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. # @param [String] friendly_name A descriptive string that you create to describe the resource. It can be up to 64 characters long. # @param [Keytype] key_type # @param [Object] policy The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys). # @return [NewApiKeyInstance] Created NewApiKeyInstance def create( account_sid: nil, friendly_name: :unset, key_type: :unset, policy: :unset ) data = Twilio::Values.of({ 'AccountSid' => account_sid, 'FriendlyName' => friendly_name, 'KeyType' => key_type, 'Policy' => Twilio.serialize_object(policy), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.create('POST', @uri, data: data, headers: headers) NewApiKeyInstance.new( @version, payload, ) end # Provide a user friendly representation def to_s '#' end end class NewApiKeyPage < Page ## # Initialize the NewApiKeyPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [NewApiKeyPage] NewApiKeyPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of NewApiKeyInstance # @param [Hash] payload Payload response from the API # @return [NewApiKeyInstance] NewApiKeyInstance def get_instance(payload) NewApiKeyInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s '' end end class NewApiKeyInstance < InstanceResource ## # Initialize the NewApiKeyInstance # @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 NewApiKey # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [NewApiKeyInstance] NewApiKeyInstance def initialize(version, payload ) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'friendly_name' => payload['friendly_name'], 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'secret' => payload['secret'], 'policy' => payload['policy'], } end ## # @return [String] The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. def sid @properties['sid'] end ## # @return [String] The string that you assigned to describe the resource. def friendly_name @properties['friendly_name'] end ## # @return [Time] The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. def date_created @properties['date_created'] end ## # @return [Time] The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. def date_updated @properties['date_updated'] end ## # @return [String] The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** def secret @properties['secret'] end ## # @return [Hash] Collection of allow assertions. def policy @properties['policy'] end ## # Provide a user friendly representation def to_s "" end ## # Provide a detailed, user friendly representation def inspect "" end end end end end end