@@ -89,11 +89,17 @@ public function getAuthorization(){
8989
9090 /**
9191 * @param $fileKey
92+ * @param null $language 1:English, 2:Chinese
9293 * @return mixed
9394 * @throws CPDFException
9495 */
95- public function getFileInfoByKey ($ fileKey ){
96- return $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_FILE_INFO , $ this ->getAuthorization (), ['fileKey ' =>$ fileKey ]);
96+ public function getFileInfoByKey ($ fileKey , $ language = null ){
97+ $ options = ['fileKey ' =>$ fileKey ];
98+ if ($ language ){
99+ $ options ['language ' ] = $ language ;
100+ }
101+
102+ return $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_FILE_INFO , $ this ->getAuthorization (), $ options );
97103 }
98104
99105 /**
@@ -118,13 +124,20 @@ public function getTaskList($page, $size){
118124
119125 /**
120126 * @param $executeType
127+ * @param int $language 1:English, 2:Chinese
121128 * @return CPDFClient
122129 * @throws CPDFException
123130 */
124- public function createTask ($ executeType ){
131+ public function createTask ($ executeType, $ language = null ){
125132 $ url = str_replace ('{executeTypeUrl} ' , $ executeType , CPDFURL ::API_V1_CREATE_TASK );
126133
127- $ result = $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , $ url , $ this ->getAuthorization ());
134+ $ options = [];
135+
136+ if ($ language ){
137+ $ options ['language ' ] = $ language ;
138+ }
139+
140+ $ result = $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , $ url , $ this ->getAuthorization (), $ options );
128141 $ taskId = $ result ['taskId ' ];
129142
130143 $ this ->taskResource = new CPDFTaskResource ($ taskId );
@@ -148,10 +161,11 @@ public function addFile($filepath){
148161 * @param $filePath
149162 * @param null $password
150163 * @param array $params
164+ * @param int $language
151165 * @return mixed
152166 * @throws CPDFException
153167 */
154- public function uploadFile ($ taskId , $ filePath , $ password = null , $ params = []){
168+ public function uploadFile ($ taskId , $ filePath , $ password = null , $ params = [], $ language = null ){
155169 if (!file_exists ($ filePath )){
156170 throw new CPDFException ('uploadFile ' , 'File does not exist. ' );
157171 }
@@ -193,25 +207,43 @@ public function uploadFile($taskId, $filePath, $password = null, $params = []){
193207 $ options ['multipart ' ][] = ['name ' => 'parameter ' , 'contents ' => json_encode ($ params )];
194208 }
195209
210+ if ($ language ){
211+ $ options ['multipart ' ][] = ['name ' => 'language ' , 'contents ' => $ language ];
212+ }
213+
196214 return $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_POST , CPDFURL ::API_V1_UPLOAD_FILE , $ this ->getAuthorization (), $ options );
197215 }
198216
199217 /**
200218 * @param $taskId
219+ * @param null $language 1:English, 2:Chinese
201220 * @return CPDFClient
202221 * @throws CPDFException
203222 */
204- public function executeTask ($ taskId ){
205- $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_EXECUTE_TASK , $ this ->getAuthorization (), ['taskId ' =>$ taskId ]);
223+ public function executeTask ($ taskId , $ language = null ){
224+ $ options = ['taskId ' => $ taskId ];
225+
226+ if ($ language ){
227+ $ options ['language ' ] = $ language ;
228+ }
229+
230+ $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_EXECUTE_TASK , $ this ->getAuthorization (), $ options );
206231 return $ this ;
207232 }
208233
209234 /**
210235 * @param $taskId
236+ * @param null $language 1:English, 2:Chinese
211237 * @return mixed
212238 * @throws CPDFException
213239 */
214- public function getTaskInfo ($ taskId ){
215- return $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_TASK_INFO , $ this ->getAuthorization (), ['taskId ' =>$ taskId ]);
240+ public function getTaskInfo ($ taskId , $ language = null ){
241+ $ options = ['taskId ' => $ taskId ];
242+
243+ if ($ language ){
244+ $ options ['language ' ] = $ language ;
245+ }
246+
247+ return $ this ->httpClient ->send (CPDFURL ::HTTP_METHOD_GET , CPDFURL ::API_V1_TASK_INFO , $ this ->getAuthorization (), $ options );
216248 }
217249}
0 commit comments