-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.ts
39 lines (33 loc) · 1.04 KB
/
types.ts
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
import { AxiosError, AxiosResponse } from 'axios'
export interface IPutioAPIClientOptions {
clientID?: number
baseURL?: string
webAppURL?: string
}
export interface IPutioAPIClientResponse<T> extends AxiosResponse {
data: T & { status: 'OK' }
body?: T & { status: 'OK' } // @TODO: Remove when it's irrelevant.
}
export interface IPutioAPIClientErrorData {
'x-trace-id'?: string
error_id?: string
error_uri?: string
error_type: string
error_message: string
status_code: number
extra: Record<string, unknown>
}
export interface IPutioAPIClientError
extends AxiosError<IPutioAPIClientErrorData | string> {
data: IPutioAPIClientErrorData
toJSON: () => IPutioAPIClientErrorData
}
export type PutioAPIClientResponseInterceptor = {
onFulfilled: (
response: IPutioAPIClientResponse<any>,
) => IPutioAPIClientResponse<any>
onRejected: (error: IPutioAPIClientError) => Promise<IPutioAPIClientError>
}
export type PutioAPIClientResponseInterceptorFactory = (
options: IPutioAPIClientOptions,
) => PutioAPIClientResponseInterceptor