public void WhenCallUmbrellaApiToDefineMembers(Table table) { var parent = context.Get <Models.Company>("parent").Id; var admin = config.UmbrellaAdmin; var cs = table.CreateSet <Models.Company>().Map(x => x.Id).ToList(); var req = new UmbrellaDefinitionRequest(parent, cs); var res = api.CreateUmbrellaWithHttpInfo(admin, req); res.StatusCode.ShouldBe(HttpStatusCode.Created); }
public void WhenUmbrellaIsCreatedAsFollows(Table table) { var parentId = TableUtils.Get(table, "parent"); var children = TableUtils.Get(table, "children").Split(',').Map(s => s.Trim()); var baseurl = TestSetup.Config.datahubUmbrellaApi.baseurl; var api = new DefaultApi(baseurl); try { api.DeleteUmbrellaWithHttpInfo(parentId) .StatusCode.ShouldBe(HttpStatusCode.OK); } catch (ApiException e) { e.ErrorCode.ShouldBe(404); } var request = new UmbrellaDefinitionRequest(parentId, children.ToList()); api.CreateUmbrellaWithHttpInfo(request) .StatusCode.ShouldBe(HttpStatusCode.OK); }
/// <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); }
/// <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 void</returns> public async System.Threading.Tasks.Task CreateUmbrellaAsync(UmbrellaDefinitionRequest umbrellaDefinitionRequest = null) { await CreateUmbrellaAsyncWithHttpInfo(umbrellaDefinitionRequest); }
/// <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></returns> public void CreateUmbrella(UmbrellaDefinitionRequest umbrellaDefinitionRequest = null) { CreateUmbrellaWithHttpInfo(umbrellaDefinitionRequest); }