Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.zendesk.sunshine_conversations_client.api.MessagesApi Maven / Gradle / Ivy
package com.zendesk.sunshine_conversations_client.api;
import com.zendesk.sunshine_conversations_client.ApiException;
import com.zendesk.sunshine_conversations_client.ApiClient;
import com.zendesk.sunshine_conversations_client.Configuration;
import com.zendesk.sunshine_conversations_client.Pair;
import jakarta.ws.rs.core.GenericType;
import com.zendesk.sunshine_conversations_client.model.MessageListResponse;
import com.zendesk.sunshine_conversations_client.model.MessagePost;
import com.zendesk.sunshine_conversations_client.model.MessagePostResponse;
import com.zendesk.sunshine_conversations_client.model.Page;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MessagesApi {
private ApiClient apiClient;
public MessagesApi() {
this(Configuration.getDefaultApiClient());
}
public MessagesApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Delete All Messages
* Delete all messages of a particular conversation.
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object deleteAllMessages(String appId, String conversationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAllMessages");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteAllMessages");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Delete Message
* Delete a single message of a particular conversation.
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @param messageId The id of the message. (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object deleteMessage(String appId, String conversationId, String messageId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteMessage");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteMessage");
}
// verify the required parameter 'messageId' is set
if (messageId == null) {
throw new ApiException(400, "Missing the required parameter 'messageId' when calling deleteMessage");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()))
.replaceAll("\\{" + "messageId" + "\\}", apiClient.escapeString(messageId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List Messages
* List all messages for a particular conversation. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits), in the _backwards_ direction, with the most recent (i.e. last) page of messages being returned by default. The `hasMore` flag indicates whether more messages exist in the direction you are currently paginating through. To page backwards in the history, use the `beforeCursor` or follow the `prev` link. The page size limit is fixed at 100 messages per page. ```shell /v2/apps/:appId/conversations/:conversationId/messages?page[before]=5f32b88acf6bf25073b2be56 ```
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @param page Contains parameters for applying cursor pagination. (optional)
* @return a {@code MessageListResponse}
* @throws ApiException if fails to make API call
*/
public MessageListResponse listMessages(String appId, String conversationId, Page page) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling listMessages");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listMessages");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Post Message
* Send a message in a particular conversation.
* @param messagePost (required)
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code MessagePostResponse}
* @throws ApiException if fails to make API call
*/
public MessagePostResponse postMessage(MessagePost messagePost, String appId, String conversationId) throws ApiException {
Object localVarPostBody = messagePost;
// verify the required parameter 'messagePost' is set
if (messagePost == null) {
throw new ApiException(400, "Missing the required parameter 'messagePost' when calling postMessage");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling postMessage");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postMessage");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Delete All Messages
* Delete all messages of a particular conversation.
* @param bearerToken a token to be used for this request (required)
*
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object deleteAllMessages(String bearerToken, String appId, String conversationId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteAllMessages");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteAllMessages");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Authorization", "Bearer " + bearerToken);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Delete Message
* Delete a single message of a particular conversation.
* @param bearerToken a token to be used for this request (required)
*
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @param messageId The id of the message. (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object deleteMessage(String bearerToken, String appId, String conversationId, String messageId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling deleteMessage");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteMessage");
}
// verify the required parameter 'messageId' is set
if (messageId == null) {
throw new ApiException(400, "Missing the required parameter 'messageId' when calling deleteMessage");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages/{messageId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()))
.replaceAll("\\{" + "messageId" + "\\}", apiClient.escapeString(messageId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Authorization", "Bearer " + bearerToken);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List Messages
* List all messages for a particular conversation. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits), in the _backwards_ direction, with the most recent (i.e. last) page of messages being returned by default. The `hasMore` flag indicates whether more messages exist in the direction you are currently paginating through. To page backwards in the history, use the `beforeCursor` or follow the `prev` link. The page size limit is fixed at 100 messages per page. ```shell /v2/apps/:appId/conversations/:conversationId/messages?page[before]=5f32b88acf6bf25073b2be56 ```
* @param bearerToken a token to be used for this request (required)
*
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @param page Contains parameters for applying cursor pagination. (optional)
* @return a {@code MessageListResponse}
* @throws ApiException if fails to make API call
*/
public MessageListResponse listMessages(String bearerToken, String appId, String conversationId, Page page) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling listMessages");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling listMessages");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
localVarHeaderParams.put("Authorization", "Bearer " + bearerToken);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Post Message
* Send a message in a particular conversation.
* @param bearerToken a token to be used for this request (required)
*
* @param messagePost (required)
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code MessagePostResponse}
* @throws ApiException if fails to make API call
*/
public MessagePostResponse postMessage(String bearerToken, MessagePost messagePost, String appId, String conversationId) throws ApiException {
Object localVarPostBody = messagePost;
// verify the required parameter 'messagePost' is set
if (messagePost == null) {
throw new ApiException(400, "Missing the required parameter 'messagePost' when calling postMessage");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling postMessage");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling postMessage");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}/messages".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "conversationId" + "\\}", apiClient.escapeString(conversationId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarHeaderParams.put("Authorization", "Bearer " + bearerToken);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "basicAuth", "bearerAuth" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}