Exemple #1
0
        /// <summary>
        /// Authentication Endpoint
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="responseType"></param>
        /// <param name="clientId"></param>
        /// <param name="redirectUri"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > AuthAsyncWithHttpInfo(string responseType, string clientId, string redirectUri)
        {
            // verify the required parameter 'responseType' is set
            if (responseType == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'responseType' when calling OAuth20Api->Auth");
            }

            // verify the required parameter 'clientId' is set
            if (clientId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'clientId' when calling OAuth20Api->Auth");
            }

            // verify the required parameter 'redirectUri' is set
            if (redirectUri == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'redirectUri' when calling OAuth20Api->Auth");
            }


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

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

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

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

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

            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "response_type", responseType));
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "client_id", clientId));
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "redirect_uri", redirectUri));


            // make the HTTP request

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

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

            return(localVarResponse);
        }
Exemple #2
0
        /// <summary>
        /// Predictor
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="siteId"></param>
        /// <param name="q"></param>
        /// <param name="limit"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > SitesSiteIdDomainDiscoverySearchGetAsyncWithHttpInfo(string siteId, string q, string limit)
        {
            // verify the required parameter 'siteId' is set
            if (siteId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'siteId' when calling CategoriesApi->SitesSiteIdDomainDiscoverySearchGet");
            }

            // verify the required parameter 'q' is set
            if (q == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'q' when calling CategoriesApi->SitesSiteIdDomainDiscoverySearchGet");
            }

            // verify the required parameter 'limit' is set
            if (limit == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'limit' when calling CategoriesApi->SitesSiteIdDomainDiscoverySearchGet");
            }


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

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

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

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

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

            localVarRequestOptions.PathParameters.Add("site_id", MeliLibTools.Client.ClientUtils.ParameterToString(siteId)); // path parameter
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "q", q));
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "limit", limit));


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <Object>("/sites/{site_id}/domain_discovery/search", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        /// Return health by id.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="accessToken"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > ItemsIdHealthGetAsyncWithHttpInfo(string id, string accessToken)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'id' when calling ItemsHealthApi->ItemsIdHealthGet");
            }

            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling ItemsHealthApi->ItemsIdHealthGet");
            }


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

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

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

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

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

            if (id != null)
            {
                localVarRequestOptions.PathParameters.Add("id", MeliLibTools.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            if (accessToken != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));
            }


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <Object>("/items/{id}/health", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #4
0
        /// <summary>
        /// Create a Item.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accessToken"></param>
        /// <param name="item"></param>
        /// <returns>ApiResponse of Object(void)</returns>
        public MeliLibTools.Client.ApiResponse <Object> ItemsPostWithHttpInfo(string accessToken, Item item)
        {
            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling ItemsApi->ItemsPost");
            }

            // verify the required parameter 'item' is set
            if (item == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'item' when calling ItemsApi->ItemsPost");
            }

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

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

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

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

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

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

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

            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));
            localVarRequestOptions.Data = item;


            // make the HTTP request
            var localVarResponse = this.Client.Post <Object>("/items", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #5
0
        /// <summary>
        /// Return health by id.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="accessToken"></param>
        /// <returns>ApiResponse of Object(void)</returns>
        public MeliLibTools.Client.ApiResponse <Object> ItemsIdHealthGetWithHttpInfo(string id, string accessToken)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'id' when calling ItemsHealthApi->ItemsIdHealthGet");
            }

            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling ItemsHealthApi->ItemsIdHealthGet");
            }

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

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

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

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

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

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

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

            localVarRequestOptions.PathParameters.Add("id", MeliLibTools.Client.ClientUtils.ParameterToString(id)); // path parameter
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));


            // make the HTTP request
            var localVarResponse = this.Client.Get <Object>("/items/{id}/health", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        /// Return a categories by site.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="siteId"></param>
        /// <returns>ApiResponse of Object(void)</returns>
        public MeliLibTools.Client.ApiResponse <Object> SitesSiteIdCategoriesGetWithHttpInfo(string siteId)
        {
            // verify the required parameter 'siteId' is set
            if (siteId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'siteId' when calling CategoriesApi->SitesSiteIdCategoriesGet");
            }

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

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

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

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

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

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

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

            if (siteId != null)
            {
                localVarRequestOptions.PathParameters.Add("site_id", MeliLibTools.Client.ClientUtils.ParameterToString(siteId)); // path parameter
            }
            // make the HTTP request
            var localVarResponse = this.Client.Get <Object>("/sites/{site_id}/categories", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
        /// <summary>
        /// Return by category.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="categoryId"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > CategoriesCategoryIdGetAsyncWithHttpInfo(string categoryId)
        {
            // verify the required parameter 'categoryId' is set
            if (categoryId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'categoryId' when calling CategoriesApi->CategoriesCategoryIdGet");
            }


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

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

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

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

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

            if (categoryId != null)
            {
                localVarRequestOptions.PathParameters.Add("category_id", MeliLibTools.Client.ClientUtils.ParameterToString(categoryId)); // path parameter
            }
            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <Object>("/categories/{category_id}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #8
0
        /// <summary>
        /// Create a Item.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accessToken"></param>
        /// <param name="item"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > ItemsPostAsyncWithHttpInfo(string accessToken, Item item)
        {
            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling ItemsApi->ItemsPost");
            }

            // verify the required parameter 'item' is set
            if (item == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'item' when calling ItemsApi->ItemsPost");
            }


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

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

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

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

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

            if (accessToken != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));
            }
            localVarRequestOptions.Data = item;

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

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Object>("/items", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #9
0
        /// <summary>
        /// Update a Item.
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="accessToken"></param>
        /// <param name="item"></param>
        /// <returns>ApiResponse of Object(void)</returns>
        public MeliLibTools.Client.ApiResponse <Object> ItemsIdPutWithHttpInfo(string id, string accessToken, Item item)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'id' when calling ItemsApi->ItemsIdPut");
            }

            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling ItemsApi->ItemsIdPut");
            }

            // verify the required parameter 'item' is set
            if (item == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'item' when calling ItemsApi->ItemsIdPut");
            }

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

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

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

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

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

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

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

            if (id != null)
            {
                localVarRequestOptions.PathParameters.Add("id", MeliLibTools.Client.ClientUtils.ParameterToString(id)); // path parameter
            }
            if (accessToken != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));
            }
            localVarRequestOptions.Data = item;

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

            // make the HTTP request
            var localVarResponse = this.Client.Put <Object>("/items/{id}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #10
0
        /// <summary>
        /// Request Access Token Partner makes a request to the token endpoint by adding the following parameters described below
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="grantType"> (optional)</param>
        /// <param name="clientId"> (optional)</param>
        /// <param name="clientSecret"> (optional)</param>
        /// <param name="redirectUri"> (optional)</param>
        /// <param name="code"> (optional)</param>
        /// <param name="refreshToken"> (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > GetTokenAsyncWithHttpInfo(string grantType = default(string), string clientId = default(string), string clientSecret = default(string), string redirectUri = default(string), string code = default(string), string refreshToken = default(string))
        {
            MeliLibTools.Client.RequestOptions localVarRequestOptions = new MeliLibTools.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/x-www-form-urlencoded"
            };

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

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

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

            if (grantType != null)
            {
                localVarRequestOptions.FormParameters.Add("grant_type", MeliLibTools.Client.ClientUtils.ParameterToString(grantType)); // form parameter
            }
            if (clientId != null)
            {
                localVarRequestOptions.FormParameters.Add("client_id", MeliLibTools.Client.ClientUtils.ParameterToString(clientId)); // form parameter
            }
            if (clientSecret != null)
            {
                localVarRequestOptions.FormParameters.Add("client_secret", MeliLibTools.Client.ClientUtils.ParameterToString(clientSecret)); // form parameter
            }
            if (redirectUri != null)
            {
                localVarRequestOptions.FormParameters.Add("redirect_uri", MeliLibTools.Client.ClientUtils.ParameterToString(redirectUri)); // form parameter
            }
            if (code != null)
            {
                localVarRequestOptions.FormParameters.Add("code", MeliLibTools.Client.ClientUtils.ParameterToString(code)); // form parameter
            }
            if (refreshToken != null)
            {
                localVarRequestOptions.FormParameters.Add("refresh_token", MeliLibTools.Client.ClientUtils.ParameterToString(refreshToken)); // form parameter
            }


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Object>("/oauth/token", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #11
0
        /// <summary>
        /// Authentication Endpoint
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="responseType"></param>
        /// <param name="clientId"></param>
        /// <param name="redirectUri"></param>
        /// <returns>ApiResponse of Object(void)</returns>
        public MeliLibTools.Client.ApiResponse <Object> AuthWithHttpInfo(string responseType, string clientId, string redirectUri)
        {
            // verify the required parameter 'responseType' is set
            if (responseType == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'responseType' when calling OAuth20Api->Auth");
            }

            // verify the required parameter 'clientId' is set
            if (clientId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'clientId' when calling OAuth20Api->Auth");
            }

            // verify the required parameter 'redirectUri' is set
            if (redirectUri == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'redirectUri' when calling OAuth20Api->Auth");
            }

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

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

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

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

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

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

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

            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "response_type", responseType));
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "client_id", clientId));
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "redirect_uri", redirectUri));


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

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

            return(localVarResponse);
        }
Exemple #12
0
        /// <summary>
        /// Request Access Token Partner makes a request to the token endpoint by adding the following parameters described below
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="grantType">Value MUST be set to \&quot;authorization_code\&quot;</param>
        /// <param name="clientId"></param>
        /// <param name="clientSecret"></param>
        /// <param name="redirectUri"></param>
        /// <param name="code">The code received in the query string when redirected from authorization page  (optional)</param>
        /// <param name="refreshToken">The refresh_token received in the query string when redirected from authorization page  (optional)</param>
        /// <returns>Task of ApiResponse (Token)</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Token> > GetTokenAsyncWithHttpInfo(string grantType, string clientId, string clientSecret, string redirectUri, string code = default(string), string refreshToken = default(string))
        {
            // verify the required parameter 'grantType' is set
            if (grantType == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'grantType' when calling OAuth20Api->GetToken");
            }

            // verify the required parameter 'clientId' is set
            if (clientId == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'clientId' when calling OAuth20Api->GetToken");
            }

            // verify the required parameter 'clientSecret' is set
            if (clientSecret == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'clientSecret' when calling OAuth20Api->GetToken");
            }

            // verify the required parameter 'redirectUri' is set
            if (redirectUri == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'redirectUri' when calling OAuth20Api->GetToken");
            }


            MeliLibTools.Client.RequestOptions localVarRequestOptions = new MeliLibTools.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 (grantType != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "grant_type", grantType));
            }
            if (clientId != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "client_id", clientId));
            }
            if (clientSecret != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "client_secret", clientSecret));
            }
            if (redirectUri != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "redirect_uri", redirectUri));
            }
            if (code != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "code", code));
            }
            if (refreshToken != null)
            {
                localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "refresh_token", refreshToken));
            }


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PostAsync <Token>("/oauth/token", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }
Exemple #13
0
        /// <summary>
        /// Resourse path PUT
        /// </summary>
        /// <exception cref="MeliLibTools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="resource"></param>
        /// <param name="accessToken"></param>
        /// <param name="body"></param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <MeliLibTools.Client.ApiResponse <Object> > ResourcePutAsyncWithHttpInfo(string resource, string accessToken, Object body)
        {
            // verify the required parameter 'resource' is set
            if (resource == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'resource' when calling RestClientApi->ResourcePut");
            }

            // verify the required parameter 'accessToken' is set
            if (accessToken == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'accessToken' when calling RestClientApi->ResourcePut");
            }

            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new MeliLibTools.Client.ApiException(400, "Missing required parameter 'body' when calling RestClientApi->ResourcePut");
            }


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

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

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

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

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

            localVarRequestOptions.PathParameters.Add("resource", MeliLibTools.Client.ClientUtils.ParameterToString(resource)); // path parameter
            localVarRequestOptions.QueryParameters.Add(MeliLibTools.Client.ClientUtils.ParameterToMultiMap("", "access_token", accessToken));
            localVarRequestOptions.Data = body;


            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PutAsync <Object>("/{resource}", localVarRequestOptions, this.Configuration);

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

            return(localVarResponse);
        }