-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathrequest.ts
83 lines (74 loc) · 1.72 KB
/
request.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { QueryParamsSerializationOptions } from '@ember-data/request-utils';
import type { ResourceIdentifierObject } from '@ember-data/types/q/ember-data-json-api';
import { StableRecordIdentifier } from '@ember-data/types/q/identifier';
export type CacheOptions = {
key?: string;
reload?: boolean;
backgroundReload?: boolean;
};
export type FindRecordRequestOptions = {
url: string;
method: 'GET';
headers: Headers;
cacheOptions: CacheOptions;
op: 'findRecord';
records: [ResourceIdentifierObject];
};
export type QueryRequestOptions = {
url: string;
method: 'GET';
headers: Headers;
cacheOptions: CacheOptions;
op: 'query';
};
export type PostQueryRequestOptions = {
url: string;
method: 'POST' | 'QUERY';
headers: Headers;
body: string;
cacheOptions: CacheOptions & { key: string };
op: 'query';
};
export type DeleteRequestOptions = {
url: string;
method: 'DELETE';
headers: Headers;
op: 'deleteRecord';
data: {
record: StableRecordIdentifier;
};
};
export type UpdateRequestOptions = {
url: string;
method: 'PATCH' | 'PUT';
headers: Headers;
op: 'updateRecord';
data: {
record: StableRecordIdentifier;
};
};
export type CreateRequestOptions = {
url: string;
method: 'POST';
headers: Headers;
op: 'createRecord';
data: {
record: StableRecordIdentifier;
};
};
export type RemotelyAccessibleIdentifier = {
id: string;
type: string;
lid?: string;
};
export type ConstrainedRequestOptions = {
reload?: boolean;
backgroundReload?: boolean;
host?: string;
namespace?: string;
resourcePath?: string;
urlParamsSettings?: QueryParamsSerializationOptions;
};
export type FindRecordOptions = ConstrainedRequestOptions & {
include?: string | string[];
};