コード例 #1
0
        /// <summary>
        /// create umbrella definition
        /// </summary>
        /// <exception cref="GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="umbrellaDefinitionRequest"> (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiResponse <Object> > CreateUmbrellaAsyncWithHttpInfo(UmbrellaDefinitionRequest umbrellaDefinitionRequest = null)
        {
            GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions requestOptions = new GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions();

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

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

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            requestOptions.Data = umbrellaDefinitionRequest;

            // authentication (apiKeyHeader) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key")))
            {
                requestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key"));
            }
            // authentication (apiKeyQuery) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("subscription-key")))
            {
                foreach (var kvp in GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ClientUtils.ParameterToMultiMap("", "subscription-key", this.Configuration.GetApiKeyWithPrefix("subscription-key")))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.PostAsync <Object>("/umbrellaDefinitions", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("CreateUmbrella", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
コード例 #2
0
        /// <summary>
        /// get umbrella candidates
        /// </summary>
        /// <exception cref="GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="companyAccountId">IMIS company id</param>
        /// <returns>Task of ApiResponse (UmbrellaDefinitionResponse)</returns>
        public async System.Threading.Tasks.Task <GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiResponse <UmbrellaDefinitionResponse> > GetUmbrellaCandidatesAsyncWithHttpInfo(string companyAccountId)
        {
            // verify the required parameter 'companyAccountId' is set
            if (companyAccountId == null)
            {
                throw new GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiException(400, "Missing required parameter 'companyAccountId' when calling DefaultApi->GetUmbrellaCandidates");
            }


            GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions requestOptions = new GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

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

            foreach (var contentType in @contentTypes)
            {
                requestOptions.HeaderParameters.Add("Content-Type", contentType);
            }

            foreach (var accept in @accepts)
            {
                requestOptions.HeaderParameters.Add("Accept", accept);
            }

            if (companyAccountId != null)
            {
                requestOptions.PathParameters.Add("companyAccountId", GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ClientUtils.ParameterToString(companyAccountId)); // path parameter
            }
            // authentication (apiKeyHeader) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key")))
            {
                requestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key"));
            }
            // authentication (apiKeyQuery) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("subscription-key")))
            {
                foreach (var kvp in GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ClientUtils.ParameterToMultiMap("", "subscription-key", this.Configuration.GetApiKeyWithPrefix("subscription-key")))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // make the HTTP request

            var response = await this.AsynchronousClient.GetAsync <UmbrellaDefinitionResponse>("/umbrellaCandidates/{companyAccountId}", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("GetUmbrellaCandidates", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }
コード例 #3
0
        /// <summary>
        /// delete umbrella definition
        /// </summary>
        /// <exception cref="GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="companyAccountId">IMIS company id</param>
        /// <returns>ApiResponse of Object(void)</returns>
        public GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiResponse <Object> DeleteUmbrellaWithHttpInfo(string companyAccountId)
        {
            // verify the required parameter 'companyAccountId' is set
            if (companyAccountId == null)
            {
                throw new GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ApiException(400, "Missing required parameter 'companyAccountId' when calling DefaultApi->DeleteUmbrella");
            }

            GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions requestOptions = new GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.RequestOptions();

            String[] @contentTypes = new String[] {
            };

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

            var localVarConentType = ClientUtils.SelectHeaderContentType(@contentTypes);

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

            var localVarAccept = ClientUtils.SelectHeaderAccept(@accepts);

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

            if (companyAccountId != null)
            {
                requestOptions.PathParameters.Add("companyAccountId", GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ClientUtils.ParameterToString(companyAccountId)); // path parameter
            }
            // authentication (apiKeyHeader) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key")))
            {
                requestOptions.HeaderParameters.Add("Ocp-Apim-Subscription-Key", this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key"));
            }
            // authentication (apiKeyQuery) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("subscription-key")))
            {
                foreach (var kvp in GS1US.Tests.Common.APIs.DataHub.Umbrella.Client.ClientUtils.ParameterToMultiMap("", "subscription-key", this.Configuration.GetApiKeyWithPrefix("subscription-key")))
                {
                    foreach (var value in kvp.Value)
                    {
                        requestOptions.QueryParameters.Add(kvp.Key, value);
                    }
                }
            }

            // make the HTTP request

            var response = this.Client.Delete <Object>("/umbrellaDefinitions/{companyAccountId}", requestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception exception = this.ExceptionFactory("DeleteUmbrella", response);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(response);
        }