Exemplo n.º 1
0
        /// <summary>
        ///  Returns API status, and TBA status information.
        /// </summary>
        /// <exception cref="TBAAPI.V3Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="ifModifiedSince">Value of the &#x60;Last-Modified&#x60; header in the most recently cached response by the client. (optional)</param>
        /// <returns>ApiResponse of APIStatus</returns>
        public TBAAPI.V3Client.Client.ApiResponse <APIStatus> GetStatusWithHttpInfo(string ifModifiedSince = default(string))
        {
            TBAAPI.V3Client.Client.RequestOptions localVarRequestOptions = new TBAAPI.V3Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

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

            var localVarContentType = TBAAPI.V3Client.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

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

            var localVarAccept = TBAAPI.V3Client.Client.ClientUtils.SelectHeaderAccept(_accepts);

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

            if (ifModifiedSince != null)
            {
                localVarRequestOptions.HeaderParameters.Add("If-Modified-Since", TBAAPI.V3Client.Client.ClientUtils.ParameterToString(ifModifiedSince)); // header parameter
            }

            // authentication (apiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-TBA-Auth-Key")))
            {
                localVarRequestOptions.HeaderParameters.Add("X-TBA-Auth-Key", this.Configuration.GetApiKeyWithPrefix("X-TBA-Auth-Key"));
            }

            // make the HTTP request
            var localVarResponse = this.Client.Get <APIStatus>("/status", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Returns API status, and TBA status information.
        /// </summary>
        /// <exception cref="TBAAPI.V3Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="ifModifiedSince">Value of the &#x60;Last-Modified&#x60; header in the most recently cached response by the client. (optional)</param>
        /// <returns>Task of ApiResponse (APIStatus)</returns>
        public async System.Threading.Tasks.Task <TBAAPI.V3Client.Client.ApiResponse <APIStatus> > GetStatusAsyncWithHttpInfo(string ifModifiedSince = default(string))
        {
            TBAAPI.V3Client.Client.RequestOptions localVarRequestOptions = new TBAAPI.V3Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

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

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            if (ifModifiedSince != null)
            {
                localVarRequestOptions.HeaderParameters.Add("If-Modified-Since", TBAAPI.V3Client.Client.ClientUtils.ParameterToString(ifModifiedSince)); // header parameter
            }

            // authentication (apiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-TBA-Auth-Key")))
            {
                localVarRequestOptions.HeaderParameters.Add("X-TBA-Auth-Key", this.Configuration.GetApiKeyWithPrefix("X-TBA-Auth-Key"));
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <APIStatus>("/status", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }