forked from HydraCG/Heracles.ts
/
IHypermediaContainer.ts
61 lines (52 loc) · 1.28 KB
/
IHypermediaContainer.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import ResourceFilterableCollection from "./Collections/ResourceFilterableCollection";
import { ICollection } from "./ICollection";
import { IHeaders } from "./IHeaders";
import { IResource } from "./IResource";
/**
* Provides an abstraction layer over hypermedia container.
* @interface
*/
export interface IHypermediaContainer extends ResourceFilterableCollection<IResource>, ICollection {
/**
* Gets response headers.
* @readonly
* @returns {IHeaders}
*/
readonly headers: IHeaders;
/**
* Gets a response status.
*/
readonly status: number;
/**
* Gets a response's URL.
*/
readonly url: string;
/**
* Gets a raw response body.
*/
readonly body: ReadableStream<Uint8Array> | null;
/**
* Gets a value indicating whether the body was consumed.
*/
readonly bodyUsed: boolean;
/**
* Gets a raw response body as an array of bytes.
* @returns {Promise<ArrayBuffer>}
*/
arrayBuffer(): Promise<ArrayBuffer>;
/**
* Gets a raw response body as a blob.
* @returns {Promise<Blob>}
*/
blob(): Promise<Blob>;
/**
* Gets a raw response body as a JSON.
* @returns {Promise<any>}
*/
json(): Promise<any>;
/**
* Gets a raw response body as a text.
* @returns {Promise<any>}
*/
text(): Promise<string>;
}