Skip to content
96 changes: 96 additions & 0 deletions src/main/java/com/infobip/api/RcsApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* 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.api;

import com.fasterxml.jackson.core.type.TypeReference;
import com.infobip.ApiCallback;
import com.infobip.ApiClient;
import com.infobip.ApiException;
import com.infobip.RequestDefinition;
import com.infobip.model.RcsOutboundRequest;
import com.infobip.model.RcsOutboundResponse;
import java.util.Objects;

/**
* Represents RcsApi API client.
*/
public class RcsApi {

private final ApiClient apiClient;

/**
* Constructs a new instance of RcsApi.
*
* @param apiClient {@link ApiClient} instance to delegate calls to.
*/
public RcsApi(ApiClient apiClient) {
this.apiClient = Objects.requireNonNull(apiClient, "ApiClient must not be null!");
}

private RequestDefinition sendRcsOutboundMessageDefinition(RcsOutboundRequest rcsOutboundRequest) {
RequestDefinition.Builder builder = RequestDefinition.builder("POST", "/rcs/1/message/outbound")
.body(rcsOutboundRequest)
.requiresAuthentication(true)
.accept("application/json")
.contentType("application/json");

return builder.build();
}

/**
* sendRcsOutboundMessage request builder class.
*/
public class SendRcsOutboundMessageRequest {
private final RcsOutboundRequest rcsOutboundRequest;

private SendRcsOutboundMessageRequest(RcsOutboundRequest rcsOutboundRequest) {
this.rcsOutboundRequest = Objects.requireNonNull(
rcsOutboundRequest, "The required parameter 'rcsOutboundRequest' is missing.");
}

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

/**
* Executes the sendRcsOutboundMessage 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<RcsOutboundResponse> callback) {
RequestDefinition sendRcsOutboundMessageDefinition = sendRcsOutboundMessageDefinition(rcsOutboundRequest);
return apiClient.executeAsync(
sendRcsOutboundMessageDefinition, new TypeReference<RcsOutboundResponse>() {}.getType(), callback);
}
}

/**
* Send RCS outbound message.
* <p>
* Send Rich Communication Services (RCS) messages with advanced features like rich cards, carousels, and suggested actions.
* RCS enables a richer messaging experience compared to traditional SMS.
*
* @param rcsOutboundRequest (required)
* @return SendRcsOutboundMessageRequest
* @see <a href="https://www.infobip.com/docs/rcs">Learn more about RCS messaging</a>
*/
public SendRcsOutboundMessageRequest sendRcsOutboundMessage(RcsOutboundRequest rcsOutboundRequest) {
return new SendRcsOutboundMessageRequest(rcsOutboundRequest);
}
}
257 changes: 257 additions & 0 deletions src/main/java/com/infobip/model/RcsCard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
/*
* 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.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* Represents RcsCard model.
*/
public class RcsCard {

private String title;

private String description;

private String mediaUrl;

private List<RcsSuggestedAction> actions;

/**
* Sets title.
* <p>
* Field description:
* Title of the rich card.
*
* @param title
* @return This {@link RcsCard instance}.
*/
public RcsCard title(String title) {
this.title = title;
return this;
}

/**
* Returns title.
* <p>
* Field description:
* Title of the rich card.
*
* @return title
*/
@JsonProperty("title")
public String getTitle() {
return title;
}

/**
* Sets title.
* <p>
* Field description:
* Title of the rich card.
*
* @param title
*/
@JsonProperty("title")
public void setTitle(String title) {
this.title = title;
}

/**
* Sets description.
* <p>
* Field description:
* Description text of the rich card.
*
* @param description
* @return This {@link RcsCard instance}.
*/
public RcsCard description(String description) {
this.description = description;
return this;
}

/**
* Returns description.
* <p>
* Field description:
* Description text of the rich card.
*
* @return description
*/
@JsonProperty("description")
public String getDescription() {
return description;
}

/**
* Sets description.
* <p>
* Field description:
* Description text of the rich card.
*
* @param description
*/
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}

/**
* Sets mediaUrl.
* <p>
* Field description:
* URL of the media file for the card (image or video).
*
* @param mediaUrl
* @return This {@link RcsCard instance}.
*/
public RcsCard mediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
return this;
}

/**
* Returns mediaUrl.
* <p>
* Field description:
* URL of the media file for the card (image or video).
*
* @return mediaUrl
*/
@JsonProperty("mediaUrl")
public String getMediaUrl() {
return mediaUrl;
}

/**
* Sets mediaUrl.
* <p>
* Field description:
* URL of the media file for the card (image or video).
*
* @param mediaUrl
*/
@JsonProperty("mediaUrl")
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}

/**
* Sets actions.
* <p>
* Field description:
* List of actions for the card.
*
* @param actions
* @return This {@link RcsCard instance}.
*/
public RcsCard actions(List<RcsSuggestedAction> actions) {
this.actions = actions;
return this;
}

/**
* Adds and item into actions.
* <p>
* Field description:
* List of actions for the card.
*
* @param actionsItem The item to be added to the list.
* @return This {@link RcsCard instance}.
*/
public RcsCard addActionsItem(RcsSuggestedAction actionsItem) {
if (this.actions == null) {
this.actions = new ArrayList<>();
}
this.actions.add(actionsItem);
return this;
}

/**
* Returns actions.
* <p>
* Field description:
* List of actions for the card.
*
* @return actions
*/
@JsonProperty("actions")
public List<RcsSuggestedAction> getActions() {
return actions;
}

/**
* Sets actions.
* <p>
* Field description:
* List of actions for the card.
*
* @param actions
*/
@JsonProperty("actions")
public void setActions(List<RcsSuggestedAction> actions) {
this.actions = actions;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RcsCard rcsCard = (RcsCard) o;
return Objects.equals(this.title, rcsCard.title)
&& Objects.equals(this.description, rcsCard.description)
&& Objects.equals(this.mediaUrl, rcsCard.mediaUrl)
&& Objects.equals(this.actions, rcsCard.actions);
}

@Override
public int hashCode() {
return Objects.hash(title, description, mediaUrl, actions);
}

@Override
public String toString() {
String newLine = System.lineSeparator();
return new StringBuilder()
.append("class RcsCard {")
.append(newLine)
.append(" title: ")
.append(toIndentedString(title))
.append(newLine)
.append(" description: ")
.append(toIndentedString(description))
.append(newLine)
.append(" mediaUrl: ")
.append(toIndentedString(mediaUrl))
.append(newLine)
.append(" actions: ")
.append(toIndentedString(actions))
.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