|
| 1 | + |
| 2 | +package com.commercetools.importapi.client; |
| 3 | + |
| 4 | +import java.net.URI; |
| 5 | +import java.time.Duration; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.List; |
| 8 | +import java.util.concurrent.CompletableFuture; |
| 9 | + |
| 10 | +import com.fasterxml.jackson.core.type.TypeReference; |
| 11 | + |
| 12 | +import io.vrap.rmf.base.client.*; |
| 13 | +import io.vrap.rmf.base.client.utils.Generated; |
| 14 | + |
| 15 | +import org.apache.commons.lang3.builder.EqualsBuilder; |
| 16 | +import org.apache.commons.lang3.builder.HashCodeBuilder; |
| 17 | + |
| 18 | +/** |
| 19 | + * <p>Creates an Import Request for Business Units.</p> |
| 20 | + * |
| 21 | + * <hr> |
| 22 | + * <div class=code-example> |
| 23 | + * <pre><code class='java'>{@code |
| 24 | + * CompletableFuture<ApiHttpResponse<com.commercetools.importapi.models.importrequests.ImportResponse>> result = apiRoot |
| 25 | + * .withProjectKeyValue("{projectKey}") |
| 26 | + * .businessUnits() |
| 27 | + * .importContainers() |
| 28 | + * .withImportContainerKeyValue("{importContainerKey}") |
| 29 | + * .post(null) |
| 30 | + * .execute() |
| 31 | + * }</code></pre> |
| 32 | + * </div> |
| 33 | + */ |
| 34 | +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") |
| 35 | +public class ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost extends |
| 36 | + TypeBodyApiMethod<ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost, com.commercetools.importapi.models.importrequests.ImportResponse, com.commercetools.importapi.models.importrequests.BusinessUnitImportRequest> |
| 37 | + implements |
| 38 | + com.commercetools.importapi.client.Secured_by_manage_business_unitsTrait<ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost> { |
| 39 | + |
| 40 | + @Override |
| 41 | + public TypeReference<com.commercetools.importapi.models.importrequests.ImportResponse> resultType() { |
| 42 | + return new TypeReference<com.commercetools.importapi.models.importrequests.ImportResponse>() { |
| 43 | + }; |
| 44 | + } |
| 45 | + |
| 46 | + private String projectKey; |
| 47 | + private String importContainerKey; |
| 48 | + |
| 49 | + private com.commercetools.importapi.models.importrequests.BusinessUnitImportRequest businessUnitImportRequest; |
| 50 | + |
| 51 | + public ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost(final ApiHttpClient apiHttpClient, |
| 52 | + String projectKey, String importContainerKey, |
| 53 | + com.commercetools.importapi.models.importrequests.BusinessUnitImportRequest businessUnitImportRequest) { |
| 54 | + super(apiHttpClient); |
| 55 | + this.projectKey = projectKey; |
| 56 | + this.importContainerKey = importContainerKey; |
| 57 | + this.businessUnitImportRequest = businessUnitImportRequest; |
| 58 | + } |
| 59 | + |
| 60 | + public ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost( |
| 61 | + ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost t) { |
| 62 | + super(t); |
| 63 | + this.projectKey = t.projectKey; |
| 64 | + this.importContainerKey = t.importContainerKey; |
| 65 | + this.businessUnitImportRequest = t.businessUnitImportRequest; |
| 66 | + } |
| 67 | + |
| 68 | + @Override |
| 69 | + protected ApiHttpRequest buildHttpRequest() { |
| 70 | + List<String> params = new ArrayList<>(getQueryParamUriStrings()); |
| 71 | + String httpRequestPath = String.format("%s/business-units/import-containers/%s", |
| 72 | + encodePathParam(this.projectKey), encodePathParam(this.importContainerKey)); |
| 73 | + if (!params.isEmpty()) { |
| 74 | + httpRequestPath += "?" + String.join("&", params); |
| 75 | + } |
| 76 | + return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(), |
| 77 | + io.vrap.rmf.base.client.utils.json.JsonUtils.executing( |
| 78 | + () -> apiHttpClient().getSerializerService().toJsonByteArray(businessUnitImportRequest))); |
| 79 | + |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public ApiHttpResponse<com.commercetools.importapi.models.importrequests.ImportResponse> executeBlocking( |
| 84 | + final ApiHttpClient client, final Duration timeout) { |
| 85 | + return executeBlocking(client, timeout, com.commercetools.importapi.models.importrequests.ImportResponse.class); |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public CompletableFuture<ApiHttpResponse<com.commercetools.importapi.models.importrequests.ImportResponse>> execute( |
| 90 | + final ApiHttpClient client) { |
| 91 | + return execute(client, com.commercetools.importapi.models.importrequests.ImportResponse.class); |
| 92 | + } |
| 93 | + |
| 94 | + public String getProjectKey() { |
| 95 | + return this.projectKey; |
| 96 | + } |
| 97 | + |
| 98 | + public String getImportContainerKey() { |
| 99 | + return this.importContainerKey; |
| 100 | + } |
| 101 | + |
| 102 | + public void setProjectKey(final String projectKey) { |
| 103 | + this.projectKey = projectKey; |
| 104 | + } |
| 105 | + |
| 106 | + public void setImportContainerKey(final String importContainerKey) { |
| 107 | + this.importContainerKey = importContainerKey; |
| 108 | + } |
| 109 | + |
| 110 | + public com.commercetools.importapi.models.importrequests.BusinessUnitImportRequest getBody() { |
| 111 | + return businessUnitImportRequest; |
| 112 | + } |
| 113 | + |
| 114 | + public ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost withBody( |
| 115 | + com.commercetools.importapi.models.importrequests.BusinessUnitImportRequest businessUnitImportRequest) { |
| 116 | + ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost t = copy(); |
| 117 | + t.businessUnitImportRequest = businessUnitImportRequest; |
| 118 | + return t; |
| 119 | + } |
| 120 | + |
| 121 | + @Override |
| 122 | + public boolean equals(Object o) { |
| 123 | + if (this == o) |
| 124 | + return true; |
| 125 | + |
| 126 | + if (o == null || getClass() != o.getClass()) |
| 127 | + return false; |
| 128 | + |
| 129 | + ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost that = (ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost) o; |
| 130 | + |
| 131 | + return new EqualsBuilder().append(projectKey, that.projectKey) |
| 132 | + .append(importContainerKey, that.importContainerKey) |
| 133 | + .append(businessUnitImportRequest, that.businessUnitImportRequest) |
| 134 | + .isEquals(); |
| 135 | + } |
| 136 | + |
| 137 | + @Override |
| 138 | + public int hashCode() { |
| 139 | + return new HashCodeBuilder(17, 37).append(projectKey) |
| 140 | + .append(importContainerKey) |
| 141 | + .append(businessUnitImportRequest) |
| 142 | + .toHashCode(); |
| 143 | + } |
| 144 | + |
| 145 | + @Override |
| 146 | + protected ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost copy() { |
| 147 | + return new ByProjectKeyBusinessUnitsImportContainersByImportContainerKeyPost(this); |
| 148 | + } |
| 149 | +} |
0 commit comments