com.mypurecloud.sdk.api.UtilitiesApi 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.ServerDate;
import com.mypurecloud.sdk.model.ErrorBody;
import com.mypurecloud.sdk.model.TimeZoneEntityListing;
import com.mypurecloud.sdk.model.ParsedCertificate;
import com.mypurecloud.sdk.model.Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UtilitiesApi {
private ApiClient pcapiClient;
public UtilitiesApi() {
this(Configuration.getDefaultApiClient());
}
public UtilitiesApi(ApiClient apiClient) {
this.pcapiClient = apiClient;
}
public ApiClient getApiClient() {
return pcapiClient;
}
public void setApiClient(ApiClient apiClient) {
this.pcapiClient = apiClient;
}
/**
* Get the current system date/time
*
* @return ServerDate
* @throws ApiException if fails to make API call
*/
public ServerDate getDate() throws ApiException {
return getDateWithHttpInfo().getResponseObject();
}
/**
* Get the current system date/time
*
* @return ServerDate
* @throws ApiException if fails to make API call
*/
public ApiResponse getDateWithHttpInfo() throws ApiException {
Object pclocalVarPostBody = null;
// create path and map variables
String pclocalVarPath = "/api/v2/date".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 time zones list
*
* @param pageSize Page size (optional, default to 25)
* @param pageNumber Page number (optional, default to 1)
* @return TimeZoneEntityListing
* @throws ApiException if fails to make API call
*/
public TimeZoneEntityListing getTimezones(Integer pageSize, Integer pageNumber) throws ApiException {
return getTimezonesWithHttpInfo(pageSize, pageNumber).getResponseObject();
}
/**
* Get time zones list
*
* @param pageSize Page size (optional, default to 25)
* @param pageNumber Page number (optional, default to 1)
* @return TimeZoneEntityListing
* @throws ApiException if fails to make API call
*/
public ApiResponse getTimezonesWithHttpInfo(Integer pageSize, Integer pageNumber) throws ApiException {
Object pclocalVarPostBody = null;
// create path and map variables
String pclocalVarPath = "/api/v2/timezones".replaceAll("\\{format\\}","json");
// query params
List pclocalVarQueryParams = new ArrayList();
Map pclocalVarHeaderParams = new HashMap();
Map pclocalVarFormParams = new HashMap();
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageSize", pageSize));
pclocalVarQueryParams.addAll(pcapiClient.parameterToPairs("", "pageNumber", pageNumber));
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() {});
}
/**
* Returns the information about an X509 PEM encoded certificate or certificate chain.
*
* @param body Certificate (required)
* @return ParsedCertificate
* @throws ApiException if fails to make API call
*/
public ParsedCertificate postDetails(Certificate body) throws ApiException {
return postDetailsWithHttpInfo(body).getResponseObject();
}
/**
* Returns the information about an X509 PEM encoded certificate or certificate chain.
*
* @param body Certificate (required)
* @return ParsedCertificate
* @throws ApiException if fails to make API call
*/
public ApiResponse postDetailsWithHttpInfo(Certificate 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 postDetails");
}
// create path and map variables
String pclocalVarPath = "/api/v2/certificate/details".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() {});
}
}