@@ -230,7 +230,7 @@ export abstract class APIClient {
230
230
/**
231
231
* Override this to add your own headers validation:
232
232
*/
233
- protected validateHeaders ( headers : Headers , customHeaders : Headers ) { }
233
+ protected validateHeaders ( headers : Headers , customHeaders : Headers ) { }
234
234
235
235
protected defaultIdempotencyKey ( ) : string {
236
236
return `stainless-node-retry-${ uuid4 ( ) } ` ;
@@ -265,10 +265,10 @@ export abstract class APIClient {
265
265
Promise . resolve ( opts ) . then ( async ( opts ) => {
266
266
const body =
267
267
opts && isBlobLike ( opts ?. body ) ? new DataView ( await opts . body . arrayBuffer ( ) )
268
- : opts ?. body instanceof DataView ? opts . body
269
- : opts ?. body instanceof ArrayBuffer ? new DataView ( opts . body )
270
- : opts && ArrayBuffer . isView ( opts ?. body ) ? new DataView ( opts . body . buffer )
271
- : opts ?. body ;
268
+ : opts ?. body instanceof DataView ? opts . body
269
+ : opts ?. body instanceof ArrayBuffer ? new DataView ( opts . body )
270
+ : opts && ArrayBuffer . isView ( opts ?. body ) ? new DataView ( opts . body . buffer )
271
+ : opts ?. body ;
272
272
return { method, path, ...opts , body } ;
273
273
} ) ,
274
274
) ;
@@ -310,9 +310,9 @@ export abstract class APIClient {
310
310
const body =
311
311
ArrayBuffer . isView ( options . body ) || ( options . __binaryRequest && typeof options . body === 'string' ) ?
312
312
options . body
313
- : isMultipartBody ( options . body ) ? options . body . body
314
- : options . body ? JSON . stringify ( options . body , null , 2 )
315
- : null ;
313
+ : isMultipartBody ( options . body ) ? options . body . body
314
+ : options . body ? JSON . stringify ( options . body , null , 2 )
315
+ : null ;
316
316
const contentLength = this . calculateContentLength ( body ) ;
317
317
318
318
const url = this . buildURL ( path ! , query ) ;
@@ -401,7 +401,7 @@ export abstract class APIClient {
401
401
/**
402
402
* Used as a callback for mutating the given `FinalRequestOptions` object.
403
403
*/
404
- protected async prepareOptions ( options : FinalRequestOptions ) : Promise < void > { }
404
+ protected async prepareOptions ( options : FinalRequestOptions ) : Promise < void > { }
405
405
406
406
/**
407
407
* Used as a callback for mutating the given `RequestInit` object.
@@ -412,14 +412,14 @@ export abstract class APIClient {
412
412
protected async prepareRequest (
413
413
request : RequestInit ,
414
414
{ url, options } : { url : string ; options : FinalRequestOptions } ,
415
- ) : Promise < void > { }
415
+ ) : Promise < void > { }
416
416
417
417
protected parseHeaders ( headers : HeadersInit | null | undefined ) : Record < string , string > {
418
418
return (
419
419
! headers ? { }
420
- : Symbol . iterator in headers ?
421
- Object . fromEntries ( Array . from ( headers as Iterable < string [ ] > ) . map ( ( header ) => [ ...header ] ) )
422
- : { ...( headers as any as Record < string , string > ) }
420
+ : Symbol . iterator in headers ?
421
+ Object . fromEntries ( Array . from ( headers as Iterable < string [ ] > ) . map ( ( header ) => [ ...header ] ) )
422
+ : { ...( headers as any as Record < string , string > ) }
423
423
) ;
424
424
}
425
425
@@ -512,7 +512,7 @@ export abstract class APIClient {
512
512
const url =
513
513
isAbsoluteURL ( path ) ?
514
514
new URL ( path )
515
- : new URL ( this . baseURL + ( this . baseURL . endsWith ( '/' ) && path . startsWith ( '/' ) ? path . slice ( 1 ) : path ) ) ;
515
+ : new URL ( this . baseURL + ( this . baseURL . endsWith ( '/' ) && path . startsWith ( '/' ) ? path . slice ( 1 ) : path ) ) ;
516
516
517
517
const defaultQuery = this . defaultQuery ( ) ;
518
518
if ( ! isEmptyObj ( defaultQuery ) ) {
@@ -737,9 +737,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
737
737
* }
738
738
*/
739
739
export class PagePromise <
740
- PageClass extends AbstractPage < Item > ,
741
- Item = ReturnType < PageClass [ 'getPaginatedItems' ] > [ number ] ,
742
- >
740
+ PageClass extends AbstractPage < Item > ,
741
+ Item = ReturnType < PageClass [ 'getPaginatedItems' ] > [ number ] ,
742
+ >
743
743
extends APIPromise < PageClass >
744
744
implements AsyncIterable < Item >
745
745
{
@@ -1039,7 +1039,7 @@ export const castToError = (err: any): Error => {
1039
1039
if ( typeof err === 'object' && err !== null ) {
1040
1040
try {
1041
1041
return new Error ( JSON . stringify ( err ) ) ;
1042
- } catch { }
1042
+ } catch { }
1043
1043
}
1044
1044
return new Error ( err ) ;
1045
1045
} ;
0 commit comments