@@ -78,6 +78,141 @@ public void setApiClient(ApiClient apiClient) {
7878 this .apiClient = apiClient ;
7979 }
8080
81+ /**
82+ * Build call for convertAndDownload
83+ * @param request The request model
84+ * @param progressListener Progress listener
85+ * @param progressRequestListener Progress request listener
86+ * @return Call to execute
87+ * @throws ApiException If fail to serialize the request body object
88+ */
89+ public com .squareup .okhttp .Call convertAndDownloadCall (ConvertAndDownloadRequest request , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
90+ Object localVarPostBody = null ;
91+
92+ // create path and map variables
93+ String localVarPath = "/viewer/convertAndDownload" ;
94+
95+ List <Pair > localVarQueryParams = new ArrayList <Pair >();
96+ List <Pair > localVarCollectionQueryParams = new ArrayList <Pair >();
97+ if (request .getformat () != null )
98+ localVarQueryParams .addAll (apiClient .parameterToPair ("format" , request .getformat ()));
99+ if (request .getpages () != null )
100+ localVarQueryParams .addAll (apiClient .parameterToPair ("pages" , request .getpages ()));
101+ if (request .getpassword () != null )
102+ localVarQueryParams .addAll (apiClient .parameterToPair ("password" , request .getpassword ()));
103+
104+ Map <String , String > localVarHeaderParams = new HashMap <String , String >();
105+
106+ Map <String , Object > localVarFormParams = new HashMap <String , Object >();
107+ if (request .getFile () != null )
108+ localVarFormParams .put ("File" , request .getFile ());
109+
110+ final String [] localVarAccepts = {
111+ "application/json"
112+ };
113+ final String localVarAccept = apiClient .selectHeaderAccept (localVarAccepts );
114+ if (localVarAccept != null ) localVarHeaderParams .put ("Accept" , localVarAccept );
115+
116+ final String [] localVarContentTypes = {
117+ "multipart/form-data"
118+ };
119+ final String localVarContentType = apiClient .selectHeaderContentType (localVarContentTypes );
120+ localVarHeaderParams .put ("Content-Type" , localVarContentType );
121+
122+ if (progressListener != null ) {
123+ apiClient .getHttpClient ().networkInterceptors ().add (new com .squareup .okhttp .Interceptor () {
124+ @ Override
125+ public com .squareup .okhttp .Response intercept (com .squareup .okhttp .Interceptor .Chain chain ) throws IOException {
126+ com .squareup .okhttp .Response originalResponse = chain .proceed (chain .request ());
127+ return originalResponse .newBuilder ()
128+ .body (new ProgressResponseBody (originalResponse .body (), progressListener ))
129+ .build ();
130+ }
131+ });
132+ }
133+
134+ String [] localVarAuthNames = new String [] { "JWT" };
135+ return apiClient .buildCall (localVarPath , "PUT" , localVarQueryParams , localVarCollectionQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAuthNames , progressRequestListener );
136+ }
137+
138+ @ SuppressWarnings ("rawtypes" )
139+ private com .squareup .okhttp .Call convertAndDownloadValidateBeforeCall (ConvertAndDownloadRequest request , final ProgressResponseBody .ProgressListener progressListener , final ProgressRequestBody .ProgressRequestListener progressRequestListener ) throws ApiException {
140+
141+ // verify the required parameter 'format' is set
142+ if (request .getformat () == null ) {
143+ throw new ApiException ("Missing the required parameter 'format' when calling convertAndDownload(Async)" );
144+ }
145+
146+ // verify the required parameter 'file' is set
147+ if (request .getFile () == null ) {
148+ throw new ApiException ("Missing the required parameter 'file' when calling convertAndDownload(Async)" );
149+ }
150+
151+
152+ com .squareup .okhttp .Call call = convertAndDownloadCall (request , progressListener , progressRequestListener );
153+ return call ;
154+
155+ }
156+
157+ /**
158+ * Converts input document file to format specified
159+ *
160+ * @param request The request model
161+ * @return File
162+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
163+ */
164+ public File convertAndDownload (ConvertAndDownloadRequest request ) throws ApiException {
165+ ApiResponse <File > resp = convertAndDownloadWithHttpInfo (request );
166+ return resp .getData ();
167+ }
168+
169+ /**
170+ * Converts input document file to format specified
171+ *
172+ * @param request The request model
173+ * @return ApiResponse<File>
174+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
175+ */
176+ public ApiResponse <File > convertAndDownloadWithHttpInfo (ConvertAndDownloadRequest request ) throws ApiException {
177+ com .squareup .okhttp .Call call = convertAndDownloadValidateBeforeCall (request , null , null );
178+ Type localVarReturnType = new TypeToken <File >(){}.getType ();
179+ return apiClient .execute (call , localVarReturnType );
180+ }
181+
182+ /**
183+ * Converts input document file to format specified (asynchronously)
184+ *
185+ * @param request The request model
186+ * @param callback The callback to be executed when the API call finishes
187+ * @return The request call
188+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
189+ */
190+ public com .squareup .okhttp .Call convertAndDownloadAsync (ConvertAndDownloadRequest request , final ApiCallback <File > callback ) throws ApiException {
191+
192+ ProgressResponseBody .ProgressListener progressListener = null ;
193+ ProgressRequestBody .ProgressRequestListener progressRequestListener = null ;
194+
195+ if (callback != null ) {
196+ progressListener = new ProgressResponseBody .ProgressListener () {
197+ @ Override
198+ public void update (long bytesRead , long contentLength , boolean done ) {
199+ callback .onDownloadProgress (bytesRead , contentLength , done );
200+ }
201+ };
202+
203+ progressRequestListener = new ProgressRequestBody .ProgressRequestListener () {
204+ @ Override
205+ public void onRequestProgress (long bytesWritten , long contentLength , boolean done ) {
206+ callback .onUploadProgress (bytesWritten , contentLength , done );
207+ }
208+ };
209+ }
210+
211+ com .squareup .okhttp .Call call = convertAndDownloadValidateBeforeCall (request , progressListener , progressRequestListener );
212+ Type localVarReturnType = new TypeToken <File >(){}.getType ();
213+ apiClient .executeAsync (call , localVarReturnType , callback );
214+ return call ;
215+ }
81216 /**
82217 * Build call for createView
83218 * @param request The request model
0 commit comments