File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ export declare class SensibleSDK {
6
6
extract ( params : ExtractParams ) : Promise < ExtractionRequest > ;
7
7
classify ( params : ClassificationParams ) : Promise < ClassificationRequest > ;
8
8
waitFor ( request : ClassificationRequest | ExtractionRequest ) : Promise < ExtractionResult | ClassificationResult > ;
9
+ generateExcel ( requests : ExtractionRequest | ExtractionRequest [ ] ) : Promise < {
10
+ url : string ;
11
+ } > ;
9
12
}
10
13
type FileDefinition = {
11
14
file : Buffer ;
Original file line number Diff line number Diff line change @@ -205,6 +205,36 @@ var SensibleSDK = /** @class */ (function () {
205
205
} ) ;
206
206
} ) ;
207
207
} ;
208
+ // requested extractions must be completed
209
+ SensibleSDK . prototype . generateExcel = function ( requests ) {
210
+ return __awaiter ( this , void 0 , void 0 , function ( ) {
211
+ var extractions , url , e_5 ;
212
+ return __generator ( this , function ( _a ) {
213
+ switch ( _a . label ) {
214
+ case 0 :
215
+ extractions = Array . isArray ( requests ) ? requests : [ requests ] ;
216
+ url = baseUrl +
217
+ "/generate_excel/" +
218
+ extractions . map ( function ( extraction ) { return extraction . id ; } ) . join ( "," ) ;
219
+ _a . label = 1 ;
220
+ case 1 :
221
+ _a . trys . push ( [ 1 , 3 , , 4 ] ) ;
222
+ return [ 4 /*yield*/ , got_1 . default
223
+ . get ( url , {
224
+ headers : { authorization : "Bearer " . concat ( this . apiKey ) } ,
225
+ } )
226
+ . json ( ) ] ;
227
+ case 2 : return [ 2 /*return*/ , _a . sent ( ) ] ;
228
+ case 3 :
229
+ e_5 = _a . sent ( ) ;
230
+ throwError ( e_5 ) ;
231
+ // HACK: keep TS happy
232
+ throw null ;
233
+ case 4 : return [ 2 /*return*/ ] ;
234
+ }
235
+ } ) ;
236
+ } ) ;
237
+ } ;
208
238
return SensibleSDK ;
209
239
} ( ) ) ;
210
240
exports . SensibleSDK = SensibleSDK ;
You can’t perform that action at this time.
0 commit comments