## # This code was generated by # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # # Twilio - Api # 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 Api < ApiBase class V2010 < Version class AccountContext < InstanceContext class CallContext < InstanceContext class TranscriptionList < ListResource ## # Initialize the TranscriptionList # @param [Version] version Version that contains the resource # @return [TranscriptionList] TranscriptionList def initialize(version, account_sid: nil, call_sid: nil) super(version) # Path Solution @solution = { account_sid: account_sid, call_sid: call_sid } @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Transcriptions.json" end ## # Create the TranscriptionInstance # @param [String] name The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription. # @param [Track] track # @param [String] status_callback_url Absolute URL of the status callback. # @param [String] status_callback_method The http method for the status_callback (one of GET, POST). # @param [String] inbound_track_label Friendly name given to the Inbound Track # @param [String] outbound_track_label Friendly name given to the Outbound Track # @param [Boolean] partial_results Indicates if partial results are going to be sent to the customer # @param [String] language_code Language code used by the transcription engine, specified in [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) format # @param [String] transcription_engine Definition of the transcription engine to be used, among those supported by Twilio # @param [Boolean] profanity_filter indicates if the server will attempt to filter out profanities, replacing all but the initial character in each filtered word with asterisks # @param [String] speech_model Recognition model used by the transcription engine, among those supported by the provider # @param [String] hints A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. # @param [Boolean] enable_automatic_punctuation The provider will add punctuation to recognition result # @return [TranscriptionInstance] Created TranscriptionInstance def create( name: :unset, track: :unset, status_callback_url: :unset, status_callback_method: :unset, inbound_track_label: :unset, outbound_track_label: :unset, partial_results: :unset, language_code: :unset, transcription_engine: :unset, profanity_filter: :unset, speech_model: :unset, hints: :unset, enable_automatic_punctuation: :unset ) data = Twilio::Values.of({ 'Name' => name, 'Track' => track, 'StatusCallbackUrl' => status_callback_url, 'StatusCallbackMethod' => status_callback_method, 'InboundTrackLabel' => inbound_track_label, 'OutboundTrackLabel' => outbound_track_label, 'PartialResults' => partial_results, 'LanguageCode' => language_code, 'TranscriptionEngine' => transcription_engine, 'ProfanityFilter' => profanity_filter, 'SpeechModel' => speech_model, 'Hints' => hints, 'EnableAutomaticPunctuation' => enable_automatic_punctuation, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.create('POST', @uri, data: data, headers: headers) TranscriptionInstance.new( @version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid], ) end # Provide a user friendly representation def to_s '#' end end class TranscriptionContext < InstanceContext ## # Initialize the TranscriptionContext # @param [Version] version Version that contains the resource # @param [String] account_sid The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource. # @param [String] call_sid The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with. # @param [String] sid The SID of the Transcription resource, or the `name` used when creating the resource # @return [TranscriptionContext] TranscriptionContext def initialize(version, account_sid, call_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, call_sid: call_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Transcriptions/#{@solution[:sid]}.json" end ## # Update the TranscriptionInstance # @param [UpdateStatus] status # @return [TranscriptionInstance] Updated TranscriptionInstance def update( status: nil ) data = Twilio::Values.of({ 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) TranscriptionInstance.new( @version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid], sid: @solution[:sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#" end end class TranscriptionPage < Page ## # Initialize the TranscriptionPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [TranscriptionPage] TranscriptionPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of TranscriptionInstance # @param [Hash] payload Payload response from the API # @return [TranscriptionInstance] TranscriptionInstance def get_instance(payload) TranscriptionInstance.new(@version, payload, account_sid: @solution[:account_sid], call_sid: @solution[:call_sid]) end ## # Provide a user friendly representation def to_s '' end end class TranscriptionInstance < InstanceResource ## # Initialize the TranscriptionInstance # @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 Transcription # resource. # @param [String] sid The SID of the Call resource to fetch. # @return [TranscriptionInstance] TranscriptionInstance def initialize(version, payload , account_sid: nil, call_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'call_sid' => payload['call_sid'], 'name' => payload['name'], 'status' => payload['status'], 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'uri' => payload['uri'], } # Context @instance_context = nil @params = { 'account_sid' => account_sid ,'call_sid' => call_sid || @properties['call_sid'] ,'sid' => sid || @properties['sid'] , } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [TranscriptionContext] CallContext for this CallInstance def context unless @instance_context @instance_context = TranscriptionContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid']) end @instance_context end ## # @return [String] The SID of the Transcription resource. def sid @properties['sid'] end ## # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Transcription resource. def account_sid @properties['account_sid'] end ## # @return [String] The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Transcription resource is associated with. def call_sid @properties['call_sid'] end ## # @return [String] The user-specified name of this Transcription, if one was given when the Transcription was created. This may be used to stop the Transcription. def name @properties['name'] end ## # @return [Status] def status @properties['status'] end ## # @return [Time] The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. def date_updated @properties['date_updated'] end ## # @return [String] def uri @properties['uri'] end ## # Update the TranscriptionInstance # @param [UpdateStatus] status # @return [TranscriptionInstance] Updated TranscriptionInstance def update( status: nil ) context.update( status: status, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end