File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,14 +3,18 @@ import type { BaseClientOptions } from "./BaseClient.js"
33import * as core from "./core/index.js"
44import type { IcePanelAPIVersion } from "./consts.js"
55
6- export interface IcePanelOptions {
6+ export interface IcePanelOptions extends Omit < BaseClientOptions , 'apiKeyAuth' | 'bearerAuth' > {
77 apiVersion : IcePanelAPIVersion
8+ apiKey ?: core . Supplier < string >
9+ token ?: core . Supplier < string >
810}
911
1012export class IcePanelClient extends Client {
11- constructor ( options : IcePanelOptions & BaseClientOptions ) {
13+ constructor ( options : IcePanelOptions ) {
1214 const updatedOptions : BaseClientOptions = {
13- ...options
15+ ...options ,
16+ apiKeyAuth : undefined ,
17+ bearerAuth : undefined
1418 }
1519
1620 updatedOptions . baseUrl = async ( ) => {
@@ -21,6 +25,18 @@ export class IcePanelClient extends Client {
2125 return `https://api.icepanel.io/${ options . apiVersion } `
2226 }
2327
28+ if ( options . apiKey ) {
29+ updatedOptions . apiKeyAuth = {
30+ key : options . apiKey
31+ }
32+ }
33+
34+ if ( options . token ) {
35+ updatedOptions . bearerAuth = {
36+ token : options . token
37+ }
38+ }
39+
2440 super ( updatedOptions )
2541 }
26- }
42+ }
You can’t perform that action at this time.
0 commit comments