-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathApiConfig.ts
More file actions
27 lines (25 loc) · 932 Bytes
/
ApiConfig.ts
File metadata and controls
27 lines (25 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export class ApiConfig {
static dataverseApiUrl: string
static dataverseApiAuthMechanism: DataverseApiAuthMechanism
static dataverseApiKey?: string
static bearerTokenLocalStorageKey?: string
static bearerTokenGetFunction?: () => string | null
static init(
dataverseApiUrl: string,
dataverseApiAuthMechanism: DataverseApiAuthMechanism,
dataverseApiKey?: string,
bearerTokenLocalStorageKey?: string,
bearerTokenGetFunction?: () => string | null
) {
this.dataverseApiUrl = dataverseApiUrl
this.dataverseApiAuthMechanism = dataverseApiAuthMechanism
this.dataverseApiKey = dataverseApiKey
this.bearerTokenLocalStorageKey = bearerTokenLocalStorageKey
this.bearerTokenGetFunction = bearerTokenGetFunction
}
}
export enum DataverseApiAuthMechanism {
API_KEY = 'api-key',
SESSION_COOKIE = 'session-cookie', // Temporal and only for dev purposes
BEARER_TOKEN = 'bearer-token'
}