Constructors
constructor
- new HttpClient(tokenProvider: TokenProvider, config?: Partial<{ apiUrl: string; httpClientConfig: Options; storageUrl: string }>): HttpClient
-
Parameters
-
-
Optional config: Partial<{ apiUrl: string; httpClientConfig: Options; storageUrl: string }>
Properties
Private Readonly apiKy
apiKy: KyInstance
Readonly apiUrl
apiUrl: string
Readonly storageUrl
storageUrl: string
Methods
create
- create<T>(endpoint: string, data: undefined | FormData | Record<string, JsonSerializable>, requestOptions?: Options): Promise<T>
-
Type parameters
Parameters
-
endpoint: string
-
data: undefined | FormData | Record<string, JsonSerializable>
-
Optional requestOptions: Options
Returns Promise<T>
delete
- delete(endpoint: string): Promise<void>
-
Parameters
Returns Promise<void>
download
-
Parameters
get
- get<T>(endpoint: string, params?: Record<string, undefined | string | number | boolean | Date>, requestOptions?: Options): Promise<T>
-
Type parameters
Parameters
-
endpoint: string
-
params: Record<string, undefined | string | number | boolean | Date> = {}
-
Optional requestOptions: Options
Returns Promise<T>
post
- post<T>(endpoint: string, data: undefined | FormData | Record<string, JsonSerializable>, requestOptions?: Options): Promise<T>
-
Type parameters
Parameters
-
endpoint: string
-
data: undefined | FormData | Record<string, JsonSerializable>
-
Optional requestOptions: Options
Returns Promise<T>
put
-
Type parameters
Parameters
Returns Promise<T>
search
- search<T>(baseEndpoint: string, params: undefined | Record<string, JsonSerializable>, requestOptions?: Options): Promise<Page<T>>
-
Type parameters
Parameters
-
baseEndpoint: string
-
params: undefined | Record<string, JsonSerializable>
-
Optional requestOptions: Options
Returns Promise<Page<T>>
update
- update<T>(endpoint: string, params: Record<string, JsonSerializable>): Promise<T>
-
Type parameters
Parameters
Returns Promise<T>
upload
- upload(data: FormData, requestOptions?: Options): Promise<Readonly<PODModel & { creator: string; details: DocumentDetails; originatingJob?: JobId; owner: string; size: number }>>
-
Parameters
-
data: FormData
-
Optional requestOptions: Options
Returns Promise<Readonly<PODModel & { creator: string; details: DocumentDetails; originatingJob?: JobId; owner: string; size: number }>>
Convenience method for POSTing and expecting a 201 response