Java tutorial
/** * Coviu Session API * Coviu provides a session based API for creating and restricting access to coviu calls. The core concepts exposed are* Session: A coviu call that occurs between two or more parties at a specified time, and has a finite duration.* Participants: Users who may participate in a coviu call.Participants join a call by following a session link in their browser, or mobile app. The session link identifiesthe participant, including their name, optional avatar, and importantly their role. As such, it is important thateach person joining the call be issued a different session link, i.e. have a distinct participant created for them.A participant's role identifies whether that user may access the call directly, or if they are required the be let inby an existing participant. * * OpenAPI spec version: 1.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. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.coviu.sessions.api; import com.coviu.core.ApiCallback; import com.coviu.core.ApiClient; import com.coviu.core.ApiException; import com.coviu.core.ApiResponse; import com.coviu.core.Pair; import com.coviu.core.ProgressRequestBody; import com.coviu.core.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import com.coviu.sessions.model.Participant; import com.coviu.sessions.model.ParticipantCreationRequest; import com.coviu.sessions.model.SessionCreationRequest; import com.coviu.sessions.model.Session; import com.coviu.sessions.model.UnitResponse; import com.coviu.sessions.model.SessionPage; import org.joda.time.DateTime; import com.coviu.sessions.model.ParticipantPage; import com.coviu.sessions.model.SessionUpdateRequest; import com.coviu.sessions.model.ParticipantUpdateRequest; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class SessionApi { private ApiClient apiClient; public SessionApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /* Build call for addSessionParticipant */ private com.squareup.okhttp.Call addSessionParticipantCall(String sessionId, ParticipantCreationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/sessions/{session_id}/participants".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call addSessionParticipantValidateBeforeCall(String sessionId, ParticipantCreationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'sessionId' is set if (sessionId == null) { throw new ApiException( "Missing the required parameter 'sessionId' when calling addSessionParticipant(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling addSessionParticipant(Async)"); } com.squareup.okhttp.Call call = addSessionParticipantCall(sessionId, body, progressListener, progressRequestListener); return call; } /** * * It is sometimes useful to add a participant to a session after the session has been created. It is possible to add a participant to a session that has already start, but not to a session that has already finished. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @return Participant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Participant addSessionParticipant(String sessionId, ParticipantCreationRequest body) throws ApiException { ApiResponse<Participant> resp = addSessionParticipantWithHttpInfo(sessionId, body); return resp.getData(); } /** * * It is sometimes useful to add a participant to a session after the session has been created. It is possible to add a participant to a session that has already start, but not to a session that has already finished. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @return ApiResponse<Participant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Participant> addSessionParticipantWithHttpInfo(String sessionId, ParticipantCreationRequest body) throws ApiException { com.squareup.okhttp.Call call = addSessionParticipantValidateBeforeCall(sessionId, body, null, null); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * It is sometimes useful to add a participant to a session after the session has been created. It is possible to add a participant to a session that has already start, but not to a session that has already finished. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @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 addSessionParticipantAsync(String sessionId, ParticipantCreationRequest body, final ApiCallback<Participant> 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 = addSessionParticipantValidateBeforeCall(sessionId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for createSession */ private com.squareup.okhttp.Call createSessionCall(SessionCreationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/sessions".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call createSessionValidateBeforeCall(SessionCreationRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling createSession(Async)"); } com.squareup.okhttp.Call call = createSessionCall(body, progressListener, progressRequestListener); return call; } /** * * Create a new session. Note that the session start time must be in the future, and the session end time must be after the session start time. * @param body (required) * @return Session * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Session createSession(SessionCreationRequest body) throws ApiException { ApiResponse<Session> resp = createSessionWithHttpInfo(body); return resp.getData(); } /** * * Create a new session. Note that the session start time must be in the future, and the session end time must be after the session start time. * @param body (required) * @return ApiResponse<Session> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Session> createSessionWithHttpInfo(SessionCreationRequest body) throws ApiException { com.squareup.okhttp.Call call = createSessionValidateBeforeCall(body, null, null); Type localVarReturnType = new TypeToken<Session>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Create a new session. Note that the session start time must be in the future, and the session end time must be after the session start time. * @param body (required) * @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 createSessionAsync(SessionCreationRequest body, final ApiCallback<Session> 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 = createSessionValidateBeforeCall(body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Session>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for deleteSession */ private com.squareup.okhttp.Call deleteSessionCall(String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/sessions/{session_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call deleteSessionValidateBeforeCall(String sessionId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'sessionId' is set if (sessionId == null) { throw new ApiException("Missing the required parameter 'sessionId' when calling deleteSession(Async)"); } com.squareup.okhttp.Call call = deleteSessionCall(sessionId, progressListener, progressRequestListener); return call; } /** * * A session that is scheduled for the future may be canceled. No participants will be able to join the session after it has been canceled, and it can not be uncanceled once it has been canceled. A session that has already started may not be canceled. * @param sessionId The session id of the session that the operation applies to. (required) * @return UnitResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public UnitResponse deleteSession(String sessionId) throws ApiException { ApiResponse<UnitResponse> resp = deleteSessionWithHttpInfo(sessionId); return resp.getData(); } /** * * A session that is scheduled for the future may be canceled. No participants will be able to join the session after it has been canceled, and it can not be uncanceled once it has been canceled. A session that has already started may not be canceled. * @param sessionId The session id of the session that the operation applies to. (required) * @return ApiResponse<UnitResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<UnitResponse> deleteSessionWithHttpInfo(String sessionId) throws ApiException { com.squareup.okhttp.Call call = deleteSessionValidateBeforeCall(sessionId, null, null); Type localVarReturnType = new TypeToken<UnitResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * A session that is scheduled for the future may be canceled. No participants will be able to join the session after it has been canceled, and it can not be uncanceled once it has been canceled. A session that has already started may not be canceled. * @param sessionId The session id of the session that the operation applies to. (required) * @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 deleteSessionAsync(String sessionId, final ApiCallback<UnitResponse> 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 = deleteSessionValidateBeforeCall(sessionId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<UnitResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for deleteSessionParticipant */ private com.squareup.okhttp.Call deleteSessionParticipantCall(String participantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/participants/{participant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "participant_id" + "\\}", apiClient.escapeString(participantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call deleteSessionParticipantValidateBeforeCall(String participantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'participantId' is set if (participantId == null) { throw new ApiException( "Missing the required parameter 'participantId' when calling deleteSessionParticipant(Async)"); } com.squareup.okhttp.Call call = deleteSessionParticipantCall(participantId, progressListener, progressRequestListener); return call; } /** * * Cancel a session participant. The participant will no longer be able to enter the session. Once a participant has been canceled, it may not be uncanceled. A participant may not be canceled after a session has finished. * @param participantId The participant id of the participant that the operation applies to. (required) * @return UnitResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public UnitResponse deleteSessionParticipant(String participantId) throws ApiException { ApiResponse<UnitResponse> resp = deleteSessionParticipantWithHttpInfo(participantId); return resp.getData(); } /** * * Cancel a session participant. The participant will no longer be able to enter the session. Once a participant has been canceled, it may not be uncanceled. A participant may not be canceled after a session has finished. * @param participantId The participant id of the participant that the operation applies to. (required) * @return ApiResponse<UnitResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<UnitResponse> deleteSessionParticipantWithHttpInfo(String participantId) throws ApiException { com.squareup.okhttp.Call call = deleteSessionParticipantValidateBeforeCall(participantId, null, null); Type localVarReturnType = new TypeToken<UnitResponse>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Cancel a session participant. The participant will no longer be able to enter the session. Once a participant has been canceled, it may not be uncanceled. A participant may not be canceled after a session has finished. * @param participantId The participant id of the participant that the operation applies to. (required) * @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 deleteSessionParticipantAsync(String participantId, final ApiCallback<UnitResponse> 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 = deleteSessionParticipantValidateBeforeCall(participantId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<UnitResponse>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getSessionById */ private com.squareup.okhttp.Call getSessionByIdCall(String sessionId, Boolean deletedParticipants, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/sessions/{session_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (deletedParticipants != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "deleted_participants", deletedParticipants)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getSessionByIdValidateBeforeCall(String sessionId, Boolean deletedParticipants, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'sessionId' is set if (sessionId == null) { throw new ApiException("Missing the required parameter 'sessionId' when calling getSessionById(Async)"); } com.squareup.okhttp.Call call = getSessionByIdCall(sessionId, deletedParticipants, progressListener, progressRequestListener); return call; } /** * * Get a single session by id. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @return Session * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Session getSessionById(String sessionId, Boolean deletedParticipants) throws ApiException { ApiResponse<Session> resp = getSessionByIdWithHttpInfo(sessionId, deletedParticipants); return resp.getData(); } /** * * Get a single session by id. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @return ApiResponse<Session> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Session> getSessionByIdWithHttpInfo(String sessionId, Boolean deletedParticipants) throws ApiException { com.squareup.okhttp.Call call = getSessionByIdValidateBeforeCall(sessionId, deletedParticipants, null, null); Type localVarReturnType = new TypeToken<Session>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Get a single session by id. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (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 getSessionByIdAsync(String sessionId, Boolean deletedParticipants, final ApiCallback<Session> 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 = getSessionByIdValidateBeforeCall(sessionId, deletedParticipants, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Session>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getSessionPage */ private com.squareup.okhttp.Call getSessionPageCall(Integer page, Integer pageSize, DateTime startTime, DateTime endTime, Boolean includeCanceled, Boolean deletedParticipants, String state, String order, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/sessions".replaceAll("\\{format\\}", "json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (page != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page)); if (pageSize != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "page_size", pageSize)); if (startTime != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_time", startTime)); if (endTime != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime)); if (includeCanceled != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_canceled", includeCanceled)); if (deletedParticipants != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "deleted_participants", deletedParticipants)); if (state != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "state", state)); if (order != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getSessionPageValidateBeforeCall(Integer page, Integer pageSize, DateTime startTime, DateTime endTime, Boolean includeCanceled, Boolean deletedParticipants, String state, String order, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = getSessionPageCall(page, pageSize, startTime, endTime, includeCanceled, deletedParticipants, state, order, progressListener, progressRequestListener); return call; } /** * * Get a list of sessions. By default, the returned order is paginated with the first page containing the created sessions in chronological order (oldest created first). If you set the \"order\" parameter to \"reverse\", the newest created sessions will be returned. You can filter sessions by start and end time, at which stage the returned result list is ordered by start time in chronological order (rather than by creation time). The \"order\" parameter allows you to reverse this order to retrieve sessions by start time with the newest start time first. * @param page The page number to return (optional) * @param pageSize The number of sessions per page. Max 200. Default 200. (optional) * @param startTime Includes sessions that start at or after start_time. (optional) * @param endTime Include sessions that start upto and including end_time.. (optional) * @param includeCanceled Includes sessions that have been canceled. (optional) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @param state Return only sessions containing participants with the supplied state value. (optional) * @param order Order the results. forward returns oldest first by start time. backwards includes newest first by startime. (optional) * @return SessionPage * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public SessionPage getSessionPage(Integer page, Integer pageSize, DateTime startTime, DateTime endTime, Boolean includeCanceled, Boolean deletedParticipants, String state, String order) throws ApiException { ApiResponse<SessionPage> resp = getSessionPageWithHttpInfo(page, pageSize, startTime, endTime, includeCanceled, deletedParticipants, state, order); return resp.getData(); } /** * * Get a list of sessions. By default, the returned order is paginated with the first page containing the created sessions in chronological order (oldest created first). If you set the \"order\" parameter to \"reverse\", the newest created sessions will be returned. You can filter sessions by start and end time, at which stage the returned result list is ordered by start time in chronological order (rather than by creation time). The \"order\" parameter allows you to reverse this order to retrieve sessions by start time with the newest start time first. * @param page The page number to return (optional) * @param pageSize The number of sessions per page. Max 200. Default 200. (optional) * @param startTime Includes sessions that start at or after start_time. (optional) * @param endTime Include sessions that start upto and including end_time.. (optional) * @param includeCanceled Includes sessions that have been canceled. (optional) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @param state Return only sessions containing participants with the supplied state value. (optional) * @param order Order the results. forward returns oldest first by start time. backwards includes newest first by startime. (optional) * @return ApiResponse<SessionPage> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<SessionPage> getSessionPageWithHttpInfo(Integer page, Integer pageSize, DateTime startTime, DateTime endTime, Boolean includeCanceled, Boolean deletedParticipants, String state, String order) throws ApiException { com.squareup.okhttp.Call call = getSessionPageValidateBeforeCall(page, pageSize, startTime, endTime, includeCanceled, deletedParticipants, state, order, null, null); Type localVarReturnType = new TypeToken<SessionPage>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Get a list of sessions. By default, the returned order is paginated with the first page containing the created sessions in chronological order (oldest created first). If you set the \"order\" parameter to \"reverse\", the newest created sessions will be returned. You can filter sessions by start and end time, at which stage the returned result list is ordered by start time in chronological order (rather than by creation time). The \"order\" parameter allows you to reverse this order to retrieve sessions by start time with the newest start time first. * @param page The page number to return (optional) * @param pageSize The number of sessions per page. Max 200. Default 200. (optional) * @param startTime Includes sessions that start at or after start_time. (optional) * @param endTime Include sessions that start upto and including end_time.. (optional) * @param includeCanceled Includes sessions that have been canceled. (optional) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @param state Return only sessions containing participants with the supplied state value. (optional) * @param order Order the results. forward returns oldest first by start time. backwards includes newest first by startime. (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 getSessionPageAsync(Integer page, Integer pageSize, DateTime startTime, DateTime endTime, Boolean includeCanceled, Boolean deletedParticipants, String state, String order, final ApiCallback<SessionPage> 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 = getSessionPageValidateBeforeCall(page, pageSize, startTime, endTime, includeCanceled, deletedParticipants, state, order, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SessionPage>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getSessionParticipant */ private com.squareup.okhttp.Call getSessionParticipantCall(String participantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/participants/{participant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "participant_id" + "\\}", apiClient.escapeString(participantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getSessionParticipantValidateBeforeCall(String participantId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'participantId' is set if (participantId == null) { throw new ApiException( "Missing the required parameter 'participantId' when calling getSessionParticipant(Async)"); } com.squareup.okhttp.Call call = getSessionParticipantCall(participantId, progressListener, progressRequestListener); return call; } /** * * Get a single participant by its id. * @param participantId The participant id of the participant that the operation applies to. (required) * @return Participant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Participant getSessionParticipant(String participantId) throws ApiException { ApiResponse<Participant> resp = getSessionParticipantWithHttpInfo(participantId); return resp.getData(); } /** * * Get a single participant by its id. * @param participantId The participant id of the participant that the operation applies to. (required) * @return ApiResponse<Participant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Participant> getSessionParticipantWithHttpInfo(String participantId) throws ApiException { com.squareup.okhttp.Call call = getSessionParticipantValidateBeforeCall(participantId, null, null); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Get a single participant by its id. * @param participantId The participant id of the participant that the operation applies to. (required) * @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 getSessionParticipantAsync(String participantId, final ApiCallback<Participant> 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 = getSessionParticipantValidateBeforeCall(participantId, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for getSessionParticipants */ private com.squareup.okhttp.Call getSessionParticipantsCall(String sessionId, Boolean deletedParticipants, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/sessions/{session_id}/participants".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); if (deletedParticipants != null) localVarQueryParams.addAll(apiClient.parameterToPairs("", "deleted_participants", deletedParticipants)); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { }; 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call getSessionParticipantsValidateBeforeCall(String sessionId, Boolean deletedParticipants, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'sessionId' is set if (sessionId == null) { throw new ApiException( "Missing the required parameter 'sessionId' when calling getSessionParticipants(Async)"); } com.squareup.okhttp.Call call = getSessionParticipantsCall(sessionId, deletedParticipants, progressListener, progressRequestListener); return call; } /** * * Get the list of participants for a session. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @return ParticipantPage * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ParticipantPage getSessionParticipants(String sessionId, Boolean deletedParticipants) throws ApiException { ApiResponse<ParticipantPage> resp = getSessionParticipantsWithHttpInfo(sessionId, deletedParticipants); return resp.getData(); } /** * * Get the list of participants for a session. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (optional) * @return ApiResponse<ParticipantPage> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<ParticipantPage> getSessionParticipantsWithHttpInfo(String sessionId, Boolean deletedParticipants) throws ApiException { com.squareup.okhttp.Call call = getSessionParticipantsValidateBeforeCall(sessionId, deletedParticipants, null, null); Type localVarReturnType = new TypeToken<ParticipantPage>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * Get the list of participants for a session. * @param sessionId The session id of the session that the operation applies to. (required) * @param deletedParticipants Also include participants that have been removed from the session. (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 getSessionParticipantsAsync(String sessionId, Boolean deletedParticipants, final ApiCallback<ParticipantPage> 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 = getSessionParticipantsValidateBeforeCall(sessionId, deletedParticipants, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<ParticipantPage>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for updateSession */ private com.squareup.okhttp.Call updateSessionCall(String sessionId, SessionUpdateRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/sessions/{session_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "session_id" + "\\}", apiClient.escapeString(sessionId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call updateSessionValidateBeforeCall(String sessionId, SessionUpdateRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'sessionId' is set if (sessionId == null) { throw new ApiException("Missing the required parameter 'sessionId' when calling updateSession(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling updateSession(Async)"); } com.squareup.okhttp.Call call = updateSessionCall(sessionId, body, progressListener, progressRequestListener); return call; } /** * * It is possible to update some attributes of a session, namely the start and end time, session name and image. A session that has already finished may not be changed. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @return Session * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Session updateSession(String sessionId, SessionUpdateRequest body) throws ApiException { ApiResponse<Session> resp = updateSessionWithHttpInfo(sessionId, body); return resp.getData(); } /** * * It is possible to update some attributes of a session, namely the start and end time, session name and image. A session that has already finished may not be changed. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @return ApiResponse<Session> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Session> updateSessionWithHttpInfo(String sessionId, SessionUpdateRequest body) throws ApiException { com.squareup.okhttp.Call call = updateSessionValidateBeforeCall(sessionId, body, null, null); Type localVarReturnType = new TypeToken<Session>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * It is possible to update some attributes of a session, namely the start and end time, session name and image. A session that has already finished may not be changed. * @param sessionId The session id of the session that the operation applies to. (required) * @param body (required) * @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 updateSessionAsync(String sessionId, SessionUpdateRequest body, final ApiCallback<Session> 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 = updateSessionValidateBeforeCall(sessionId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Session>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } /* Build call for updateSessionParticipant */ private com.squareup.okhttp.Call updateSessionParticipantCall(String participantId, ParticipantUpdateRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/participants/{participant_id}".replaceAll("\\{format\\}", "json") .replaceAll("\\{" + "participant_id" + "\\}", apiClient.escapeString(participantId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); 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[] { "oauth2" }; return apiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } @SuppressWarnings("rawtypes") private com.squareup.okhttp.Call updateSessionParticipantValidateBeforeCall(String participantId, ParticipantUpdateRequest body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'participantId' is set if (participantId == null) { throw new ApiException( "Missing the required parameter 'participantId' when calling updateSessionParticipant(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException( "Missing the required parameter 'body' when calling updateSessionParticipant(Async)"); } com.squareup.okhttp.Call call = updateSessionParticipantCall(participantId, body, progressListener, progressRequestListener); return call; } /** * * It is possible to update a participant's name, role, picture, and state after it has been created. * @param participantId The participant id of the participant that the operation applies to. (required) * @param body (required) * @return Participant * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public Participant updateSessionParticipant(String participantId, ParticipantUpdateRequest body) throws ApiException { ApiResponse<Participant> resp = updateSessionParticipantWithHttpInfo(participantId, body); return resp.getData(); } /** * * It is possible to update a participant's name, role, picture, and state after it has been created. * @param participantId The participant id of the participant that the operation applies to. (required) * @param body (required) * @return ApiResponse<Participant> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public ApiResponse<Participant> updateSessionParticipantWithHttpInfo(String participantId, ParticipantUpdateRequest body) throws ApiException { com.squareup.okhttp.Call call = updateSessionParticipantValidateBeforeCall(participantId, body, null, null); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); return apiClient.execute(call, localVarReturnType); } /** * (asynchronously) * It is possible to update a participant's name, role, picture, and state after it has been created. * @param participantId The participant id of the participant that the operation applies to. (required) * @param body (required) * @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 updateSessionParticipantAsync(String participantId, ParticipantUpdateRequest body, final ApiCallback<Participant> 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 = updateSessionParticipantValidateBeforeCall(participantId, body, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<Participant>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; } }