Ejemplo n.º 1
0
        /// <summary>
        ///  Convert text to speech and return an audio URL. This audio file will be available for 7 days after creation.
        /// </summary>
        /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorization">OAuth token</param>
        /// <param name="tTSBody"></param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ConvertedTTS</returns>
        public async System.Threading.Tasks.Task <ConvertedTTS> TtsAsync(string authorization, TTSBody tTSBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SmartThingsNet.Client.ApiResponse <ConvertedTTS> localVarResponse = await TtsWithHttpInfoAsync(authorization, tTSBody, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Convert text to speech and return an audio URL. This audio file will be available for 7 days after creation.
        /// </summary>
        /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorization">OAuth token</param>
        /// <param name="tTSBody"></param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (ConvertedTTS)</returns>
        public async System.Threading.Tasks.Task <SmartThingsNet.Client.ApiResponse <ConvertedTTS> > TtsWithHttpInfoAsync(string authorization, TTSBody tTSBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // verify the required parameter 'authorization' is set
            if (authorization == null)
            {
                throw new SmartThingsNet.Client.ApiException(400, "Missing required parameter 'authorization' when calling TTSApi->Tts");
            }

            // verify the required parameter 'tTSBody' is set
            if (tTSBody == null)
            {
                throw new SmartThingsNet.Client.ApiException(400, "Missing required parameter 'tTSBody' when calling TTSApi->Tts");
            }


            SmartThingsNet.Client.RequestOptions localVarRequestOptions = new SmartThingsNet.Client.RequestOptions();

            String[] _contentTypes = new String[] { "application/json" };

            // to determine the Accept header
            string[] _accepts = new string[] {
                "application/json"
            };

            var localVarContentType = SmartThingsNet.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

            if (localVarContentType != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
            }

            var localVarAccept = SmartThingsNet.Client.ClientUtils.SelectHeaderAccept(_accepts);

            if (localVarAccept != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
            }


            localVarRequestOptions.Data = tTSBody;

            // authentication (Bearer) required
            // oauth required
            if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization"))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request
            var localVarResponse = await this.AsynchronousClient.PostAsync <ConvertedTTS>("/services/tts", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("Tts", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///  Convert text to speech and return an audio URL. This audio file will be available for 7 days after creation.
 /// </summary>
 /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="authorization">OAuth token</param>
 /// <param name="tTSBody"></param>
 /// <returns>ConvertedTTS</returns>
 public ConvertedTTS Tts(string authorization, TTSBody tTSBody)
 {
     SmartThingsNet.Client.ApiResponse <ConvertedTTS> localVarResponse = TtsWithHttpInfo(authorization, tTSBody);
     return(localVarResponse.Data);
 }