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.ConversationsApi 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.ConversationCreateBody;
import com.zendesk.sunshine_conversations_client.model.ConversationListFilter;
import com.zendesk.sunshine_conversations_client.model.ConversationListResponse;
import com.zendesk.sunshine_conversations_client.model.ConversationResponse;
import com.zendesk.sunshine_conversations_client.model.ConversationUpdateBody;
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 ConversationsApi {
private ApiClient apiClient;
public ConversationsApi() {
this(Configuration.getDefaultApiClient());
}
public ConversationsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create Conversation
* Create a conversation for the specified user(s).
* @param conversationCreateBody (required)
* @param appId Identifies the app. (required)
* @return a {@code ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse createConversation(ConversationCreateBody conversationCreateBody, String appId) throws ApiException {
Object localVarPostBody = conversationCreateBody;
// verify the required parameter 'conversationCreateBody' is set
if (conversationCreateBody == null) {
throw new ApiException(400, "Missing the required parameter 'conversationCreateBody' when calling createConversation");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling createConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.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 Conversation
* Delete an entire conversation record, along with its messages and attachments. Note that the default conversation cannot be deleted, but the messages contained [can be](#deleteAllMessages).
* @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 deleteConversation(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 deleteConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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);
}
/**
* Get Conversation
* Fetches an individual conversation.
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse getConversation(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 getConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling getConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List Conversations
* Lists all conversations that a user is part of. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). ```shell /v2/apps/:appId/conversations?filter[userId]=42589ad070d43be9b00ff7e5 ```
* @param appId Identifies the app. (required)
* @param filter Contains parameters for filtering the results. (required)
* @param page Contains parameters for applying cursor pagination. (optional)
* @return a {@code ConversationListResponse}
* @throws ApiException if fails to make API call
*/
public ConversationListResponse listConversations(String appId, ConversationListFilter filter, 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 listConversations");
}
// verify the required parameter 'filter' is set
if (filter == null) {
throw new ApiException(400, "Missing the required parameter 'filter' when calling listConversations");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.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));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));
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);
}
/**
* Update Conversation
* Updates a conversation record.
* @param conversationUpdateBody (required)
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse updateConversation(ConversationUpdateBody conversationUpdateBody, String appId, String conversationId) throws ApiException {
Object localVarPostBody = conversationUpdateBody;
// verify the required parameter 'conversationUpdateBody' is set
if (conversationUpdateBody == null) {
throw new ApiException(400, "Missing the required parameter 'conversationUpdateBody' when calling updateConversation");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling updateConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling updateConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Create Conversation
* Create a conversation for the specified user(s).
* @param bearerToken a token to be used for this request (required)
*
* @param conversationCreateBody (required)
* @param appId Identifies the app. (required)
* @return a {@code ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse createConversation(String bearerToken, ConversationCreateBody conversationCreateBody, String appId) throws ApiException {
Object localVarPostBody = conversationCreateBody;
// verify the required parameter 'conversationCreateBody' is set
if (conversationCreateBody == null) {
throw new ApiException(400, "Missing the required parameter 'conversationCreateBody' when calling createConversation");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling createConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.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);
}
/**
* Delete Conversation
* Delete an entire conversation record, along with its messages and attachments. Note that the default conversation cannot be deleted, but the messages contained [can be](#deleteAllMessages).
* @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 deleteConversation(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 deleteConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling deleteConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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);
}
/**
* Get Conversation
* Fetches an individual 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 ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse getConversation(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 getConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling getConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* List Conversations
* Lists all conversations that a user is part of. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). ```shell /v2/apps/:appId/conversations?filter[userId]=42589ad070d43be9b00ff7e5 ```
* @param bearerToken a token to be used for this request (required)
*
* @param appId Identifies the app. (required)
* @param filter Contains parameters for filtering the results. (required)
* @param page Contains parameters for applying cursor pagination. (optional)
* @return a {@code ConversationListResponse}
* @throws ApiException if fails to make API call
*/
public ConversationListResponse listConversations(String bearerToken, String appId, ConversationListFilter filter, 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 listConversations");
}
// verify the required parameter 'filter' is set
if (filter == null) {
throw new ApiException(400, "Missing the required parameter 'filter' when calling listConversations");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.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));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));
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);
}
/**
* Update Conversation
* Updates a conversation record.
* @param bearerToken a token to be used for this request (required)
*
* @param conversationUpdateBody (required)
* @param appId Identifies the app. (required)
* @param conversationId Identifies the conversation. (required)
* @return a {@code ConversationResponse}
* @throws ApiException if fails to make API call
*/
public ConversationResponse updateConversation(String bearerToken, ConversationUpdateBody conversationUpdateBody, String appId, String conversationId) throws ApiException {
Object localVarPostBody = conversationUpdateBody;
// verify the required parameter 'conversationUpdateBody' is set
if (conversationUpdateBody == null) {
throw new ApiException(400, "Missing the required parameter 'conversationUpdateBody' when calling updateConversation");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling updateConversation");
}
// verify the required parameter 'conversationId' is set
if (conversationId == null) {
throw new ApiException(400, "Missing the required parameter 'conversationId' when calling updateConversation");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/conversations/{conversationId}".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, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}