The JavaScript implementation of createPurchase in Client.js accepts a second options argument (passed through to _makeRequest → _getRequestOptions) that supports custom headers:
async createPurchase (body, options = {}) { let path = '/purchases' path = this._interpolatePath(path) return this._makeRequest('POST', path, body, options) }
However, the TypeScript declaration only exposes one parameter:
createPurchase(body: PurchaseCreate): Promise<InvoiceCollection>;
This matters in practice when adding an Idempotency-Key header to requests. The only way to pass this is via options.headers, but TypeScript users have no type-safe way to do so.
For reference, the Go SDK exposes this via a first-class WithIdempotencyKey option.
Suggested fix:
createPurchase(body: PurchaseCreate, options?: { headers?: Record<string, string> }): Promise<InvoiceCollection>;
The JavaScript implementation of createPurchase in Client.js accepts a second options argument (passed through to _makeRequest → _getRequestOptions) that supports custom headers:
async createPurchase (body, options = {}) { let path = '/purchases' path = this._interpolatePath(path) return this._makeRequest('POST', path, body, options) }However, the TypeScript declaration only exposes one parameter:
createPurchase(body: PurchaseCreate): Promise<InvoiceCollection>;This matters in practice when adding an Idempotency-Key header to requests. The only way to pass this is via options.headers, but TypeScript users have no type-safe way to do so.
For reference, the Go SDK exposes this via a first-class WithIdempotencyKey option.
Suggested fix:
createPurchase(body: PurchaseCreate, options?: { headers?: Record<string, string> }): Promise<InvoiceCollection>;