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.
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.ClientCreate;
import com.zendesk.sunshine_conversations_client.model.ClientListResponse;
import com.zendesk.sunshine_conversations_client.model.ClientResponse;
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 ClientsApi {
private ApiClient apiClient;
public ClientsApi() {
this(Configuration.getDefaultApiClient());
}
public ClientsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Create Client
* Create a client and link it to a channel specified by the `matchCriteria.type`. Note that the client is initially created with a `pending` status. The status of the linking request can be tracked by listening to the `link:match`, `link:success` and `link:failure` webhooks (only available in v1). For more information, see [link-events](https://docs.smooch.io/rest/v1/#link-events).
* @param clientCreate (required)
* @param appId Identifies the app. (required)
* @param userIdOrExternalId The user's id or externalId. (required)
* @return a {@code ClientResponse}
* @throws ApiException if fails to make API call
*/
public ClientResponse createClient(ClientCreate clientCreate, String appId, String userIdOrExternalId) throws ApiException {
Object localVarPostBody = clientCreate;
// verify the required parameter 'clientCreate' is set
if (clientCreate == null) {
throw new ApiException(400, "Missing the required parameter 'clientCreate' when calling createClient");
}
// verify the required parameter 'appId' is set
if (appId == null) {
throw new ApiException(400, "Missing the required parameter 'appId' when calling createClient");
}
// verify the required parameter 'userIdOrExternalId' is set
if (userIdOrExternalId == null) {
throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling createClient");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.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);
}
/**
* List Clients
* Get all the clients for a particular user, including both linked clients and pending clients. This API is paginated through [cursor pagination](#section/Introduction/API-pagination-and-records-limits). ```shell /v2/apps/:appId/users/:userId/clients?page[after]=5ebee0975ac5304b664a12fa ```
* @param appId Identifies the app. (required)
* @param userIdOrExternalId The user's id or externalId. (required)
* @param page Contains parameters for applying cursor pagination. (optional)
* @return a {@code ClientListResponse}
* @throws ApiException if fails to make API call
*/
public ClientListResponse listClients(String appId, String userIdOrExternalId, 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 listClients");
}
// verify the required parameter 'userIdOrExternalId' is set
if (userIdOrExternalId == null) {
throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling listClients");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.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);
}
/**
* Remove Client
* Remove a particular client and unsubscribe it from all connected conversations.
* @param appId Identifies the app. (required)
* @param userIdOrExternalId The user's id or externalId. (required)
* @param clientId The client's id. (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object removeClient(String appId, String userIdOrExternalId, String clientId) 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 removeClient");
}
// verify the required parameter 'userIdOrExternalId' is set
if (userIdOrExternalId == null) {
throw new ApiException(400, "Missing the required parameter 'userIdOrExternalId' when calling removeClient");
}
// verify the required parameter 'clientId' is set
if (clientId == null) {
throw new ApiException(400, "Missing the required parameter 'clientId' when calling removeClient");
}
// create path and map variables
String localVarPath = "/v2/apps/{appId}/users/{userIdOrExternalId}/clients/{clientId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId.toString()))
.replaceAll("\\{" + "userIdOrExternalId" + "\\}", apiClient.escapeString(userIdOrExternalId.toString()))
.replaceAll("\\{" + "clientId" + "\\}", apiClient.escapeString(clientId.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