Exemple #1
0
        /// <summary>
        ///  Play text on a device which supports audioNotification
        /// </summary>
        /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorization">OAuth token</param>
        /// <param name="playtextBody"></param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of PlayedText</returns>
        public async System.Threading.Tasks.Task <PlayedText> PlaytextAsync(string authorization, PlaytextBody playtextBody, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            SmartThingsNet.Client.ApiResponse <PlayedText> localVarResponse = await PlaytextWithHttpInfoAsync(authorization, playtextBody, cancellationToken).ConfigureAwait(false);

            return(localVarResponse.Data);
        }
Exemple #2
0
        /// <summary>
        ///  Play text on a device which supports audioNotification
        /// </summary>
        /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="authorization">OAuth token</param>
        /// <param name="playtextBody"></param>
        /// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
        /// <returns>Task of ApiResponse (PlayedText)</returns>
        public async System.Threading.Tasks.Task <SmartThingsNet.Client.ApiResponse <PlayedText> > PlaytextWithHttpInfoAsync(string authorization, PlaytextBody playtextBody, 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->Playtext");
            }

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


            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 = playtextBody;

            // 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 <PlayedText>("/services/tts/playtext", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);

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

            return(localVarResponse);
        }
Exemple #3
0
 /// <summary>
 ///  Play text on a device which supports audioNotification
 /// </summary>
 /// <exception cref="SmartThingsNet.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="authorization">OAuth token</param>
 /// <param name="playtextBody"></param>
 /// <returns>PlayedText</returns>
 public PlayedText Playtext(string authorization, PlaytextBody playtextBody)
 {
     SmartThingsNet.Client.ApiResponse <PlayedText> localVarResponse = PlaytextWithHttpInfo(authorization, playtextBody);
     return(localVarResponse.Data);
 }