UNPKG

1.05 kBPlain TextView Raw
1import { OAuth2Options } from 'fetch-mw-oauth2';
2
3export type ContentType = {
4 mime: string,
5 representor: string,
6 q?: string
7};
8
9type AuthOptionsBasic = {
10 type: 'basic'
11 password: string
12 userName: string
13};
14type AuthOptionsBearer = {
15 type: 'bearer'
16 token: string
17};
18type AuthOptionsOAuth2 = {
19 type: 'oauth2',
20} & OAuth2Options;
21
22export type AuthOptions =
23 AuthOptionsBasic |
24 AuthOptionsBearer |
25 AuthOptionsOAuth2;
26
27export type KettingInit = {
28
29 /**
30 * Authentication options.
31 */
32 auth?: AuthOptions
33
34 /**
35 * A list of settings passed to the Fetch API.
36 *
37 * It's effectively a list of defaults that are passed as the 'init' argument.
38 * @see https://developer.mozilla.org/en-US/docs/Web/API/Request/Request
39 */
40 fetchInit?: RequestInit,
41
42 /**
43 * Per-domain options.
44 *
45 * This setting allows you to override specific options on a per-domain
46 * basis. It's possible to specify wildcards here.
47 */
48 match?: {
49 [domain: string]: {
50 auth?: AuthOptions
51 fetchInit?: RequestInit,
52 }
53 }
54};