-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcontentstackClient.d.ts
More file actions
77 lines (66 loc) · 2.11 KB
/
contentstackClient.d.ts
File metadata and controls
77 lines (66 loc) · 2.11 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { User } from './user'
import { AxiosRequestConfig } from 'axios'
import { AnyProperty } from './utility/fields'
import { Pagination } from './utility/pagination'
import { Response } from './contentstackCollection'
import { Stack, StackConfig, StackDetails } from './stack'
import { Organization, Organizations } from './organization'
import { Queryable } from './utility/operations'
import OAuthHandler from './oauthHandler'
export interface ProxyConfig {
host: string
port: number
auth?: {
username: string
password:string
};
protocol?: string
}
export interface RetryDelayOption {
base?: number
customBackoff?: (retryCount: number, error: Error) => number
}
export interface ContentstackToken {
authorization?: string
authtoken?: string
early_access?: string[]
}
export interface ContentstackConfig extends AxiosRequestConfig, ContentstackToken {
proxy?: ProxyConfig | false
endpoint?: string
host?: string
timeout?: number
maxRequests?: number
retryOnError?: boolean
retryLimit?: number
retryDelay?: number
retryCondition?: (error: Error) => boolean
retryDelayOptions?: RetryDelayOption
refreshToken?: () => Promise<ContentstackToken>
maxContentLength?: number
maxBodyLength?: number
logHandler?: (level: string, data: any) => void
application?: string
integration?: string
delayMs?: number
}
export interface LoginDetails {
email: string,
password: string,
tfa_token?: string
mfaSecret?: string
}
export interface LoginResponse extends Response {
user: User
}
export interface ContentstackClient {
login(user: LoginDetails, params?: any): Promise<LoginResponse>
logout(authtoken?: string): Promise<Response>
getUser(params?: Pagination & AnyProperty): Promise<User>
stack(query?: {organization_uid?: string}): Queryable<Stack, StackDetails>
stack(config: StackConfig): Stack
organization(): Organizations
organization(uid: string): Organization
oauth(params?: any): OAuthHandler
}
export function client(config?: ContentstackConfig): ContentstackClient