From d8cbd8b7a9997ff6a0f7ce4a1f5d5f558b1c9307 Mon Sep 17 00:00:00 2001 From: Venugopal Date: Wed, 26 Nov 2025 08:47:13 -0500 Subject: [PATCH 1/4] Add brand API --- src/main/java/com/infobip/api/BrandApi.java | 472 ++++++++++++++ .../java/com/infobip/model/BrandRequest.java | 585 +++++++++++++++++ .../java/com/infobip/model/BrandResponse.java | 600 ++++++++++++++++++ .../com/infobip/model/BrandVetRequest.java | 69 ++ .../com/infobip/model/BrandVetResponse.java | 294 +++++++++ .../GetBrandRegistrarStatusesResponse.java | 96 +++ .../com/infobip/model/GetBrandResponse.java | 25 + .../java/com/infobip/api/BrandsApiTest.java | 259 ++++++++ 8 files changed, 2400 insertions(+) create mode 100644 src/main/java/com/infobip/api/BrandApi.java create mode 100644 src/main/java/com/infobip/model/BrandRequest.java create mode 100644 src/main/java/com/infobip/model/BrandResponse.java create mode 100644 src/main/java/com/infobip/model/BrandVetRequest.java create mode 100644 src/main/java/com/infobip/model/BrandVetResponse.java create mode 100644 src/main/java/com/infobip/model/GetBrandRegistrarStatusesResponse.java create mode 100644 src/main/java/com/infobip/model/GetBrandResponse.java create mode 100644 src/test/java/com/infobip/api/BrandsApiTest.java diff --git a/src/main/java/com/infobip/api/BrandApi.java b/src/main/java/com/infobip/api/BrandApi.java new file mode 100644 index 0000000..bdeaff4 --- /dev/null +++ b/src/main/java/com/infobip/api/BrandApi.java @@ -0,0 +1,472 @@ +package com.infobip.api; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.infobip.*; +import com.infobip.model.*; +import java.util.Objects; +import okhttp3.Call; + +/** + * Represents BrandApi API client. + */ +public class BrandApi { + + private final ApiClient apiClient; + + /** + * Constructs a new instance of BrandApi. + * + * @param apiClient {@link ApiClient} instance to delegate calls to. + */ + public BrandApi(ApiClient apiClient) { + this.apiClient = Objects.requireNonNull(apiClient, "ApiClient must not be null!"); + } + + private RequestDefinition createBrandDefinition(BrandRequest BrandRequest) { + RequestDefinition.Builder builder = RequestDefinition.builder("POST", "/number-registration/1/brands") + .body(BrandRequest) + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + + return builder.build(); + } + /** + * createBrand request builder class. + */ + public class CreateBrandRequest { + + private final BrandRequest request; + + private CreateBrandRequest(BrandRequest request) { + this.request = Objects.requireNonNull(request, "The required parameter 'BrandRequest' is missing."); + } + + /** + * Executes the createBrand request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public BrandResponse execute() throws ApiException { + RequestDefinition createBrandDefinition = createBrandDefinition(request); + return apiClient.execute(createBrandDefinition, new TypeReference() {}.getType()); + } + + /** + * Executes the createBrand request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition createBrandsDefinition = createBrandDefinition(request); + return apiClient.executeAsync( + createBrandsDefinition, new TypeReference() {}.getType(), callback); + } + } + /** + * Create Brand. + *

+ * create Brand. + * + * @param BrandRequest (required) + * @return CreateBrandRequest + */ + public CreateBrandRequest createBrand(BrandRequest BrandRequest) { + return new CreateBrandRequest(BrandRequest); + } + + private RequestDefinition getBrandsDefinition(String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder("GET", "/number-registration/1/brands/{brandId}") + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + return builder.build(); + } + /** + * getBrands request builder class. + */ + public class GetBrandsRequest { + + private final String brandId; + + private GetBrandsRequest(String brandId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the getBrands request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public BrandResponse execute() throws ApiException { + RequestDefinition getBrandsDefinition = getBrandsDefinition(brandId); + return apiClient.execute(getBrandsDefinition, new TypeReference() {}.getType()); + } + + /** + * Executes the getBrands request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition getBrandsDefinition = getBrandsDefinition(brandId); + return apiClient.executeAsync( + getBrandsDefinition, new TypeReference() {}.getType(), callback); + } + } + /** + * Get Brands. + *

+ * Get Brands. + * + * @param brandId (required) + * @return GetBrandsRequest + */ + public GetBrandsRequest getBrands(String brandId) { + return new GetBrandsRequest(brandId); + } + + private RequestDefinition deleteBrandDefinition(String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "DELETE", "/number-registration/1/brands/{brandId}") + .requiresAuthentication(true) + .contentType("application/json"); + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + return builder.build(); + } + /** + * deleteBrand request builder class. + */ + public class DeleteBrandRequest { + + private final String brandId; + + private DeleteBrandRequest(String brandId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the deleteBrand request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public void execute() throws ApiException { + RequestDefinition deleteBrandDefinition = deleteBrandDefinition(brandId); + apiClient.execute(deleteBrandDefinition); + } + + /** + * Executes the deleteBrand request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition deleteBrandDefinition = deleteBrandDefinition(brandId); + return apiClient.executeAsync(deleteBrandDefinition, callback); + } + } + /** + * Delete Brands. + *

+ * Delete Brands. + * + * @param brandId (required) + * @return DeleteBrandRequest + */ + public DeleteBrandRequest deleteBrand(String brandId) { + return new DeleteBrandRequest(brandId); + } + + private RequestDefinition registerBrandDefinition(String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "POST", "/number-registration/1/brands/{brandId}/register") + .accept("application/json") + .requiresAuthentication(true); + + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + return builder.build(); + } + /** + * registerBrand request builder class. + */ + public class RegisterBrandRequest { + + private final String brandId; + + private RegisterBrandRequest(String brandId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the registerBrand request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public void execute() throws ApiException { + RequestDefinition registerBrandDefinition = registerBrandDefinition(brandId); + apiClient.execute(registerBrandDefinition); + } + + /** + * Executes the registerBrand request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition registerBrandDefinition = registerBrandDefinition(brandId); + return apiClient.executeAsync(registerBrandDefinition, callback); + } + } + /** + * Register Brands. + *

+ * Register Brands. + * + * @param brandId (required) + * @return RegisterBrand + */ + public RegisterBrandRequest registerBrand(String brandId) { + return new RegisterBrandRequest(brandId); + } + + private RequestDefinition getBrandRegistrarStatusesDefinition(String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "GET", "/number-registration/1/brands/{brandId}/registrar-statuses") + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + return builder.build(); + } + /** + * getBrandRegistrarStatuses request builder class. + */ + public class GetBrandRegistrarStatusesRequest { + + private final String brandId; + + private GetBrandRegistrarStatusesRequest(String brandId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the getBrandRegistrarStatuses request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public GetBrandRegistrarStatusesResponse execute() throws ApiException { + RequestDefinition getBrandRegistrarStatusesDefinition = getBrandRegistrarStatusesDefinition(brandId); + return apiClient.execute( + getBrandRegistrarStatusesDefinition, + new TypeReference() {}.getType()); + } + + /** + * Executes the getBrandRegistrarStatuses request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition getBrandRegistrarStatusesDefinition = getBrandRegistrarStatusesDefinition(brandId); + return apiClient.executeAsync( + getBrandRegistrarStatusesDefinition, + new TypeReference() {}.getType(), + callback); + } + } + /** + * Get BrandRegistrarStatuses. + *

+ * Get BrandRegistrarStatuses. + * + * @param brandId (required) + * @return GGetBrandRegistrarStatusesRequest + */ + public GetBrandRegistrarStatusesRequest getBrandRegistrarStatuses(String brandId) { + return new GetBrandRegistrarStatusesRequest(brandId); + } + + private RequestDefinition vetBrandDefinition(BrandVetRequest brandVetRequest, String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "POST", "/number-registration/1/brands/{brandId}/vets") + .body(brandVetRequest) + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + + return builder.build(); + } + /** + * VetBrand request builder class. + */ + public class VetBrandRequest { + + private final BrandVetRequest request; + private final String brandId; + + private VetBrandRequest(BrandVetRequest request, String brandId) { + this.request = Objects.requireNonNull(request, "The required parameter 'BrandVetRequest' is missing."); + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the BrandVet request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public BrandVetResponse execute() throws ApiException { + RequestDefinition vetBrandDefinition = vetBrandDefinition(request, brandId); + return apiClient.execute(vetBrandDefinition, new TypeReference() {}.getType()); + } + + /** + * Executes the BrandVet request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition vetBrandDefinition = vetBrandDefinition(request, brandId); + return apiClient.executeAsync( + vetBrandDefinition, new TypeReference() {}.getType(), callback); + } + } + /** + * vet Brand. + *

+ * vet Brand. + * + * @param brandVetRequest (required) + * @param brandId (required) + * @return VetBrandRequest + */ + public VetBrandRequest vetBrand(BrandVetRequest brandVetRequest, String brandId) { + return new VetBrandRequest(brandVetRequest, brandId); + } + + private RequestDefinition getBrandVetDefinition(String brandId, String vetId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "GET", "/number-registration/1/brands/{brandId}/vets/{vetId}") + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + if (vetId != null) { + builder.addPathParameter(new Parameter("vetId", vetId)); + } + return builder.build(); + } + /** + * getBrandVet request builder class. + */ + public class GetBrandVetRequest { + + private final String brandId; + private final String vetId; + + private GetBrandVetRequest(String brandId, String vetId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + this.vetId = Objects.requireNonNull(vetId, "The required parameter 'vetId' is missing."); + } + + /** + * Executes the getBrandVet request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public BrandVetResponse execute() throws ApiException { + RequestDefinition getBrandVetDefinition = getBrandVetDefinition(brandId, vetId); + return apiClient.execute(getBrandVetDefinition, new TypeReference() {}.getType()); + } + + /** + * Executes the getBrandVet request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition getBrandVetDefinition = getBrandVetDefinition(brandId, vetId); + return apiClient.executeAsync( + getBrandVetDefinition, new TypeReference() {}.getType(), callback); + } + } + /** + * Get Brand Vet. + *

+ * Get Brand Vet. + * + * @param brandId (required) + * @return GetBrandsRequest + */ + public GetBrandVetRequest getBrandVet(String brandId, String vetId) { + return new GetBrandVetRequest(brandId, vetId); + } + + private RequestDefinition resend2faDefinition(String brandId) { + RequestDefinition.Builder builder = RequestDefinition.builder( + "POST", "/number-registration/1/brands/{brandId}/resend2fa") + .requiresAuthentication(true) + .accept("application/json") + .contentType("application/json"); + if (brandId != null) { + builder.addPathParameter(new Parameter("brandId", brandId)); + } + return builder.build(); + } + /** + * resend2fa request builder class. + */ + public class Resend2faRequest { + + private final String brandId; + + private Resend2faRequest(String brandId) { + this.brandId = Objects.requireNonNull(brandId, "The required parameter 'brandId' is missing."); + } + + /** + * Executes the resend2fa request + * @throws ApiException If the API call fails or an error occurs during the request or response processing. + */ + public void execute() throws ApiException { + RequestDefinition resend2faDefinition = resend2faDefinition(brandId); + apiClient.execute(resend2faDefinition); + } + + /** + * Executes the resend2fa request asynchronously. + * + * @param callback The {@link ApiCallback} to be invoked. + * @return The {@link Call} associated with the API request. + */ + public Call executeAsync(ApiCallback callback) { + RequestDefinition resend2faDefinition = resend2faDefinition(brandId); + return apiClient.executeAsync(resend2faDefinition, callback); + } + } + /** + * Resend2fa. + *

+ * Resend2fa. + * + * @param brandId (required) + * @return Resend2faRequest + */ + public Resend2faRequest resend2fa(String brandId) { + return new Resend2faRequest(brandId); + } +} diff --git a/src/main/java/com/infobip/model/BrandRequest.java b/src/main/java/com/infobip/model/BrandRequest.java new file mode 100644 index 0000000..fbd3d68 --- /dev/null +++ b/src/main/java/com/infobip/model/BrandRequest.java @@ -0,0 +1,585 @@ +package com.infobip.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents BrandApi model. + */ +public class BrandRequest { + private String name; + private String applicationId; + private String entityId; + private String website; + private String type; + private String referenceId; + private String legalName; + private Address address; + private String countryCode; + private String supportEmail; + private String supportPhone; + private String vertical; + private String taxId; + private String taxIdIssuingCountry; + private AlternateBusinessId alternateBusinessId; + private String stockExchange; + private String stockSymbol; + private String businessContactEmail; + + /** + * Returns name. + * + * @return name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * Sets name. + * + * @param name the name + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * Sets name. + * + * @param name the name + * @return This {@link BrandRequest} instance. + */ + public BrandRequest name(String name) { + this.name = name; + return this; + } + + /** + * Returns applicationId. + * + * @return applicationId + */ + @JsonProperty("applicationId") + public String getApplicationId() { + return applicationId; + } + + /** + * Sets applicationId. + * + * @param applicationId the application id + */ + @JsonProperty("applicationId") + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + /** + * Sets applicationId. + * + * @param applicationId the application id + * @return This {@link BrandRequest} instance. + */ + public BrandRequest applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Returns entityId. + * + * @return entityId + */ + @JsonProperty("entityId") + public String getEntityId() { + return entityId; + } + + /** + * Sets entityId. + * + * @param entityId the entity id + */ + @JsonProperty("entityId") + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Sets entityId. + * + * @param entityId the entity id + * @return This {@link BrandRequest} instance. + */ + public BrandRequest entityId(String entityId) { + this.entityId = entityId; + return this; + } + + /** + * Returns website. + * + * @return website + */ + @JsonProperty("website") + public String getWebsite() { + return website; + } + + /** + * Sets website. + * + * @param website the website + */ + @JsonProperty("website") + public void setWebsite(String website) { + this.website = website; + } + + /** + * Sets website. + * + * @param website the website + * @return This {@link BrandRequest} instance. + */ + public BrandRequest website(String website) { + this.website = website; + return this; + } + + /** + * Returns type. + * + * @return type + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * Sets type. + * + * @param type the type + */ + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + * Sets type. + * + * @param type the type + * @return This {@link BrandRequest} instance. + */ + public BrandRequest type(String type) { + this.type = type; + return this; + } + + /** + * Returns referenceId. + * + * @return referenceId + */ + @JsonProperty("referenceId") + public String getReferenceId() { + return referenceId; + } + + /** + * Sets referenceId. + * + * @param referenceId the reference id + */ + @JsonProperty("referenceId") + public void setReferenceId(String referenceId) { + this.referenceId = referenceId; + } + + /** + * Sets referenceId. + * + * @param referenceId the reference id + * @return This {@link BrandRequest} instance. + */ + public BrandRequest referenceId(String referenceId) { + this.referenceId = referenceId; + return this; + } + + /** + * Returns legalName. + * + * @return legalName + */ + @JsonProperty("legalName") + public String getLegalName() { + return legalName; + } + + /** + * Sets legalName. + * + * @param legalName the legal name + */ + @JsonProperty("legalName") + public void setLegalName(String legalName) { + this.legalName = legalName; + } + + /** + * Sets legalName. + * + * @param legalName the legal name + * @return This {@link BrandRequest} instance. + */ + public BrandRequest legalName(String legalName) { + this.legalName = legalName; + return this; + } + + /** + * Returns address. + * + * @return address + */ + @JsonProperty("address") + public Address getAddress() { + return address; + } + + /** + * Sets address. + * + * @param address the address + */ + @JsonProperty("address") + public void setAddress(Address address) { + this.address = address; + } + + /** + * Sets address. + * + * @param address the address + * @return This {@link BrandRequest} instance. + */ + public BrandRequest address(Address address) { + this.address = address; + return this; + } + + /** + * Returns countryCode. + * + * @return countryCode + */ + @JsonProperty("countryCode") + public String getCountryCode() { + return countryCode; + } + + /** + * Sets countryCode. + * + * @param countryCode the country code + */ + @JsonProperty("countryCode") + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + /** + * Sets countryCode. + * + * @param countryCode the country code + * @return This {@link BrandRequest} instance. + */ + public BrandRequest countryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Returns supportEmail. + * + * @return supportEmail + */ + @JsonProperty("supportEmail") + public String getSupportEmail() { + return supportEmail; + } + + /** + * Sets supportEmail. + * + * @param supportEmail the support email + */ + @JsonProperty("supportEmail") + public void setSupportEmail(String supportEmail) { + this.supportEmail = supportEmail; + } + + /** + * Sets supportEmail. + * + * @param supportEmail the support email + * @return This {@link BrandRequest} instance. + */ + public BrandRequest supportEmail(String supportEmail) { + this.supportEmail = supportEmail; + return this; + } + + /** + * Returns supportPhone. + * + * @return supportPhone + */ + @JsonProperty("supportPhone") + public String getSupportPhone() { + return supportPhone; + } + + /** + * Sets supportPhone. + * + * @param supportPhone the support phone + */ + @JsonProperty("supportPhone") + public void setSupportPhone(String supportPhone) { + this.supportPhone = supportPhone; + } + + /** + * Sets supportPhone. + * + * @param supportPhone the support phone + * @return This {@link BrandRequest} instance. + */ + public BrandRequest supportPhone(String supportPhone) { + this.supportPhone = supportPhone; + return this; + } + + /** + * Returns vertical. + * + * @return vertical + */ + @JsonProperty("vertical") + public String getVertical() { + return vertical; + } + + /** + * Sets vertical. + * + * @param vertical the vertical + */ + @JsonProperty("vertical") + public void setVertical(String vertical) { + this.vertical = vertical; + } + + /** + * Sets vertical. + * + * @param vertical the vertical + * @return This {@link BrandRequest} instance. + */ + public BrandRequest vertical(String vertical) { + this.vertical = vertical; + return this; + } + + /** + * Returns taxId. + * + * @return taxId + */ + @JsonProperty("taxId") + public String getTaxId() { + return taxId; + } + + /** + * Sets taxId. + * + * @param taxId the tax id + */ + @JsonProperty("taxId") + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + /** + * Sets taxId. + * + * @param taxId the tax id + * @return This {@link BrandRequest} instance. + */ + public BrandRequest taxId(String taxId) { + this.taxId = taxId; + return this; + } + + /** + * Returns taxIdIssuingCountry. + * + * @return taxIdIssuingCountry + */ + @JsonProperty("taxIdIssuingCountry") + public String getTaxIdIssuingCountry() { + return taxIdIssuingCountry; + } + + /** + * Sets taxIdIssuingCountry. + * + * @param taxIdIssuingCountry the tax id issuing country + */ + @JsonProperty("taxIdIssuingCountry") + public void setTaxIdIssuingCountry(String taxIdIssuingCountry) { + this.taxIdIssuingCountry = taxIdIssuingCountry; + } + + /** + * Sets taxIdIssuingCountry. + * + * @param taxIdIssuingCountry the tax id issuing country + * @return This {@link BrandRequest} instance. + */ + public BrandRequest taxIdIssuingCountry(String taxIdIssuingCountry) { + this.taxIdIssuingCountry = taxIdIssuingCountry; + return this; + } + + /** + * Returns alternateBusinessId. + * + * @return alternateBusinessId + */ + @JsonProperty("alternateBusinessId") + public AlternateBusinessId getAlternateBusinessId() { + return alternateBusinessId; + } + + /** + * Sets alternateBusinessId. + * + * @param alternateBusinessId the alternate business id + */ + @JsonProperty("alternateBusinessId") + public void setAlternateBusinessId(AlternateBusinessId alternateBusinessId) { + this.alternateBusinessId = alternateBusinessId; + } + + /** + * Sets alternateBusinessId. + * + * @param alternateBusinessId the alternate business id + * @return This {@link BrandRequest} instance. + */ + public BrandRequest alternateBusinessId(AlternateBusinessId alternateBusinessId) { + this.alternateBusinessId = alternateBusinessId; + return this; + } + + /** + * Returns stockExchange. + * + * @return stockExchange + */ + @JsonProperty("stockExchange") + public String getStockExchange() { + return stockExchange; + } + + /** + * Sets stockExchange. + * + * @param stockExchange the stock exchange + */ + @JsonProperty("stockExchange") + public void setStockExchange(String stockExchange) { + this.stockExchange = stockExchange; + } + + /** + * Sets stockExchange. + * + * @param stockExchange the stock exchange + * @return This {@link BrandRequest} instance. + */ + public BrandRequest stockExchange(String stockExchange) { + this.stockExchange = stockExchange; + return this; + } + + /** + * Returns stockSymbol. + * + * @return stockSymbol + */ + @JsonProperty("stockSymbol") + public String getStockSymbol() { + return stockSymbol; + } + + /** + * Sets stockSymbol. + * + * @param stockSymbol the stock symbol + */ + @JsonProperty("stockSymbol") + public void setStockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + } + + /** + * Sets stockSymbol. + * + * @param stockSymbol the stock symbol + * @return This {@link BrandRequest} instance. + */ + public BrandRequest stockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + return this; + } + + /** + * Returns businessContactEmail. + * + * @return businessContactEmail + */ + @JsonProperty("businessContactEmail") + public String getBusinessContactEmail() { + return businessContactEmail; + } + + /** + * Sets businessContactEmail. + * + * @param businessContactEmail the business contact email + */ + @JsonProperty("businessContactEmail") + public void setBusinessContactEmail(String businessContactEmail) { + this.businessContactEmail = businessContactEmail; + } + + /** + * Sets businessContactEmail. + * + * @param businessContactEmail the business contact email + * @return This {@link BrandRequest} instance. + */ + public BrandRequest businessContactEmail(String businessContactEmail) { + this.businessContactEmail = businessContactEmail; + return this; + } +} diff --git a/src/main/java/com/infobip/model/BrandResponse.java b/src/main/java/com/infobip/model/BrandResponse.java new file mode 100644 index 0000000..b3fa1b6 --- /dev/null +++ b/src/main/java/com/infobip/model/BrandResponse.java @@ -0,0 +1,600 @@ +package com.infobip.model; + +import java.time.LocalDateTime; + +public class BrandResponse { + private String id; + private String applicationId; + private String entityId; + private String name; + private String stage; + private String website; + private LocalDateTime createdDate; + private LocalDateTime lastModifiedDate; + private String referenceId; + private String legalName; + private Address address; + private String countryCode; + private AlternateBusinessId alternateBusinessId; + private String supportEmail; + private String supportPhone; + private String vertical; + private String taxId; + private String taxIdIssuingCountry; + private String type; + private String stockExchange; + private String stockSymbol; + private String businessContactEmail; + + /** + * Gets the id. + * @return the id + */ + public String getId() { + return id; + } + + /** + * Sets the id. + * @param id the id to set + */ + public void setId(String id) { + this.id = id; + } + + /** + * Sets the id and returns this. + * @param id the id to set + * @return this BrandResponse instance + */ + public BrandResponse id(String id) { + this.id = id; + return this; + } + + /** + * Gets the applicationId. + * @return the applicationId + */ + public String getApplicationId() { + return applicationId; + } + + /** + * Sets the applicationId. + * @param applicationId the applicationId to set + */ + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + /** + * Sets the applicationId and returns this. + * @param applicationId the applicationId to set + * @return this BrandResponse instance + */ + public BrandResponse applicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Gets the entityId. + * @return the entityId + */ + public String getEntityId() { + return entityId; + } + + /** + * Sets the entityId. + * @param entityId the entityId to set + */ + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Sets the entityId and returns this. + * @param entityId the entityId to set + * @return this BrandResponse instance + */ + public BrandResponse entityId(String entityId) { + this.entityId = entityId; + return this; + } + + /** + * Gets the name. + * @return the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * Sets the name and returns this. + * @param name the name to set + * @return this BrandResponse instance + */ + public BrandResponse name(String name) { + this.name = name; + return this; + } + + /** + * Gets the stage. + * @return the stage + */ + public String getStage() { + return stage; + } + + /** + * Sets the stage. + * @param stage the stage to set + */ + public void setStage(String stage) { + this.stage = stage; + } + + /** + * Sets the stage and returns this. + * @param stage the stage to set + * @return this BrandResponse instance + */ + public BrandResponse stage(String stage) { + this.stage = stage; + return this; + } + + /** + * Gets the website. + * @return the website + */ + public String getWebsite() { + return website; + } + + /** + * Sets the website. + * @param website the website to set + */ + public void setWebsite(String website) { + this.website = website; + } + + /** + * Sets the website and returns this. + * @param website the website to set + * @return this BrandResponse instance + */ + public BrandResponse website(String website) { + this.website = website; + return this; + } + + /** + * Gets the createdDate. + * @return the createdDate + */ + public LocalDateTime getCreatedDate() { + return createdDate; + } + + /** + * Sets the createdDate. + * @param createdDate the createdDate to set + */ + public void setCreatedDate(LocalDateTime createdDate) { + this.createdDate = createdDate; + } + + /** + * Sets the createdDate and returns this. + * @param createdDate the createdDate to set + * @return this BrandResponse instance + */ + public BrandResponse createdDate(LocalDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Gets the lastModifiedDate. + * @return the lastModifiedDate + */ + public LocalDateTime getLastModifiedDate() { + return lastModifiedDate; + } + + /** + * Sets the lastModifiedDate. + * @param lastModifiedDate the lastModifiedDate to set + */ + public void setLastModifiedDate(LocalDateTime lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } + + /** + * Sets the lastModifiedDate and returns this. + * @param lastModifiedDate the lastModifiedDate to set + * @return this BrandResponse instance + */ + public BrandResponse lastModifiedDate(LocalDateTime lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + return this; + } + + /** + * Gets the referenceId. + * @return the referenceId + */ + public String getReferenceId() { + return referenceId; + } + + /** + * Sets the referenceId. + * @param referenceId the referenceId to set + */ + public void setReferenceId(String referenceId) { + this.referenceId = referenceId; + } + + /** + * Sets the referenceId and returns this. + * @param referenceId the referenceId to set + * @return this BrandResponse instance + */ + public BrandResponse referenceId(String referenceId) { + this.referenceId = referenceId; + return this; + } + + /** + * Gets the legalName. + * @return the legalName + */ + public String getLegalName() { + return legalName; + } + + /** + * Sets the legalName. + * @param legalName the legalName to set + */ + public void setLegalName(String legalName) { + this.legalName = legalName; + } + + /** + * Sets the legalName and returns this. + * @param legalName the legalName to set + * @return this BrandResponse instance + */ + public BrandResponse legalName(String legalName) { + this.legalName = legalName; + return this; + } + + /** + * Gets the address. + * @return the address + */ + public Address getAddress() { + return address; + } + + /** + * Sets the address. + * @param address the address to set + */ + public void setAddress(Address address) { + this.address = address; + } + + /** + * Sets the address and returns this. + * @param address the address to set + * @return this BrandResponse instance + */ + public BrandResponse address(Address address) { + this.address = address; + return this; + } + + /** + * Gets the countryCode. + * @return the countryCode + */ + public String getCountryCode() { + return countryCode; + } + + /** + * Sets the countryCode. + * @param countryCode the countryCode to set + */ + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + /** + * Sets the countryCode and returns this. + * @param countryCode the countryCode to set + * @return this BrandResponse instance + */ + public BrandResponse countryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Gets the alternateBusinessId. + * @return the alternateBusinessId + */ + public AlternateBusinessId getAlternateBusinessId() { + return alternateBusinessId; + } + + /** + * Sets the alternateBusinessId. + * @param alternateBusinessId the alternateBusinessId to set + */ + public void setAlternateBusinessId(AlternateBusinessId alternateBusinessId) { + this.alternateBusinessId = alternateBusinessId; + } + + /** + * Sets the alternateBusinessId and returns this. + * @param alternateBusinessId the alternateBusinessId to set + * @return this BrandResponse instance + */ + public BrandResponse alternateBusinessId(AlternateBusinessId alternateBusinessId) { + this.alternateBusinessId = alternateBusinessId; + return this; + } + + /** + * Gets the supportEmail. + * @return the supportEmail + */ + public String getSupportEmail() { + return supportEmail; + } + + /** + * Sets the supportEmail. + * @param supportEmail the supportEmail to set + */ + public void setSupportEmail(String supportEmail) { + this.supportEmail = supportEmail; + } + + /** + * Sets the supportEmail and returns this. + * @param supportEmail the supportEmail to set + * @return this BrandResponse instance + */ + public BrandResponse supportEmail(String supportEmail) { + this.supportEmail = supportEmail; + return this; + } + + /** + * Gets the supportPhone. + * @return the supportPhone + */ + public String getSupportPhone() { + return supportPhone; + } + + /** + * Sets the supportPhone. + * @param supportPhone the supportPhone to set + */ + public void setSupportPhone(String supportPhone) { + this.supportPhone = supportPhone; + } + + /** + * Sets the supportPhone and returns this. + * @param supportPhone the supportPhone to set + * @return this BrandResponse instance + */ + public BrandResponse supportPhone(String supportPhone) { + this.supportPhone = supportPhone; + return this; + } + + /** + * Gets the vertical. + * @return the vertical + */ + public String getVertical() { + return vertical; + } + + /** + * Sets the vertical. + * @param vertical the vertical to set + */ + public void setVertical(String vertical) { + this.vertical = vertical; + } + + /** + * Sets the vertical and returns this. + * @param vertical the vertical to set + * @return this BrandResponse instance + */ + public BrandResponse vertical(String vertical) { + this.vertical = vertical; + return this; + } + + /** + * Gets the taxId. + * @return the taxId + */ + public String getTaxId() { + return taxId; + } + + /** + * Sets the taxId. + * @param taxId the taxId to set + */ + public void setTaxId(String taxId) { + this.taxId = taxId; + } + + /** + * Sets the taxId and returns this. + * @param taxId the taxId to set + * @return this BrandResponse instance + */ + public BrandResponse taxId(String taxId) { + this.taxId = taxId; + return this; + } + + /** + * Gets the taxIdIssuingCountry. + * @return the taxIdIssuingCountry + */ + public String getTaxIdIssuingCountry() { + return taxIdIssuingCountry; + } + + /** + * Sets the taxIdIssuingCountry. + * @param taxIdIssuingCountry the taxIdIssuingCountry to set + */ + public void setTaxIdIssuingCountry(String taxIdIssuingCountry) { + this.taxIdIssuingCountry = taxIdIssuingCountry; + } + + /** + * Sets the taxIdIssuingCountry and returns this. + * @param taxIdIssuingCountry the taxIdIssuingCountry to set + * @return this BrandResponse instance + */ + public BrandResponse taxIdIssuingCountry(String taxIdIssuingCountry) { + this.taxIdIssuingCountry = taxIdIssuingCountry; + return this; + } + + /** + * Gets the type. + * @return the type + */ + public String getType() { + return type; + } + + /** + * Sets the type. + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the type and returns this. + * @param type the type to set + * @return this BrandResponse instance + */ + public BrandResponse type(String type) { + this.type = type; + return this; + } + + /** + * Gets the stockExchange. + * @return the stockExchange + */ + public String getStockExchange() { + return stockExchange; + } + + /** + * Sets the stockExchange. + * @param stockExchange the stockExchange to set + */ + public void setStockExchange(String stockExchange) { + this.stockExchange = stockExchange; + } + + /** + * Sets the stockExchange and returns this. + * @param stockExchange the stockExchange to set + * @return this BrandResponse instance + */ + public BrandResponse stockExchange(String stockExchange) { + this.stockExchange = stockExchange; + return this; + } + + /** + * Gets the stockSymbol. + * @return the stockSymbol + */ + public String getStockSymbol() { + return stockSymbol; + } + + /** + * Sets the stockSymbol. + * @param stockSymbol the stockSymbol to set + */ + public void setStockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + } + + /** + * Sets the stockSymbol and returns this. + * @param stockSymbol the stockSymbol to set + * @return this BrandResponse instance + */ + public BrandResponse stockSymbol(String stockSymbol) { + this.stockSymbol = stockSymbol; + return this; + } + + /** + * Gets the businessContactEmail. + * @return the businessContactEmail + */ + public String getBusinessContactEmail() { + return businessContactEmail; + } + + /** + * Sets the businessContactEmail. + * @param businessContactEmail the businessContactEmail to set + */ + public void setBusinessContactEmail(String businessContactEmail) { + this.businessContactEmail = businessContactEmail; + } + + /** + * Sets the businessContactEmail and returns this. + * @param businessContactEmail the businessContactEmail to set + * @return this BrandResponse instance + */ + public BrandResponse businessContactEmail(String businessContactEmail) { + this.businessContactEmail = businessContactEmail; + return this; + } +} diff --git a/src/main/java/com/infobip/model/BrandVetRequest.java b/src/main/java/com/infobip/model/BrandVetRequest.java new file mode 100644 index 0000000..ad002cc --- /dev/null +++ b/src/main/java/com/infobip/model/BrandVetRequest.java @@ -0,0 +1,69 @@ +package com.infobip.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class BrandVetRequest { + private String status; + private String type; + /** + * Returns status. + * + * @return status + */ + @JsonProperty("status") + public String getStatus() { + return status; + } + + /** + * Sets status. + * + * @param status the status + */ + @JsonProperty("status") + public void setStatus(String status) { + this.status = status; + } + + /** + * Sets status. + * + * @param status the status + * @return This {@link BrandVetRequest} instance. + */ + public BrandVetRequest status(String status) { + this.status = status; + return this; + } + + /** + * Returns type. + * + * @return type + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * Sets type. + * + * @param type the type + */ + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + * Sets type. + * + * @param type the type + * @return This {@link BrandVetRequest} instance. + */ + public BrandVetRequest type(String type) { + this.type = type; + return this; + } +} diff --git a/src/main/java/com/infobip/model/BrandVetResponse.java b/src/main/java/com/infobip/model/BrandVetResponse.java new file mode 100644 index 0000000..2fa792d --- /dev/null +++ b/src/main/java/com/infobip/model/BrandVetResponse.java @@ -0,0 +1,294 @@ +package com.infobip.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDateTime; + +public class BrandVetResponse { + private String vetId; + private String brandId; + private int score; + private LocalDateTime vettedDate; + private LocalDateTime enhancedVettedDate; + private String status; + private String type; + private boolean imported; + private String importedVetProvider; + /** + * Returns vetId. + * + * @return vetId + */ + @JsonProperty("vetId") + public String getVetId() { + return vetId; + } + + /** + * Sets vetId. + * + * @param vetId the vetId + */ + @JsonProperty("vetId") + public void setVetId(String vetId) { + this.vetId = vetId; + } + + /** + * Sets vetId. + * + * @param vetId the vetId + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse vetId(String vetId) { + this.vetId = vetId; + return this; + } + + /** + * Returns brandId. + * + * @return brandId + */ + @JsonProperty("brandId") + public String getBrandId() { + return brandId; + } + + /** + * Sets brandId. + * + * @param brandId the brandId + */ + @JsonProperty("brandId") + public void setBrandId(String brandId) { + this.brandId = brandId; + } + + /** + * Sets brandId. + * + * @param brandId the brandId + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse brandId(String brandId) { + this.brandId = brandId; + return this; + } + + /** + * Returns score. + * + * @return score + */ + @JsonProperty("score") + public int getScore() { + return score; + } + + /** + * Sets score. + * + * @param score the score + */ + @JsonProperty("score") + public void setScore(int score) { + this.score = score; + } + + /** + * Sets score. + * + * @param score the score + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse score(int score) { + this.score = score; + return this; + } + + /** + * Returns vettedDate. + * + * @return vettedDate + */ + @JsonProperty("vettedDate") + public LocalDateTime getVettedDate() { + return vettedDate; + } + + /** + * Sets vettedDate. + * + * @param vettedDate the vettedDate + */ + @JsonProperty("vettedDate") + public void setVettedDate(LocalDateTime vettedDate) { + this.vettedDate = vettedDate; + } + + /** + * Sets vettedDate. + * + * @param vettedDate the vettedDate + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse vettedDate(LocalDateTime vettedDate) { + this.vettedDate = vettedDate; + return this; + } + + /** + * Returns enhancedVettedDate. + * + * @return enhancedVettedDate + */ + @JsonProperty("enhancedVettedDate") + public LocalDateTime getEnhancedVettedDate() { + return enhancedVettedDate; + } + + /** + * Sets enhancedVettedDate. + * + * @param enhancedVettedDate the enhancedVettedDate + */ + @JsonProperty("enhancedVettedDate") + public void setEnhancedVettedDate(LocalDateTime enhancedVettedDate) { + this.enhancedVettedDate = enhancedVettedDate; + } + + /** + * Sets enhancedVettedDate. + * + * @param enhancedVettedDate the enhancedVettedDate + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse enhancedVettedDate(LocalDateTime enhancedVettedDate) { + this.enhancedVettedDate = enhancedVettedDate; + return this; + } + + /** + * Returns status. + * + * @return status + */ + @JsonProperty("status") + public String getStatus() { + return status; + } + + /** + * Sets status. + * + * @param status the status + */ + @JsonProperty("status") + public void setStatus(String status) { + this.status = status; + } + + /** + * Sets status. + * + * @param status the status + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse status(String status) { + this.status = status; + return this; + } + + /** + * Returns type. + * + * @return type + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * Sets type. + * + * @param type the type + */ + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + /** + * Sets type. + * + * @param type the type + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse type(String type) { + this.type = type; + return this; + } + + /** + * Returns imported. + * + * @return imported + */ + @JsonProperty("imported") + public boolean isImported() { + return imported; + } + + /** + * Sets imported. + * + * @param imported the imported + */ + @JsonProperty("imported") + public void setImported(boolean imported) { + this.imported = imported; + } + + /** + * Sets imported. + * + * @param imported the imported + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse imported(boolean imported) { + this.imported = imported; + return this; + } + + /** + * Returns importedVetProvider. + * + * @return importedVetProvider + */ + @JsonProperty("importedVetProvider") + public String getImportedVetProvider() { + return importedVetProvider; + } + + /** + * Sets importedVetProvider. + * + * @param importedVetProvider the importedVetProvider + */ + @JsonProperty("importedVetProvider") + public void setImportedVetProvider(String importedVetProvider) { + this.importedVetProvider = importedVetProvider; + } + + /** + * Sets importedVetProvider. + * + * @param importedVetProvider the importedVetProvider + * @return This {@link BrandVetResponse} instance. + */ + public BrandVetResponse importedVetProvider(String importedVetProvider) { + this.importedVetProvider = importedVetProvider; + return this; + } +} diff --git a/src/main/java/com/infobip/model/GetBrandRegistrarStatusesResponse.java b/src/main/java/com/infobip/model/GetBrandRegistrarStatusesResponse.java new file mode 100644 index 0000000..7a72e71 --- /dev/null +++ b/src/main/java/com/infobip/model/GetBrandRegistrarStatusesResponse.java @@ -0,0 +1,96 @@ +package com.infobip.model; + +public class GetBrandRegistrarStatusesResponse { + private String registrar; + private String state; + private String brandIdentityStatus; + private String rejectionReason; + + /** + * Gets the registrar. + */ + public String getRegistrar() { + return registrar; + } + + /** + * Sets the registrar. + */ + public void setRegistrar(String registrar) { + this.registrar = registrar; + } + + /** + * Sets the registrar and returns this. + */ + public GetBrandRegistrarStatusesResponse registrar(String registrar) { + this.registrar = registrar; + return this; + } + + /** + * Gets the state. + */ + public String getState() { + return state; + } + + /** + * Sets the state. + */ + public void setState(String state) { + this.state = state; + } + + /** + * Sets the state and returns this. + */ + public GetBrandRegistrarStatusesResponse state(String state) { + this.state = state; + return this; + } + + /** + * Gets the brand identity status. + */ + public String getBrandIdentityStatus() { + return brandIdentityStatus; + } + + /** + * Sets the brand identity status. + */ + public void setBrandIdentityStatus(String brandIdentityStatus) { + this.brandIdentityStatus = brandIdentityStatus; + } + + /** + * Sets the brand identity status and returns this. + */ + public GetBrandRegistrarStatusesResponse brandIdentityStatus(String brandIdentityStatus) { + this.brandIdentityStatus = brandIdentityStatus; + return this; + } + + /** + * Gets the rejection reason. + */ + public String getRejectionReason() { + return rejectionReason; + } + + /** + * Sets the rejection reason. + */ + public void setRejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + } + + /** + * Sets the rejection reason and returns this. + */ + public GetBrandRegistrarStatusesResponse rejectionReason(String rejectionReason) { + this.rejectionReason = rejectionReason; + return this; + } +} diff --git a/src/main/java/com/infobip/model/GetBrandResponse.java b/src/main/java/com/infobip/model/GetBrandResponse.java new file mode 100644 index 0000000..321954c --- /dev/null +++ b/src/main/java/com/infobip/model/GetBrandResponse.java @@ -0,0 +1,25 @@ +package com.infobip.model; + +import java.util.List; + +public class GetBrandResponse { + private List results; + private Paging paging; + + // Getters and setters + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + public Paging getPaging() { + return paging; + } + + public void setPaging(Paging paging) { + this.paging = paging; + } +} diff --git a/src/test/java/com/infobip/api/BrandsApiTest.java b/src/test/java/com/infobip/api/BrandsApiTest.java new file mode 100644 index 0000000..05b1f02 --- /dev/null +++ b/src/test/java/com/infobip/api/BrandsApiTest.java @@ -0,0 +1,259 @@ +package com.infobip.api; + +import static org.assertj.core.api.BDDAssertions.then; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.infobip.model.*; +import java.time.LocalDateTime; +import java.util.Map; +import java.util.function.Consumer; +import org.junit.jupiter.api.Test; + +class BrandsApiTest extends ApiTest { + + @Test + void shouldCreateBrand() throws Exception { + + String givenRequest = "{\n" + " \"name\": \"Example Brand\",\n" + + " \"applicationId\": \"app-123\",\n" + + " \"entityId\": \"entity-456\",\n" + + " \"website\": \"https://example.com\",\n" + + " \"type\": \"BUSINESS\",\n" + + " \"referenceId\": \"ref-789\",\n" + + " \"legalName\": \"Example Legal Name\",\n" + + " \"address\": {\n" + + " \"state\": \"ON\",\n" + + " \"street\": \"Sample City\",\n" + + " \"zipCode\": \"12345\",\n" + + " \"city\": \"US\"\n" + + " },\n" + + " \"countryCode\": \"US\",\n" + + " \"supportEmail\": \"support@example.com\",\n" + + " \"supportPhone\": \"+1234567890\",\n" + + " \"vertical\": \"TECH\",\n" + + " \"taxId\": \"TAX123456\",\n" + + " \"taxIdIssuingCountry\": \"US\",\n" + + " \"alternateBusinessId\": {\n" + + " \"id\": \"alt-001\"\n" + + " },\n" + + " \"stockExchange\": \"NASDAQ\",\n" + + " \"stockSymbol\": \"EXMPL\",\n" + + " \"businessContactEmail\": \"contact@example.com\"\n" + + "}"; + + String givenResponse = "{\n" + " \"id\": \"string\",\n" + + " \"applicationId\": \"string\",\n" + + " \"entityId\": \"string\",\n" + + " \"name\": \"string\",\n" + + " \"stage\": \"string\",\n" + + " \"website\": \"string\",\n" + + " \"createdDate\": \"2023-01-01T12:00:00\",\n" + + " \"lastModifiedDate\": \"2023-01-02T12:00:00\",\n" + + " \"referenceId\": \"string\",\n" + + " \"legalName\": \"string\",\n" + + " \"countryCode\": \"string\",\n" + + " \"supportEmail\": \"string\",\n" + + " \"supportPhone\": \"string\",\n" + + " \"vertical\": \"string\",\n" + + " \"taxId\": \"string\",\n" + + " \"taxIdIssuingCountry\": \"string\",\n" + + " \"type\": \"string\",\n" + + " \"stockExchange\": \"string\",\n" + + " \"stockSymbol\": \"string\",\n" + + " \"businessContactEmail\": \"string\"\n" + + "}"; + setUpPostRequest("/number-registration/1/brands", givenRequest, givenResponse, 200); + Consumer assertions = (brandResponse) -> { + then(brandResponse.getId()).isEqualTo("string"); + then(brandResponse.getApplicationId()).isEqualTo("string"); + then(brandResponse.getEntityId()).isEqualTo("string"); + then(brandResponse.getName()).isEqualTo("string"); + then(brandResponse.getStage()).isEqualTo("string"); + then(brandResponse.getWebsite()).isEqualTo("string"); + then(brandResponse.getCreatedDate()).isEqualTo(LocalDateTime.parse("2023-01-01T12:00:00")); + then(brandResponse.getLastModifiedDate()).isEqualTo(LocalDateTime.parse("2023-01-02T12:00:00")); + then(brandResponse.getReferenceId()).isEqualTo("string"); + then(brandResponse.getLegalName()).isEqualTo("string"); + then(brandResponse.getCountryCode()).isEqualTo("string"); + then(brandResponse.getSupportEmail()).isEqualTo("string"); + then(brandResponse.getSupportPhone()).isEqualTo("string"); + then(brandResponse.getVertical()).isEqualTo("string"); + then(brandResponse.getTaxId()).isEqualTo("string"); + then(brandResponse.getTaxIdIssuingCountry()).isEqualTo("string"); + then(brandResponse.getType()).isEqualTo("string"); + then(brandResponse.getStockExchange()).isEqualTo("string"); + then(brandResponse.getStockSymbol()).isEqualTo("string"); + then(brandResponse.getBusinessContactEmail()).isEqualTo("string"); + }; + BrandApi api = new BrandApi(getApiClient()); + ObjectMapper objectMapper = new ObjectMapper(); + BrandRequest brandRequest = objectMapper.readValue(givenRequest, BrandRequest.class); + var call = api.createBrand(brandRequest); + testSuccessfulCall(call::execute, assertions); + } + + @Test + void shouldGetBrandById() { + + String brandId = "brand-123"; + String givenResponse = "{\n" + " \"id\": \"brand-123\",\n" + + " \"applicationId\": \"app-123\",\n" + + " \"entityId\": \"entity-456\",\n" + + " \"name\": \"Example Brand\",\n" + + " \"stage\": \"ACTIVE\",\n" + + " \"website\": \"https://example.com\",\n" + + " \"createdDate\": \"2023-01-01T12:00:00\",\n" + + " \"lastModifiedDate\": \"2023-01-02T12:00:00\",\n" + + " \"referenceId\": \"ref-789\",\n" + + " \"legalName\": \"Example Legal Name\",\n" + + " \"countryCode\": \"US\",\n" + + " \"supportEmail\": \"support@example.com\",\n" + + " \"supportPhone\": \"+1234567890\",\n" + + " \"vertical\": \"TECH\",\n" + + " \"taxId\": \"TAX123456\",\n" + + " \"taxIdIssuingCountry\": \"US\",\n" + + " \"type\": \"BUSINESS\",\n" + + " \"stockExchange\": \"NASDAQ\",\n" + + " \"stockSymbol\": \"EXMPL\",\n" + + " \"businessContactEmail\": \"contact@example.com\"\n" + + "}"; + + setUpSuccessGetRequest("/number-registration/1/brands/brand-123", Map.of(), givenResponse); + + Consumer assertions = (brandResponse) -> { + then(brandResponse.getId()).isEqualTo("brand-123"); + then(brandResponse.getApplicationId()).isEqualTo("app-123"); + then(brandResponse.getEntityId()).isEqualTo("entity-456"); + then(brandResponse.getName()).isEqualTo("Example Brand"); + then(brandResponse.getStage()).isEqualTo("ACTIVE"); + then(brandResponse.getWebsite()).isEqualTo("https://example.com"); + then(brandResponse.getCreatedDate()).isEqualTo(LocalDateTime.parse("2023-01-01T12:00:00")); + then(brandResponse.getLastModifiedDate()).isEqualTo(LocalDateTime.parse("2023-01-02T12:00:00")); + then(brandResponse.getReferenceId()).isEqualTo("ref-789"); + then(brandResponse.getLegalName()).isEqualTo("Example Legal Name"); + then(brandResponse.getCountryCode()).isEqualTo("US"); + then(brandResponse.getSupportEmail()).isEqualTo("support@example.com"); + then(brandResponse.getSupportPhone()).isEqualTo("+1234567890"); + then(brandResponse.getVertical()).isEqualTo("TECH"); + then(brandResponse.getTaxId()).isEqualTo("TAX123456"); + then(brandResponse.getTaxIdIssuingCountry()).isEqualTo("US"); + then(brandResponse.getType()).isEqualTo("BUSINESS"); + then(brandResponse.getStockExchange()).isEqualTo("NASDAQ"); + then(brandResponse.getStockSymbol()).isEqualTo("EXMPL"); + then(brandResponse.getBusinessContactEmail()).isEqualTo("contact@example.com"); + }; + + BrandApi api = new BrandApi(getApiClient()); + var call = api.getBrands(brandId); + testSuccessfulCall(call::execute, assertions); + } + + @Test + void shouldDeleteBrandById() { + String brandId = "brand-123"; + setUpNoResponseBodyDeleteRequest("/number-registration/1/brands/brand-123", Map.of(), 200); + + BrandApi api = new BrandApi(getApiClient()); + var call = api.deleteBrand(brandId); + + // No response body to assert, just ensure no exception is thrown + testSuccessfulCallWithNoBody(call::executeAsync, 200); + } + + @Test + void shouldRegisterBrandById() { + + String brandId = "brand-123"; + setUpNoBodyPostRequest("/number-registration/1/brands/brand-123/register", Map.of(), 200); + + BrandApi api = new BrandApi(getApiClient()); + var call = api.registerBrand(brandId); + + // No response body to assert, just ensure no exception is thrown + testSuccessfulCallWithNoBody(call::executeAsync, 200); + } + + @Test + void shouldGetBrandRegistrarStatuses() { + String brandId = "brand-123"; + String givenResponse = "{\n" + " \"registrar\": \"SOME_REGISTRAR\",\n" + + " \"state\": \"APPROVED\",\n" + + " \"brandIdentityStatus\": \"test\"\n" + + "}"; + + setUpSuccessGetRequest("/number-registration/1/brands/brand-123/registrar-statuses", Map.of(), givenResponse); + + Consumer assertions = (response) -> { + then(response.getRegistrar()).isEqualTo("SOME_REGISTRAR"); + then(response.getState()).isEqualTo("APPROVED"); + then(response.getBrandIdentityStatus()).isEqualTo("test"); + }; + + BrandApi api = new BrandApi(getApiClient()); + var call = api.getBrandRegistrarStatuses(brandId); + testSuccessfulCall(call::execute, assertions); + } + + @Test + void shouldVetBrand() throws JsonProcessingException { + + String brandId = "brand-123"; + String givenRequest = "{\n" + " \"status\": \"STANDARD\",\n" + " \"type\": \"Some info\"\n" + "}"; + String givenResponse = "{\n" + " \"vetId\": \"vet-456\",\n" + + " \"brandId\": \"brand-123\",\n" + + " \"status\": \"APPROVED\",\n" + + " \"createdDate\": \"2023-01-01T12:00:00\"\n" + + "}"; + + setUpPostRequest("/number-registration/1/brands/brand-123/vets", givenRequest, givenResponse, 200); + + Consumer assertions = (vetResponse) -> { + then(vetResponse.getVetId()).isEqualTo("vet-456"); + then(vetResponse.getBrandId()).isEqualTo("brand-123"); + then(vetResponse.getStatus()).isEqualTo("APPROVED"); + }; + + ObjectMapper objectMapper = new ObjectMapper(); + BrandVetRequest vetRequest = objectMapper.readValue(givenRequest, BrandVetRequest.class); + + BrandApi api = new BrandApi(getApiClient()); + var call = api.vetBrand(vetRequest, brandId); + testSuccessfulCall(call::execute, assertions); + } + + @Test + void shouldGetBrandVetById() { + + String brandId = "brand-123"; + String vetId = "vet-456"; + String givenResponse = "{\n" + " \"vetId\": \"vet-456\",\n" + + " \"brandId\": \"brand-123\",\n" + + " \"status\": \"APPROVED\"\n" + + "}"; + + setUpSuccessGetRequest("/number-registration/1/brands/brand-123/vets/vet-456", Map.of(), givenResponse); + + Consumer assertions = (vetResponse) -> { + then(vetResponse.getVetId()).isEqualTo("vet-456"); + then(vetResponse.getBrandId()).isEqualTo("brand-123"); + then(vetResponse.getStatus()).isEqualTo("APPROVED"); + }; + + BrandApi api = new BrandApi(getApiClient()); + var call = api.getBrandVet(brandId, vetId); + testSuccessfulCall(call::execute, assertions); + } + + @Test + void shouldResend2fa() { + String brandId = "brand-123"; + setUpNoBodyPostRequest("/number-registration/1/brands/brand-123/resend2fa", Map.of(), 200); + + BrandApi api = new BrandApi(getApiClient()); + var call = api.resend2fa(brandId); + + // No response body to assert, just ensure no exception is thrown + testSuccessfulCallWithNoBody(call::executeAsync, 200); + } +} From ac9d6969854b5a7540455a288d9531731a1ba1d6 Mon Sep 17 00:00:00 2001 From: Venugopal Date: Wed, 26 Nov 2025 08:48:41 -0500 Subject: [PATCH 2/4] Add brand API --- src/main/java/com/infobip/model/Address.java | 133 ++++++++++++++++++ .../infobip/model/AlternateBusinessId.java | 49 +++++++ .../com/infobip/model/GetBrandResponse.java | 25 ---- 3 files changed, 182 insertions(+), 25 deletions(-) create mode 100644 src/main/java/com/infobip/model/Address.java create mode 100644 src/main/java/com/infobip/model/AlternateBusinessId.java delete mode 100644 src/main/java/com/infobip/model/GetBrandResponse.java diff --git a/src/main/java/com/infobip/model/Address.java b/src/main/java/com/infobip/model/Address.java new file mode 100644 index 0000000..c2a5872 --- /dev/null +++ b/src/main/java/com/infobip/model/Address.java @@ -0,0 +1,133 @@ +package com.infobip.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Address { + private String city; + private String state; + private String street; + private String zipCode; + /** + * Sets city. + * + * @param city the city + * @return This {@link Address} instance. + */ + public Address city(String city) { + this.city = city; + return this; + } + + /** + * Returns city. + * + * @return city + */ + @JsonProperty("city") + public String getCity() { + return city; + } + + /** + * Sets the city. + * + * @param city the city + */ + @JsonProperty("city") + public void setCity(String city) { + this.city = city; + } + + /** + * Sets the state. + * + * @param state + * @return This {@link Address} instance. + */ + public Address state(String state) { + this.state = state; + return this; + } + + /** + * Returns state. + * + * @return state + */ + @JsonProperty("state") + public String getState() { + return state; + } + + /** + * Sets state. + * + * @param state the state + */ + @JsonProperty("state") + public void setState(String state) { + this.state = state; + } + + /** + * Sets street. + * + * @param street the street + * @return This {@link Address} instance. + */ + public Address street(String street) { + this.street = street; + return this; + } + + /** + * Returns street. + * + * @return street + */ + @JsonProperty("street") + public String getStreet() { + return street; + } + + /** + * Sets street. + * + * @param street the street + */ + @JsonProperty("street") + public void setStreet(String street) { + this.street = street; + } + + /** + * Sets zipCode. + * + * @param zipCode the zip code + * @return This {@link Address} instance. + */ + public Address zipCode(String zipCode) { + this.zipCode = zipCode; + return this; + } + + /** + * Returns zipCode. + * + * @return zipCode + */ + @JsonProperty("zipCode") + public String getZipCode() { + return zipCode; + } + + /** + * Sets zipCode. + * + * @param zipCode the zip code + */ + @JsonProperty("zipCode") + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } +} diff --git a/src/main/java/com/infobip/model/AlternateBusinessId.java b/src/main/java/com/infobip/model/AlternateBusinessId.java new file mode 100644 index 0000000..2ae7280 --- /dev/null +++ b/src/main/java/com/infobip/model/AlternateBusinessId.java @@ -0,0 +1,49 @@ +package com.infobip.model; + +public class AlternateBusinessId { + private String id; + private String type; + /** + * Gets the id. + */ + public String getId() { + return id; + } + + /** + * Sets the id. + */ + public void setId(String id) { + this.id = id; + } + + /** + * Sets the id and returns this. + */ + public AlternateBusinessId id(String id) { + this.id = id; + return this; + } + + /** + * Gets the type. + */ + public String getType() { + return type; + } + + /** + * Sets the type. + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the type and returns this. + */ + public AlternateBusinessId type(String type) { + this.type = type; + return this; + } +} diff --git a/src/main/java/com/infobip/model/GetBrandResponse.java b/src/main/java/com/infobip/model/GetBrandResponse.java deleted file mode 100644 index 321954c..0000000 --- a/src/main/java/com/infobip/model/GetBrandResponse.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.infobip.model; - -import java.util.List; - -public class GetBrandResponse { - private List results; - private Paging paging; - - // Getters and setters - public List getResults() { - return results; - } - - public void setResults(List results) { - this.results = results; - } - - public Paging getPaging() { - return paging; - } - - public void setPaging(Paging paging) { - this.paging = paging; - } -} From c0be733dbba06890d0f230f06b5a9ebda785584c Mon Sep 17 00:00:00 2001 From: Venugopal Date: Fri, 5 Dec 2025 10:33:57 -0500 Subject: [PATCH 3/4] fix model --- src/main/java/com/infobip/api/BrandApi.java | 5 +++-- src/test/java/com/infobip/api/BrandsApiTest.java | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/infobip/api/BrandApi.java b/src/main/java/com/infobip/api/BrandApi.java index bdeaff4..a49f59a 100644 --- a/src/main/java/com/infobip/api/BrandApi.java +++ b/src/main/java/com/infobip/api/BrandApi.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.infobip.*; import com.infobip.model.*; +import java.util.List; import java.util.Objects; import okhttp3.Call; @@ -262,11 +263,11 @@ private GetBrandRegistrarStatusesRequest(String brandId) { * Executes the getBrandRegistrarStatuses request * @throws ApiException If the API call fails or an error occurs during the request or response processing. */ - public GetBrandRegistrarStatusesResponse execute() throws ApiException { + public List execute() throws ApiException { RequestDefinition getBrandRegistrarStatusesDefinition = getBrandRegistrarStatusesDefinition(brandId); return apiClient.execute( getBrandRegistrarStatusesDefinition, - new TypeReference() {}.getType()); + new TypeReference>() {}.getType()); } /** diff --git a/src/test/java/com/infobip/api/BrandsApiTest.java b/src/test/java/com/infobip/api/BrandsApiTest.java index 05b1f02..f54b80d 100644 --- a/src/test/java/com/infobip/api/BrandsApiTest.java +++ b/src/test/java/com/infobip/api/BrandsApiTest.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.infobip.model.*; import java.time.LocalDateTime; +import java.util.List; import java.util.Map; import java.util.function.Consumer; import org.junit.jupiter.api.Test; @@ -177,17 +178,17 @@ void shouldRegisterBrandById() { @Test void shouldGetBrandRegistrarStatuses() { String brandId = "brand-123"; - String givenResponse = "{\n" + " \"registrar\": \"SOME_REGISTRAR\",\n" + String givenResponse = "[{\n" + " \"registrar\": \"SOME_REGISTRAR\",\n" + " \"state\": \"APPROVED\",\n" + " \"brandIdentityStatus\": \"test\"\n" - + "}"; + + "}]"; setUpSuccessGetRequest("/number-registration/1/brands/brand-123/registrar-statuses", Map.of(), givenResponse); - Consumer assertions = (response) -> { - then(response.getRegistrar()).isEqualTo("SOME_REGISTRAR"); - then(response.getState()).isEqualTo("APPROVED"); - then(response.getBrandIdentityStatus()).isEqualTo("test"); + Consumer> assertions = (response) -> { + then(response.get(0).getRegistrar()).isEqualTo("SOME_REGISTRAR"); + then(response.get(0).getState()).isEqualTo("APPROVED"); + then(response.get(0).getBrandIdentityStatus()).isEqualTo("test"); }; BrandApi api = new BrandApi(getApiClient()); From 77ba32851e42481556ad2288f3b356f11585b842 Mon Sep 17 00:00:00 2001 From: Venugopal Date: Fri, 5 Dec 2025 15:52:15 -0500 Subject: [PATCH 4/4] update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 184e33b..588ecac 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The current version of this library includes this subset of Infobip products: * [Viber](https://www.infobip.com/docs/api/channels/viber) * [Messages API](https://www.infobip.com/docs/api/platform/messages-api) * [Moments API](https://www.infobip.com/docs/api/customer-engagement/moments) +* [[Brands API](https://www.infobip.com/docs/api/platform/numbers/number-registration/brands)] ## General Info For `infobip-api-java-client` versioning we use [Semantic Versioning][semver] scheme.