com.mypurecloud.sdk.api.PresenceApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-client Show documentation
Show all versions of platform-client Show documentation
The official Java SDK for the PureCloud Platform API SDK
The newest version!
package com.mypurecloud.sdk.api;
import com.fasterxml.jackson.core.type.TypeReference;
import com.mypurecloud.sdk.ApiException;
import com.mypurecloud.sdk.ApiClient;
import com.mypurecloud.sdk.ApiResponse;
import com.mypurecloud.sdk.Configuration;
import com.mypurecloud.sdk.model.*;
import com.mypurecloud.sdk.Pair;
import com.mypurecloud.sdk.model.ErrorBody;
import com.mypurecloud.sdk.model.OrganizationPresence;
import com.mypurecloud.sdk.model.OrganizationPresenceEntityListing;
import com.mypurecloud.sdk.model.SystemPresence;
import com.mypurecloud.sdk.model.UserPresence;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PresenceApi {
private ApiClient pcapiClient;
public PresenceApi() {
this(Configuration.getDefaultApiClient());
}
public PresenceApi(ApiClient apiClient) {
this.pcapiClient = apiClient;
}
public ApiClient getApiClient() {
return pcapiClient;
}
public void setApiClient(ApiClient apiClient) {
this.pcapiClient = apiClient;
}
/**
* Delete a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @throws ApiException if fails to make API call
*/
public void deletePresenceId(String presenceId) throws ApiException {
deletePresenceIdWithHttpInfo(presenceId);
}
/**
* Delete a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @throws ApiException if fails to make API call
*/
public ApiResponse deletePresenceIdWithHttpInfo(String presenceId) throws ApiException {
Object pclocalVarPostBody = null;
// verify the required parameter 'presenceId' is set
if (presenceId == null) {
throw new ApiException(400, "Missing the required parameter 'presenceId' when calling deletePresenceId");
}
// create path and map variables
String pclocalVarPath = "/api/v2/presencedefinitions/{presenceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "presenceId" + "\\}", pcapiClient.escapeString(presenceId.toString()));
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "DELETE", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, null);
}
/**
* Get a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @param localeCode The locale code to fetch for the presence definition. Use ALL to fetch everything. (optional)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public OrganizationPresence getPresenceId(String presenceId, String localeCode) throws ApiException {
return getPresenceIdWithHttpInfo(presenceId, localeCode).getResponseObject();
}
/**
* Get a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @param localeCode The locale code to fetch for the presence definition. Use ALL to fetch everything. (optional)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public ApiResponse getPresenceIdWithHttpInfo(String presenceId, String localeCode) throws ApiException {
Object pclocalVarPostBody = null;
// verify the required parameter 'presenceId' is set
if (presenceId == null) {
throw new ApiException(400, "Missing the required parameter 'presenceId' when calling getPresenceId");
}
// create path and map variables
String pclocalVarPath = "/api/v2/presencedefinitions/{presenceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "presenceId" + "\\}", pcapiClient.escapeString(presenceId.toString()));
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "localeCode", localeCode));
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
/**
* Get an Organization's list of Presence Definitions
*
* @param pageNumber Page number (optional, default to 1)
* @param pageSize Page size (optional, default to 25)
* @param deleted Deleted query can be TRUE, FALSE or ALL (optional, default to false)
* @param localeCode The locale code to fetch for each presence definition. Use ALL to fetch everything. (optional)
* @return OrganizationPresenceEntityListing
* @throws ApiException if fails to make API call
*/
public OrganizationPresenceEntityListing getPresencedefinitions(Integer pageNumber, Integer pageSize, String deleted, String localeCode) throws ApiException {
return getPresencedefinitionsWithHttpInfo(pageNumber, pageSize, deleted, localeCode).getResponseObject();
}
/**
* Get an Organization's list of Presence Definitions
*
* @param pageNumber Page number (optional, default to 1)
* @param pageSize Page size (optional, default to 25)
* @param deleted Deleted query can be TRUE, FALSE or ALL (optional, default to false)
* @param localeCode The locale code to fetch for each presence definition. Use ALL to fetch everything. (optional)
* @return OrganizationPresenceEntityListing
* @throws ApiException if fails to make API call
*/
public ApiResponse getPresencedefinitionsWithHttpInfo(Integer pageNumber, Integer pageSize, String deleted, String localeCode) throws ApiException {
Object pclocalVarPostBody = null;
// create path and map variables
String pclocalVarPath = "/api/v2/presencedefinitions".replaceAll("\\{format\\}","json");
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageNumber", pageNumber));
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageSize", pageSize));
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "deleted", deleted));
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "localeCode", localeCode));
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
/**
* Get the list of SystemPresences
*
* @return List
* @throws ApiException if fails to make API call
*/
public List getSystempresences() throws ApiException {
return getSystempresencesWithHttpInfo().getResponseObject();
}
/**
* Get the list of SystemPresences
*
* @return List
* @throws ApiException if fails to make API call
*/
public ApiResponse> getSystempresencesWithHttpInfo() throws ApiException {
Object pclocalVarPostBody = null;
// create path and map variables
String pclocalVarPath = "/api/v2/systempresences".replaceAll("\\{format\\}","json");
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference>() {});
}
/**
* Get a user's Presence
*
* @param userId user Id (required)
* @param sourceId Source (required)
* @return UserPresence
* @throws ApiException if fails to make API call
*/
public UserPresence getUserIdPresencesSourceId(String userId, String sourceId) throws ApiException {
return getUserIdPresencesSourceIdWithHttpInfo(userId, sourceId).getResponseObject();
}
/**
* Get a user's Presence
*
* @param userId user Id (required)
* @param sourceId Source (required)
* @return UserPresence
* @throws ApiException if fails to make API call
*/
public ApiResponse getUserIdPresencesSourceIdWithHttpInfo(String userId, String sourceId) throws ApiException {
Object pclocalVarPostBody = null;
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException(400, "Missing the required parameter 'userId' when calling getUserIdPresencesSourceId");
}
// verify the required parameter 'sourceId' is set
if (sourceId == null) {
throw new ApiException(400, "Missing the required parameter 'sourceId' when calling getUserIdPresencesSourceId");
}
// create path and map variables
String pclocalVarPath = "/api/v2/users/{userId}/presences/{sourceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "userId" + "\\}", pcapiClient.escapeString(userId.toString()))
.replaceAll("\\{" + "sourceId" + "\\}", pcapiClient.escapeString(sourceId.toString()));
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "GET", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
/**
* Patch a user's Presence
* The presence object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the 'source' defined in the path as the user's primary presence source. Option 2: Provide the presenceDefinition value. The 'id' is the only value required within the presenceDefinition. Option 3: Provide the message value. Option 1 can be combined with Option 2 and/or Option 3.
* @param userId user Id (required)
* @param sourceId Source (required)
* @param body User presence (required)
* @return UserPresence
* @throws ApiException if fails to make API call
*/
public UserPresence patchUserIdPresencesSourceId(String userId, String sourceId, UserPresence body) throws ApiException {
return patchUserIdPresencesSourceIdWithHttpInfo(userId, sourceId, body).getResponseObject();
}
/**
* Patch a user's Presence
* The presence object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the 'source' defined in the path as the user's primary presence source. Option 2: Provide the presenceDefinition value. The 'id' is the only value required within the presenceDefinition. Option 3: Provide the message value. Option 1 can be combined with Option 2 and/or Option 3.
* @param userId user Id (required)
* @param sourceId Source (required)
* @param body User presence (required)
* @return UserPresence
* @throws ApiException if fails to make API call
*/
public ApiResponse patchUserIdPresencesSourceIdWithHttpInfo(String userId, String sourceId, UserPresence body) throws ApiException {
Object pclocalVarPostBody = body;
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException(400, "Missing the required parameter 'userId' when calling patchUserIdPresencesSourceId");
}
// verify the required parameter 'sourceId' is set
if (sourceId == null) {
throw new ApiException(400, "Missing the required parameter 'sourceId' when calling patchUserIdPresencesSourceId");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling patchUserIdPresencesSourceId");
}
// create path and map variables
String pclocalVarPath = "/api/v2/users/{userId}/presences/{sourceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "userId" + "\\}", pcapiClient.escapeString(userId.toString()))
.replaceAll("\\{" + "sourceId" + "\\}", pcapiClient.escapeString(sourceId.toString()));
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "PATCH", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
/**
* Create a Presence Definition
*
* @param body The Presence Definition to create (required)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public OrganizationPresence postPresencedefinitions(OrganizationPresence body) throws ApiException {
return postPresencedefinitionsWithHttpInfo(body).getResponseObject();
}
/**
* Create a Presence Definition
*
* @param body The Presence Definition to create (required)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public ApiResponse postPresencedefinitionsWithHttpInfo(OrganizationPresence body) throws ApiException {
Object pclocalVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling postPresencedefinitions");
}
// create path and map variables
String pclocalVarPath = "/api/v2/presencedefinitions".replaceAll("\\{format\\}","json");
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "POST", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
/**
* Update a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @param body The OrganizationPresence to update (required)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public OrganizationPresence putPresenceId(String presenceId, OrganizationPresence body) throws ApiException {
return putPresenceIdWithHttpInfo(presenceId, body).getResponseObject();
}
/**
* Update a Presence Definition
*
* @param presenceId Organization Presence ID (required)
* @param body The OrganizationPresence to update (required)
* @return OrganizationPresence
* @throws ApiException if fails to make API call
*/
public ApiResponse putPresenceIdWithHttpInfo(String presenceId, OrganizationPresence body) throws ApiException {
Object pclocalVarPostBody = body;
// verify the required parameter 'presenceId' is set
if (presenceId == null) {
throw new ApiException(400, "Missing the required parameter 'presenceId' when calling putPresenceId");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling putPresenceId");
}
// create path and map variables
String pclocalVarPath = "/api/v2/presencedefinitions/{presenceId}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "presenceId" + "\\}", pcapiClient.escapeString(presenceId.toString()));
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
final String[] pclocalVarAccepts = {
"application/json"
};
final String pclocalVarAccept = pcapiClient.selectHeaderAccept(pclocalVarAccepts);
final String[] pclocalVarContentTypes = {
"application/json"
};
final String pclocalVarContentType = pcapiClient.selectHeaderContentType(pclocalVarContentTypes);
String[] pclocalVarAuthNames = new String[] { "PureCloud Auth" };
return pcapiClient.invokeAPIVerbose(pclocalVarPath, "PUT", pclocalVarQueryParams, pclocalVarPostBody, pclocalVarHeaderParams, pclocalVarFormParams, pclocalVarAccept, pclocalVarContentType, pclocalVarAuthNames, new TypeReference() {});
}
}