Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="GhostNetwork.Reactions.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="key"></param>
        /// <param name="author"></param>
        /// <returns>ApiResponse of Dictionary&lt;string, int&gt;</returns>
        public GhostNetwork.Reactions.Client.ApiResponse <Dictionary <string, int> > ReactionsDeleteWithHttpInfo(string key, string author)
        {
            // verify the required parameter 'key' is set
            if (key == null)
            {
                throw new GhostNetwork.Reactions.Client.ApiException(400, "Missing required parameter 'key' when calling ReactionsApi->ReactionsDelete");
            }

            // verify the required parameter 'author' is set
            if (author == null)
            {
                throw new GhostNetwork.Reactions.Client.ApiException(400, "Missing required parameter 'author' when calling ReactionsApi->ReactionsDelete");
            }

            GhostNetwork.Reactions.Client.RequestOptions localVarRequestOptions = new GhostNetwork.Reactions.Client.RequestOptions();

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

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

            var localVarContentType = GhostNetwork.Reactions.Client.ClientUtils.SelectHeaderContentType(_contentTypes);

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

            var localVarAccept = GhostNetwork.Reactions.Client.ClientUtils.SelectHeaderAccept(_accepts);

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

            localVarRequestOptions.PathParameters.Add("key", GhostNetwork.Reactions.Client.ClientUtils.ParameterToString(key));         // path parameter
            localVarRequestOptions.HeaderParameters.Add("author", GhostNetwork.Reactions.Client.ClientUtils.ParameterToString(author)); // header parameter


            // make the HTTP request
            var localVarResponse = this.Client.Delete <Dictionary <string, int> >("/Reactions/{key}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="GhostNetwork.Reactions.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="key"></param>
        /// <returns>Task of ApiResponse (Dictionary&lt;string, int&gt;)</returns>
        public async System.Threading.Tasks.Task <GhostNetwork.Reactions.Client.ApiResponse <Dictionary <string, int> > > ReactionsGetAsyncWithHttpInfo(string key)
        {
            // verify the required parameter 'key' is set
            if (key == null)
            {
                throw new GhostNetwork.Reactions.Client.ApiException(400, "Missing required parameter 'key' when calling ReactionsApi->ReactionsGet");
            }


            GhostNetwork.Reactions.Client.RequestOptions localVarRequestOptions = new GhostNetwork.Reactions.Client.RequestOptions();

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

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

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

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

            localVarRequestOptions.PathParameters.Add("key", GhostNetwork.Reactions.Client.ClientUtils.ParameterToString(key)); // path parameter


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <Dictionary <string, int> >("/Reactions/{key}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }