Skip to content

Commit

Permalink
Updating MessagesAPI classes
Browse files Browse the repository at this point in the history
  • Loading branch information
ib-tjuhasz committed Nov 18, 2024
1 parent 80acf7d commit b65dc29
Show file tree
Hide file tree
Showing 66 changed files with 6,302 additions and 155 deletions.
68 changes: 65 additions & 3 deletions src/main/java/com/infobip/api/MessagesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
package com.infobip.api;

import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.annotations.Beta;
import com.infobip.ApiCallback;
import com.infobip.ApiClient;
import com.infobip.ApiException;
import com.infobip.RequestDefinition;
import com.infobip.model.MessagesApiEventRequest;
import com.infobip.model.MessagesApiRequest;
import com.infobip.model.MessagesApiResponse;
import com.infobip.model.MessagesApiValidationOkResponse;
import java.util.Objects;

/**
Expand Down Expand Up @@ -93,7 +93,6 @@ public okhttp3.Call executeAsync(ApiCallback<MessagesApiResponse> callback) {
* @return SendMessagesApiEventsRequest
* @see <a href="https://www.infobip.com/docs/messages-api">Learn more about the Messages API and use cases</a>
*/
@Beta
public SendMessagesApiEventsRequest sendMessagesApiEvents(MessagesApiEventRequest messagesApiEventRequest) {
return new SendMessagesApiEventsRequest(messagesApiEventRequest);
}
Expand Down Expand Up @@ -153,8 +152,71 @@ public okhttp3.Call executeAsync(ApiCallback<MessagesApiResponse> callback) {
* @return SendMessagesApiMessageRequest
* @see <a href="https://www.infobip.com/docs/messages-api">Learn more about the Messages API and use cases</a>
*/
@Beta
public SendMessagesApiMessageRequest sendMessagesApiMessage(MessagesApiRequest messagesApiRequest) {
return new SendMessagesApiMessageRequest(messagesApiRequest);
}

private RequestDefinition validateMessagesApiMessageDefinition(MessagesApiRequest messagesApiRequest) {
RequestDefinition.Builder builder = RequestDefinition.builder("POST", "/messages-api/1/messages/validate")
.body(messagesApiRequest)
.requiresAuthentication(true)
.accept("application/json")
.contentType("application/json");

return builder.build();
}

/**
* validateMessagesApiMessage request builder class.
*/
public class ValidateMessagesApiMessageRequest {
private final MessagesApiRequest messagesApiRequest;

private ValidateMessagesApiMessageRequest(MessagesApiRequest messagesApiRequest) {
this.messagesApiRequest = Objects.requireNonNull(
messagesApiRequest, "The required parameter 'messagesApiRequest' is missing.");
}

/**
* Executes the validateMessagesApiMessage request.
*
* @return MessagesApiValidationOkResponse The deserialized response.
* @throws ApiException If the API call fails or an error occurs during the request or response processing.
*/
public MessagesApiValidationOkResponse execute() throws ApiException {
RequestDefinition validateMessagesApiMessageDefinition =
validateMessagesApiMessageDefinition(messagesApiRequest);
return apiClient.execute(
validateMessagesApiMessageDefinition,
new TypeReference<MessagesApiValidationOkResponse>() {}.getType());
}

/**
* Executes the validateMessagesApiMessage request asynchronously.
*
* @param callback The {@link ApiCallback} to be invoked.
* @return The {@link okhttp3.Call} associated with the API request.
*/
public okhttp3.Call executeAsync(ApiCallback<MessagesApiValidationOkResponse> callback) {
RequestDefinition validateMessagesApiMessageDefinition =
validateMessagesApiMessageDefinition(messagesApiRequest);
return apiClient.executeAsync(
validateMessagesApiMessageDefinition,
new TypeReference<MessagesApiValidationOkResponse>() {}.getType(),
callback);
}
}

/**
* Validate a Messages API message.
* <p>
* Perform a detailed validation of Messages API messages. This endpoint executes more specific checks than the &#x60;/messages&#x60; endpoint such as: possible channel-specific validations, verification of each failover step and unknown fields. Returns &#x60;200 OK&#x60; when the request would be accepted by the platform or &#x60;400 BAD_REQUEST&#x60; when it may fail at any point. Use this endpoint to validate messages before sending them to catch potential issues early.
*
* @param messagesApiRequest (required)
* @return ValidateMessagesApiMessageRequest
* @see <a href="https://www.infobip.com/docs/messages-api">Learn more about the Messages API and use cases</a>
*/
public ValidateMessagesApiMessageRequest validateMessagesApiMessage(MessagesApiRequest messagesApiRequest) {
return new ValidateMessagesApiMessageRequest(messagesApiRequest);
}
}
12 changes: 12 additions & 0 deletions src/main/java/com/infobip/model/MessagesApiBaseFailover.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* This class is auto generated from the Infobip OpenAPI specification
* through the OpenAPI Specification Client API libraries (Re)Generator (OSCAR),
* powered by the OpenAPI Generator (https://openapi-generator.tech).
*
* Do not edit manually. To learn how to raise an issue, see the CONTRIBUTING guide
* or contact us @ [email protected].
*/

package com.infobip.model;

public interface MessagesApiBaseFailover {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* This class is auto generated from the Infobip OpenAPI specification
* through the OpenAPI Specification Client API libraries (Re)Generator (OSCAR),
* powered by the OpenAPI Generator (https://openapi-generator.tech).
*
* Do not edit manually. To learn how to raise an issue, see the CONTRIBUTING guide
* or contact us @ [email protected].
*/

package com.infobip.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.Objects;

/**
* List of buttons of a card.
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "type",
visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = MessagesApiCarouselTemplateOpenUrlButton.class, name = "OPEN_URL"),
@JsonSubTypes.Type(value = MessagesApiCarouselTemplatePhoneNumberButton.class, name = "PHONE_NUMBER"),
@JsonSubTypes.Type(value = MessagesApiCarouselTemplateQuickReplyButton.class, name = "QUICK_REPLY"),
})
public abstract class MessagesApiCarouselTemplateButton {

protected final MessagesApiCarouselTemplateButtonType type;

/**
* Constructs a new {@link MessagesApiCarouselTemplateButton} instance.
*/
public MessagesApiCarouselTemplateButton(String type) {
this.type = MessagesApiCarouselTemplateButtonType.fromValue(type);
}

/**
* Returns type.
* <p>
* The field is required.
*
* @return type
*/
@JsonProperty("type")
public MessagesApiCarouselTemplateButtonType getType() {
return type;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MessagesApiCarouselTemplateButton messagesApiCarouselTemplateButton = (MessagesApiCarouselTemplateButton) o;
return Objects.equals(this.type, messagesApiCarouselTemplateButton.type);
}

@Override
public int hashCode() {
return Objects.hash(type);
}

@Override
public String toString() {
String newLine = System.lineSeparator();
return new StringBuilder()
.append("class MessagesApiCarouselTemplateButton {")
.append(newLine)
.append(" type: ")
.append(toIndentedString(type))
.append(newLine)
.append("}")
.toString();
}

private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
String lineSeparator = System.lineSeparator();
String lineSeparatorFollowedByIndentation = lineSeparator + " ";
return o.toString().replace(lineSeparator, lineSeparatorFollowedByIndentation);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This class is auto generated from the Infobip OpenAPI specification
* through the OpenAPI Specification Client API libraries (Re)Generator (OSCAR),
* powered by the OpenAPI Generator (https://openapi-generator.tech).
*
* Do not edit manually. To learn how to raise an issue, see the CONTRIBUTING guide
* or contact us @ [email protected].
*/

package com.infobip.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* Represents MessagesApiCarouselTemplateButtonType enumeration.
*/
public enum MessagesApiCarouselTemplateButtonType {
QUICK_REPLY("QUICK_REPLY"),
OPEN_URL("OPEN_URL"),
PHONE_NUMBER("PHONE_NUMBER");

private final String value;

MessagesApiCarouselTemplateButtonType(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static MessagesApiCarouselTemplateButtonType fromValue(String value) {
for (MessagesApiCarouselTemplateButtonType enumElement : MessagesApiCarouselTemplateButtonType.values()) {
if (enumElement.value.equals(value)) {
return enumElement;
}
}
throw new IllegalArgumentException("Unexpected enum value '" + value + "'.");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* This class is auto generated from the Infobip OpenAPI specification
* through the OpenAPI Specification Client API libraries (Re)Generator (OSCAR),
* powered by the OpenAPI Generator (https://openapi-generator.tech).
*
* Do not edit manually. To learn how to raise an issue, see the CONTRIBUTING guide
* or contact us @ [email protected].
*/

package com.infobip.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;

/**
* Represents MessagesApiCarouselTemplateOpenUrlButton model.
*/
public class MessagesApiCarouselTemplateOpenUrlButton extends MessagesApiCarouselTemplateButton {

private String suffix;

/**
* Constructs a new {@link MessagesApiCarouselTemplateOpenUrlButton} instance.
*/
public MessagesApiCarouselTemplateOpenUrlButton() {
super("OPEN_URL");
}

/**
* Sets suffix.
* <p>
* Field description:
* Extension of a URL defined in the registered template.
* <p>
* The field is required.
*
* @param suffix
* @return This {@link MessagesApiCarouselTemplateOpenUrlButton instance}.
*/
public MessagesApiCarouselTemplateOpenUrlButton suffix(String suffix) {
this.suffix = suffix;
return this;
}

/**
* Returns suffix.
* <p>
* Field description:
* Extension of a URL defined in the registered template.
* <p>
* The field is required.
*
* @return suffix
*/
@JsonProperty("suffix")
public String getSuffix() {
return suffix;
}

/**
* Sets suffix.
* <p>
* Field description:
* Extension of a URL defined in the registered template.
* <p>
* The field is required.
*
* @param suffix
*/
@JsonProperty("suffix")
public void setSuffix(String suffix) {
this.suffix = suffix;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MessagesApiCarouselTemplateOpenUrlButton messagesApiCarouselTemplateOpenUrlButton =
(MessagesApiCarouselTemplateOpenUrlButton) o;
return Objects.equals(this.suffix, messagesApiCarouselTemplateOpenUrlButton.suffix) && super.equals(o);
}

@Override
public int hashCode() {
return Objects.hash(suffix, super.hashCode());
}

@Override
public String toString() {
String newLine = System.lineSeparator();
return new StringBuilder()
.append("class MessagesApiCarouselTemplateOpenUrlButton {")
.append(newLine)
.append(" ")
.append(toIndentedString(super.toString()))
.append(newLine)
.append(" suffix: ")
.append(toIndentedString(suffix))
.append(newLine)
.append("}")
.toString();
}

private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
String lineSeparator = System.lineSeparator();
String lineSeparatorFollowedByIndentation = lineSeparator + " ";
return o.toString().replace(lineSeparator, lineSeparatorFollowedByIndentation);
}
}
Loading

0 comments on commit b65dc29

Please sign in to comment.