Skip to content

Commit addab41

Browse files
feat(api): finish renaming of HTTPBearer to apiKey (#41)
1 parent f91d0c6 commit addab41

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 5
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/grid%2Fspreadsheet-api-f9fd5fb43d56001ea7d7f49e92bd55134347b198b2664fd76321cc02a75817c9.yml
33
openapi_spec_hash: 5130b5ebb7cbfe7a906716c5cf21764b
4-
config_hash: f5d6b47b28c650e373afc0eb0396899e
4+
config_hash: 3e61a9566953ce5dbd4bcea7ceb568a3

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ You can use the `maxRetries` option to configure or disable this:
138138
// Configure the default for all requests:
139139
const client = new Grid({
140140
maxRetries: 0, // default is 2
141-
apiKey: 'My API Key',
142141
});
143142

144143
// Or, configure per-request:
@@ -156,7 +155,6 @@ Requests time out after one minute by default. You can configure this with a `ti
156155
// Configure the default for all requests:
157156
const client = new Grid({
158157
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
159-
apiKey: 'My API Key',
160158
});
161159

162160
// Override per-request:

src/client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ export class Grid {
186186
return;
187187
}
188188

189+
protected authHeaders(opts: FinalRequestOptions): Headers | undefined {
190+
return new Headers({ Authorization: `Bearer ${this.apiKey}` });
191+
}
192+
189193
/**
190194
* Basic re-implementation of `qs.stringify` for primitive types.
191195
*/
@@ -636,6 +640,7 @@ export class Grid {
636640
...getPlatformHeaders(),
637641
'X-Client-Name': 'api-sdk',
638642
},
643+
this.authHeaders(options),
639644
this._options.defaultHeaders,
640645
bodyHeaders,
641646
options.headers,

0 commit comments

Comments
 (0)