11// This file was auto-generated by Fern from our API Definition.
22
33import type { BaseClientOptions , BaseRequestOptions } from "../../../../BaseClient" ;
4- import { normalizeClientOptions } from "../../../../BaseClient" ;
4+ import { type NormalizedClientOptionsWithAuth , normalizeClientOptionsWithAuth } from "../../../../BaseClient" ;
55import * as core from "../../../../core" ;
66import { mergeHeaders , mergeOnlyDefinedHeaders } from "../../../../core/headers" ;
77import * as environments from "../../../../environments" ;
@@ -16,10 +16,10 @@ export declare namespace BankAccountsClient {
1616}
1717
1818export class BankAccountsClient {
19- protected readonly _options : BankAccountsClient . Options ;
19+ protected readonly _options : NormalizedClientOptionsWithAuth < BankAccountsClient . Options > ;
2020
2121 constructor ( options : BankAccountsClient . Options = { } ) {
22- this . _options = normalizeClientOptions ( options ) ;
22+ this . _options = normalizeClientOptionsWithAuth ( options ) ;
2323 }
2424
2525 /**
@@ -54,12 +54,11 @@ export class BankAccountsClient {
5454 if ( locationId !== undefined ) {
5555 _queryParams . location_id = locationId ;
5656 }
57+ const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
5758 const _headers : core . Fetcher . Args [ "headers" ] = mergeHeaders (
59+ _authRequest . headers ,
5860 this . _options ?. headers ,
59- mergeOnlyDefinedHeaders ( {
60- Authorization : await this . _getAuthorizationHeader ( ) ,
61- "Square-Version" : requestOptions ?. version ?? "2025-10-16" ,
62- } ) ,
61+ mergeOnlyDefinedHeaders ( { "Square-Version" : requestOptions ?. version ?? "2025-10-16" } ) ,
6362 requestOptions ?. headers ,
6463 ) ;
6564 const _response = await ( this . _options . fetcher ?? core . fetcher ) ( {
@@ -150,12 +149,11 @@ export class BankAccountsClient {
150149 requestOptions ?: BankAccountsClient . RequestOptions ,
151150 ) : Promise < core . WithRawResponse < Square . GetBankAccountByV1IdResponse > > {
152151 const { v1BankAccountId } = request ;
152+ const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
153153 const _headers : core . Fetcher . Args [ "headers" ] = mergeHeaders (
154+ _authRequest . headers ,
154155 this . _options ?. headers ,
155- mergeOnlyDefinedHeaders ( {
156- Authorization : await this . _getAuthorizationHeader ( ) ,
157- "Square-Version" : requestOptions ?. version ?? "2025-10-16" ,
158- } ) ,
156+ mergeOnlyDefinedHeaders ( { "Square-Version" : requestOptions ?. version ?? "2025-10-16" } ) ,
159157 requestOptions ?. headers ,
160158 ) ;
161159 const _response = await ( this . _options . fetcher ?? core . fetcher ) ( {
@@ -238,12 +236,11 @@ export class BankAccountsClient {
238236 requestOptions ?: BankAccountsClient . RequestOptions ,
239237 ) : Promise < core . WithRawResponse < Square . GetBankAccountResponse > > {
240238 const { bankAccountId } = request ;
239+ const _authRequest : core . AuthRequest = await this . _options . authProvider . getAuthRequest ( ) ;
241240 const _headers : core . Fetcher . Args [ "headers" ] = mergeHeaders (
241+ _authRequest . headers ,
242242 this . _options ?. headers ,
243- mergeOnlyDefinedHeaders ( {
244- Authorization : await this . _getAuthorizationHeader ( ) ,
245- "Square-Version" : requestOptions ?. version ?? "2025-10-16" ,
246- } ) ,
243+ mergeOnlyDefinedHeaders ( { "Square-Version" : requestOptions ?. version ?? "2025-10-16" } ) ,
247244 requestOptions ?. headers ,
248245 ) ;
249246 const _response = await ( this . _options . fetcher ?? core . fetcher ) ( {
@@ -301,13 +298,4 @@ export class BankAccountsClient {
301298 } ) ;
302299 }
303300 }
304-
305- protected async _getAuthorizationHeader ( ) : Promise < string | undefined > {
306- const bearer = ( await core . Supplier . get ( this . _options . token ) ) ?? process ?. env . SQUARE_TOKEN ;
307- if ( bearer != null ) {
308- return `Bearer ${ bearer } ` ;
309- }
310-
311- return undefined ;
312- }
313301}
0 commit comments