com.genesys.internal.workspace.api.GroupsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of workspace Show documentation
Show all versions of workspace Show documentation
A Java library to interface to Genesys Workspace public API
/*
* Workspace API
* Agent API
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.genesys.internal.workspace.api;
import com.genesys.internal.common.ApiCallback;
import com.genesys.internal.common.ApiClient;
import com.genesys.internal.common.ApiException;
import com.genesys.internal.common.ApiResponse;
import com.genesys.internal.common.Configuration;
import com.genesys.internal.common.Pair;
import com.genesys.internal.common.ProgressRequestBody;
import com.genesys.internal.common.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import com.genesys.internal.workspace.model.ApiErrorResponse;
import com.genesys.internal.workspace.model.ApiSuccessResponse;
import java.math.BigDecimal;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GroupsApi {
private ApiClient apiClient;
public GroupsApi() {
this(Configuration.getDefaultApiClient());
}
public GroupsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for getGroupUsers
* @param groupId The id of the group to get users for (required)
* @param searchTerm The text to search for (optional)
* @param sort Desired sort order (asc or desc). asc if not specified (optional)
* @param limit Number of results. 100 if not specified. (optional)
* @param offset Offset of page to start from. 0 if not specified. (optional)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call getGroupUsersCall(BigDecimal groupId, String searchTerm, String sort, BigDecimal limit, BigDecimal offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/groups/{groupId}/users"
.replaceAll("\\{" + "groupId" + "\\}", apiClient.escapeString(groupId.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
if (searchTerm != null)
localVarQueryParams.addAll(apiClient.parameterToPair("searchTerm", searchTerm));
if (sort != null)
localVarQueryParams.addAll(apiClient.parameterToPair("sort", sort));
if (limit != null)
localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));
if (offset != null)
localVarQueryParams.addAll(apiClient.parameterToPair("offset", offset));
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getGroupUsersValidateBeforeCall(BigDecimal groupId, String searchTerm, String sort, BigDecimal limit, BigDecimal offset, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'groupId' is set
if (groupId == null) {
throw new ApiException("Missing the required parameter 'groupId' when calling getGroupUsers(Async)");
}
com.squareup.okhttp.Call call = getGroupUsersCall(groupId, searchTerm, sort, limit, offset, progressListener, progressRequestListener);
return call;
}
/**
* Search for users by specific group ID
*
* @param groupId The id of the group to get users for (required)
* @param searchTerm The text to search for (optional)
* @param sort Desired sort order (asc or desc). asc if not specified (optional)
* @param limit Number of results. 100 if not specified. (optional)
* @param offset Offset of page to start from. 0 if not specified. (optional)
* @return ApiSuccessResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiSuccessResponse getGroupUsers(BigDecimal groupId, String searchTerm, String sort, BigDecimal limit, BigDecimal offset) throws ApiException {
ApiResponse resp = getGroupUsersWithHttpInfo(groupId, searchTerm, sort, limit, offset);
return resp.getData();
}
/**
* Search for users by specific group ID
*
* @param groupId The id of the group to get users for (required)
* @param searchTerm The text to search for (optional)
* @param sort Desired sort order (asc or desc). asc if not specified (optional)
* @param limit Number of results. 100 if not specified. (optional)
* @param offset Offset of page to start from. 0 if not specified. (optional)
* @return ApiResponse<ApiSuccessResponse>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse getGroupUsersWithHttpInfo(BigDecimal groupId, String searchTerm, String sort, BigDecimal limit, BigDecimal offset) throws ApiException {
com.squareup.okhttp.Call call = getGroupUsersValidateBeforeCall(groupId, searchTerm, sort, limit, offset, null, null);
Type localVarReturnType = new TypeToken(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* Search for users by specific group ID (asynchronously)
*
* @param groupId The id of the group to get users for (required)
* @param searchTerm The text to search for (optional)
* @param sort Desired sort order (asc or desc). asc if not specified (optional)
* @param limit Number of results. 100 if not specified. (optional)
* @param offset Offset of page to start from. 0 if not specified. (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getGroupUsersAsync(BigDecimal groupId, String searchTerm, String sort, BigDecimal limit, BigDecimal offset, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getGroupUsersValidateBeforeCall(groupId, searchTerm, sort, limit, offset, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy