@0xsequence/builder 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0xsequence-builder.cjs.dev.js +19 -19
- package/dist/0xsequence-builder.cjs.prod.js +19 -19
- package/dist/0xsequence-builder.esm.js +19 -19
- package/package.json +1 -1
- package/src/builder.gen.ts +158 -128
|
@@ -17,44 +17,44 @@ function _extends() {
|
|
|
17
17
|
// surface area of the client.
|
|
18
18
|
//
|
|
19
19
|
// In the future we can include additional interfaces as needed.
|
|
20
|
-
const WebrpcHeader =
|
|
21
|
-
const WebrpcHeaderValue =
|
|
20
|
+
const WebrpcHeader = 'Webrpc';
|
|
21
|
+
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-builder@v0.1.0';
|
|
22
22
|
|
|
23
23
|
// WebRPC description and code-gen version
|
|
24
|
-
const WebRPCVersion =
|
|
24
|
+
const WebRPCVersion = 'v1';
|
|
25
25
|
|
|
26
26
|
// Schema version of your RIDL schema
|
|
27
|
-
const WebRPCSchemaVersion =
|
|
27
|
+
const WebRPCSchemaVersion = 'v0.1.0';
|
|
28
28
|
|
|
29
29
|
// Schema hash generated from your RIDL schema
|
|
30
|
-
const WebRPCSchemaHash =
|
|
30
|
+
const WebRPCSchemaHash = '5b580e1afeb26e0b4a8ee026271e2466760da0aa';
|
|
31
31
|
function VersionFromHeader(headers) {
|
|
32
32
|
const headerValue = headers.get(WebrpcHeader);
|
|
33
33
|
if (!headerValue) {
|
|
34
34
|
return {
|
|
35
|
-
webrpcGenVersion:
|
|
36
|
-
codeGenName:
|
|
37
|
-
codeGenVersion:
|
|
38
|
-
schemaName:
|
|
39
|
-
schemaVersion:
|
|
35
|
+
webrpcGenVersion: '',
|
|
36
|
+
codeGenName: '',
|
|
37
|
+
codeGenVersion: '',
|
|
38
|
+
schemaName: '',
|
|
39
|
+
schemaVersion: ''
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
return parseWebrpcGenVersions(headerValue);
|
|
43
43
|
}
|
|
44
44
|
function parseWebrpcGenVersions(header) {
|
|
45
|
-
const versions = header.split(
|
|
45
|
+
const versions = header.split(';');
|
|
46
46
|
if (versions.length < 3) {
|
|
47
47
|
return {
|
|
48
|
-
webrpcGenVersion:
|
|
49
|
-
codeGenName:
|
|
50
|
-
codeGenVersion:
|
|
51
|
-
schemaName:
|
|
52
|
-
schemaVersion:
|
|
48
|
+
webrpcGenVersion: '',
|
|
49
|
+
codeGenName: '',
|
|
50
|
+
codeGenVersion: '',
|
|
51
|
+
schemaName: '',
|
|
52
|
+
schemaVersion: ''
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const [_, webrpcGenVersion] = versions[0].split(
|
|
56
|
-
const [codeGenName, codeGenVersion] = versions[1].split(
|
|
57
|
-
const [schemaName, schemaVersion] = versions[2].split(
|
|
55
|
+
const [_, webrpcGenVersion] = versions[0].split('@');
|
|
56
|
+
const [codeGenName, codeGenVersion] = versions[1].split('@');
|
|
57
|
+
const [schemaName, schemaVersion] = versions[2].split('@');
|
|
58
58
|
return {
|
|
59
59
|
webrpcGenVersion,
|
|
60
60
|
codeGenName,
|
|
@@ -17,44 +17,44 @@ function _extends() {
|
|
|
17
17
|
// surface area of the client.
|
|
18
18
|
//
|
|
19
19
|
// In the future we can include additional interfaces as needed.
|
|
20
|
-
const WebrpcHeader =
|
|
21
|
-
const WebrpcHeaderValue =
|
|
20
|
+
const WebrpcHeader = 'Webrpc';
|
|
21
|
+
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-builder@v0.1.0';
|
|
22
22
|
|
|
23
23
|
// WebRPC description and code-gen version
|
|
24
|
-
const WebRPCVersion =
|
|
24
|
+
const WebRPCVersion = 'v1';
|
|
25
25
|
|
|
26
26
|
// Schema version of your RIDL schema
|
|
27
|
-
const WebRPCSchemaVersion =
|
|
27
|
+
const WebRPCSchemaVersion = 'v0.1.0';
|
|
28
28
|
|
|
29
29
|
// Schema hash generated from your RIDL schema
|
|
30
|
-
const WebRPCSchemaHash =
|
|
30
|
+
const WebRPCSchemaHash = '5b580e1afeb26e0b4a8ee026271e2466760da0aa';
|
|
31
31
|
function VersionFromHeader(headers) {
|
|
32
32
|
const headerValue = headers.get(WebrpcHeader);
|
|
33
33
|
if (!headerValue) {
|
|
34
34
|
return {
|
|
35
|
-
webrpcGenVersion:
|
|
36
|
-
codeGenName:
|
|
37
|
-
codeGenVersion:
|
|
38
|
-
schemaName:
|
|
39
|
-
schemaVersion:
|
|
35
|
+
webrpcGenVersion: '',
|
|
36
|
+
codeGenName: '',
|
|
37
|
+
codeGenVersion: '',
|
|
38
|
+
schemaName: '',
|
|
39
|
+
schemaVersion: ''
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
return parseWebrpcGenVersions(headerValue);
|
|
43
43
|
}
|
|
44
44
|
function parseWebrpcGenVersions(header) {
|
|
45
|
-
const versions = header.split(
|
|
45
|
+
const versions = header.split(';');
|
|
46
46
|
if (versions.length < 3) {
|
|
47
47
|
return {
|
|
48
|
-
webrpcGenVersion:
|
|
49
|
-
codeGenName:
|
|
50
|
-
codeGenVersion:
|
|
51
|
-
schemaName:
|
|
52
|
-
schemaVersion:
|
|
48
|
+
webrpcGenVersion: '',
|
|
49
|
+
codeGenName: '',
|
|
50
|
+
codeGenVersion: '',
|
|
51
|
+
schemaName: '',
|
|
52
|
+
schemaVersion: ''
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const [_, webrpcGenVersion] = versions[0].split(
|
|
56
|
-
const [codeGenName, codeGenVersion] = versions[1].split(
|
|
57
|
-
const [schemaName, schemaVersion] = versions[2].split(
|
|
55
|
+
const [_, webrpcGenVersion] = versions[0].split('@');
|
|
56
|
+
const [codeGenName, codeGenVersion] = versions[1].split('@');
|
|
57
|
+
const [schemaName, schemaVersion] = versions[2].split('@');
|
|
58
58
|
return {
|
|
59
59
|
webrpcGenVersion,
|
|
60
60
|
codeGenName,
|
|
@@ -13,44 +13,44 @@ function _extends() {
|
|
|
13
13
|
// surface area of the client.
|
|
14
14
|
//
|
|
15
15
|
// In the future we can include additional interfaces as needed.
|
|
16
|
-
const WebrpcHeader =
|
|
17
|
-
const WebrpcHeaderValue =
|
|
16
|
+
const WebrpcHeader = 'Webrpc';
|
|
17
|
+
const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-builder@v0.1.0';
|
|
18
18
|
|
|
19
19
|
// WebRPC description and code-gen version
|
|
20
|
-
const WebRPCVersion =
|
|
20
|
+
const WebRPCVersion = 'v1';
|
|
21
21
|
|
|
22
22
|
// Schema version of your RIDL schema
|
|
23
|
-
const WebRPCSchemaVersion =
|
|
23
|
+
const WebRPCSchemaVersion = 'v0.1.0';
|
|
24
24
|
|
|
25
25
|
// Schema hash generated from your RIDL schema
|
|
26
|
-
const WebRPCSchemaHash =
|
|
26
|
+
const WebRPCSchemaHash = '5b580e1afeb26e0b4a8ee026271e2466760da0aa';
|
|
27
27
|
function VersionFromHeader(headers) {
|
|
28
28
|
const headerValue = headers.get(WebrpcHeader);
|
|
29
29
|
if (!headerValue) {
|
|
30
30
|
return {
|
|
31
|
-
webrpcGenVersion:
|
|
32
|
-
codeGenName:
|
|
33
|
-
codeGenVersion:
|
|
34
|
-
schemaName:
|
|
35
|
-
schemaVersion:
|
|
31
|
+
webrpcGenVersion: '',
|
|
32
|
+
codeGenName: '',
|
|
33
|
+
codeGenVersion: '',
|
|
34
|
+
schemaName: '',
|
|
35
|
+
schemaVersion: ''
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
return parseWebrpcGenVersions(headerValue);
|
|
39
39
|
}
|
|
40
40
|
function parseWebrpcGenVersions(header) {
|
|
41
|
-
const versions = header.split(
|
|
41
|
+
const versions = header.split(';');
|
|
42
42
|
if (versions.length < 3) {
|
|
43
43
|
return {
|
|
44
|
-
webrpcGenVersion:
|
|
45
|
-
codeGenName:
|
|
46
|
-
codeGenVersion:
|
|
47
|
-
schemaName:
|
|
48
|
-
schemaVersion:
|
|
44
|
+
webrpcGenVersion: '',
|
|
45
|
+
codeGenName: '',
|
|
46
|
+
codeGenVersion: '',
|
|
47
|
+
schemaName: '',
|
|
48
|
+
schemaVersion: ''
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const [_, webrpcGenVersion] = versions[0].split(
|
|
52
|
-
const [codeGenName, codeGenVersion] = versions[1].split(
|
|
53
|
-
const [schemaName, schemaVersion] = versions[2].split(
|
|
51
|
+
const [_, webrpcGenVersion] = versions[0].split('@');
|
|
52
|
+
const [codeGenName, codeGenVersion] = versions[1].split('@');
|
|
53
|
+
const [schemaName, schemaVersion] = versions[2].split('@');
|
|
54
54
|
return {
|
|
55
55
|
webrpcGenVersion,
|
|
56
56
|
codeGenName,
|
package/package.json
CHANGED
package/src/builder.gen.ts
CHANGED
|
@@ -3,65 +3,65 @@
|
|
|
3
3
|
// surface area of the client.
|
|
4
4
|
//
|
|
5
5
|
// In the future we can include additional interfaces as needed.
|
|
6
|
-
export const WebrpcHeader =
|
|
6
|
+
export const WebrpcHeader = 'Webrpc'
|
|
7
7
|
|
|
8
|
-
export const WebrpcHeaderValue =
|
|
8
|
+
export const WebrpcHeaderValue = 'webrpc@v0.22.0;gen-typescript@v0.16.1;sequence-builder@v0.1.0'
|
|
9
9
|
|
|
10
10
|
// WebRPC description and code-gen version
|
|
11
|
-
export const WebRPCVersion =
|
|
11
|
+
export const WebRPCVersion = 'v1'
|
|
12
12
|
|
|
13
13
|
// Schema version of your RIDL schema
|
|
14
|
-
export const WebRPCSchemaVersion =
|
|
14
|
+
export const WebRPCSchemaVersion = 'v0.1.0'
|
|
15
15
|
|
|
16
16
|
// Schema hash generated from your RIDL schema
|
|
17
|
-
export const WebRPCSchemaHash =
|
|
17
|
+
export const WebRPCSchemaHash = '5b580e1afeb26e0b4a8ee026271e2466760da0aa'
|
|
18
18
|
|
|
19
19
|
type WebrpcGenVersions = {
|
|
20
|
-
webrpcGenVersion: string
|
|
21
|
-
codeGenName: string
|
|
22
|
-
codeGenVersion: string
|
|
23
|
-
schemaName: string
|
|
24
|
-
schemaVersion: string
|
|
25
|
-
}
|
|
20
|
+
webrpcGenVersion: string
|
|
21
|
+
codeGenName: string
|
|
22
|
+
codeGenVersion: string
|
|
23
|
+
schemaName: string
|
|
24
|
+
schemaVersion: string
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
export function VersionFromHeader(headers: Headers): WebrpcGenVersions {
|
|
28
|
-
const headerValue = headers.get(WebrpcHeader)
|
|
28
|
+
const headerValue = headers.get(WebrpcHeader)
|
|
29
29
|
if (!headerValue) {
|
|
30
30
|
return {
|
|
31
|
-
webrpcGenVersion:
|
|
32
|
-
codeGenName:
|
|
33
|
-
codeGenVersion:
|
|
34
|
-
schemaName:
|
|
35
|
-
schemaVersion:
|
|
36
|
-
}
|
|
31
|
+
webrpcGenVersion: '',
|
|
32
|
+
codeGenName: '',
|
|
33
|
+
codeGenVersion: '',
|
|
34
|
+
schemaName: '',
|
|
35
|
+
schemaVersion: ''
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
return parseWebrpcGenVersions(headerValue)
|
|
39
|
+
return parseWebrpcGenVersions(headerValue)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
|
|
43
|
-
const versions = header.split(
|
|
43
|
+
const versions = header.split(';')
|
|
44
44
|
if (versions.length < 3) {
|
|
45
45
|
return {
|
|
46
|
-
webrpcGenVersion:
|
|
47
|
-
codeGenName:
|
|
48
|
-
codeGenVersion:
|
|
49
|
-
schemaName:
|
|
50
|
-
schemaVersion:
|
|
51
|
-
}
|
|
46
|
+
webrpcGenVersion: '',
|
|
47
|
+
codeGenName: '',
|
|
48
|
+
codeGenVersion: '',
|
|
49
|
+
schemaName: '',
|
|
50
|
+
schemaVersion: ''
|
|
51
|
+
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const [_, webrpcGenVersion] = versions[0].split(
|
|
55
|
-
const [codeGenName, codeGenVersion] = versions[1].split(
|
|
56
|
-
const [schemaName, schemaVersion] = versions[2].split(
|
|
54
|
+
const [_, webrpcGenVersion] = versions[0].split('@')
|
|
55
|
+
const [codeGenName, codeGenVersion] = versions[1].split('@')
|
|
56
|
+
const [schemaName, schemaVersion] = versions[2].split('@')
|
|
57
57
|
|
|
58
58
|
return {
|
|
59
59
|
webrpcGenVersion,
|
|
60
60
|
codeGenName,
|
|
61
61
|
codeGenVersion,
|
|
62
62
|
schemaName,
|
|
63
|
-
schemaVersion
|
|
64
|
-
}
|
|
63
|
+
schemaVersion
|
|
64
|
+
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//
|
|
@@ -93,17 +93,32 @@ export interface WalletProof {
|
|
|
93
93
|
|
|
94
94
|
export interface Builder {
|
|
95
95
|
ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
|
|
96
|
-
registerAudienceContact(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
registerAudienceContact(
|
|
97
|
+
args: RegisterAudienceContactArgs,
|
|
98
|
+
headers?: object,
|
|
99
|
+
signal?: AbortSignal
|
|
100
|
+
): Promise<RegisterAudienceContactReturn>
|
|
101
|
+
getRegisteredAudienceContact(
|
|
102
|
+
args: GetRegisteredAudienceContactArgs,
|
|
103
|
+
headers?: object,
|
|
104
|
+
signal?: AbortSignal
|
|
105
|
+
): Promise<GetRegisteredAudienceContactReturn>
|
|
106
|
+
getAudienceRegistrationPublicStatus(
|
|
107
|
+
args: GetAudienceRegistrationPublicStatusArgs,
|
|
108
|
+
headers?: object,
|
|
109
|
+
signal?: AbortSignal
|
|
110
|
+
): Promise<GetAudienceRegistrationPublicStatusReturn>
|
|
111
|
+
isAudienceContactRegistered(
|
|
112
|
+
args: IsAudienceContactRegisteredArgs,
|
|
113
|
+
headers?: object,
|
|
114
|
+
signal?: AbortSignal
|
|
115
|
+
): Promise<IsAudienceContactRegisteredReturn>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface PingArgs {}
|
|
104
119
|
|
|
105
120
|
export interface PingReturn {
|
|
106
|
-
status: boolean
|
|
121
|
+
status: boolean
|
|
107
122
|
}
|
|
108
123
|
|
|
109
124
|
export interface RegisterAudienceContactArgs {
|
|
@@ -114,7 +129,7 @@ export interface RegisterAudienceContactArgs {
|
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
export interface RegisterAudienceContactReturn {
|
|
117
|
-
ok: boolean
|
|
132
|
+
ok: boolean
|
|
118
133
|
}
|
|
119
134
|
export interface GetRegisteredAudienceContactArgs {
|
|
120
135
|
projectId: number
|
|
@@ -123,7 +138,7 @@ export interface GetRegisteredAudienceContactArgs {
|
|
|
123
138
|
}
|
|
124
139
|
|
|
125
140
|
export interface GetRegisteredAudienceContactReturn {
|
|
126
|
-
contact: AudienceContact
|
|
141
|
+
contact: AudienceContact
|
|
127
142
|
}
|
|
128
143
|
export interface GetAudienceRegistrationPublicStatusArgs {
|
|
129
144
|
projectId: number
|
|
@@ -131,7 +146,7 @@ export interface GetAudienceRegistrationPublicStatusArgs {
|
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
export interface GetAudienceRegistrationPublicStatusReturn {
|
|
134
|
-
status: AudienceRegistrationStatus
|
|
149
|
+
status: AudienceRegistrationStatus
|
|
135
150
|
}
|
|
136
151
|
export interface IsAudienceContactRegisteredArgs {
|
|
137
152
|
projectId: number
|
|
@@ -140,10 +155,9 @@ export interface IsAudienceContactRegisteredArgs {
|
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
export interface IsAudienceContactRegisteredReturn {
|
|
143
|
-
registered: boolean
|
|
158
|
+
registered: boolean
|
|
144
159
|
}
|
|
145
160
|
|
|
146
|
-
|
|
147
161
|
//
|
|
148
162
|
// Client
|
|
149
163
|
//
|
|
@@ -160,82 +174,101 @@ export class Builder implements Builder {
|
|
|
160
174
|
private url(name: string): string {
|
|
161
175
|
return this.hostname + this.path + name
|
|
162
176
|
}
|
|
163
|
-
|
|
177
|
+
|
|
164
178
|
ping = (headers?: object, signal?: AbortSignal): Promise<PingReturn> => {
|
|
165
|
-
return this.fetch(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
registerAudienceContact = (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return this.fetch(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
179
|
+
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers, signal)).then(
|
|
180
|
+
res => {
|
|
181
|
+
return buildResponse(res).then(_data => {
|
|
182
|
+
return {
|
|
183
|
+
status: <boolean>_data.status
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
},
|
|
187
|
+
error => {
|
|
188
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
registerAudienceContact = (
|
|
194
|
+
args: RegisterAudienceContactArgs,
|
|
195
|
+
headers?: object,
|
|
196
|
+
signal?: AbortSignal
|
|
197
|
+
): Promise<RegisterAudienceContactReturn> => {
|
|
198
|
+
return this.fetch(this.url('RegisterAudienceContact'), createHTTPRequest(args, headers, signal)).then(
|
|
199
|
+
res => {
|
|
200
|
+
return buildResponse(res).then(_data => {
|
|
201
|
+
return {
|
|
202
|
+
ok: <boolean>_data.ok
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
},
|
|
206
|
+
error => {
|
|
207
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
getRegisteredAudienceContact = (
|
|
213
|
+
args: GetRegisteredAudienceContactArgs,
|
|
214
|
+
headers?: object,
|
|
215
|
+
signal?: AbortSignal
|
|
216
|
+
): Promise<GetRegisteredAudienceContactReturn> => {
|
|
217
|
+
return this.fetch(this.url('GetRegisteredAudienceContact'), createHTTPRequest(args, headers, signal)).then(
|
|
218
|
+
res => {
|
|
219
|
+
return buildResponse(res).then(_data => {
|
|
220
|
+
return {
|
|
221
|
+
contact: <AudienceContact>_data.contact
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
},
|
|
225
|
+
error => {
|
|
226
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
getAudienceRegistrationPublicStatus = (
|
|
232
|
+
args: GetAudienceRegistrationPublicStatusArgs,
|
|
233
|
+
headers?: object,
|
|
234
|
+
signal?: AbortSignal
|
|
235
|
+
): Promise<GetAudienceRegistrationPublicStatusReturn> => {
|
|
236
|
+
return this.fetch(this.url('GetAudienceRegistrationPublicStatus'), createHTTPRequest(args, headers, signal)).then(
|
|
237
|
+
res => {
|
|
238
|
+
return buildResponse(res).then(_data => {
|
|
239
|
+
return {
|
|
240
|
+
status: <AudienceRegistrationStatus>_data.status
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
},
|
|
244
|
+
error => {
|
|
245
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
isAudienceContactRegistered = (
|
|
251
|
+
args: IsAudienceContactRegisteredArgs,
|
|
252
|
+
headers?: object,
|
|
253
|
+
signal?: AbortSignal
|
|
254
|
+
): Promise<IsAudienceContactRegisteredReturn> => {
|
|
255
|
+
return this.fetch(this.url('IsAudienceContactRegistered'), createHTTPRequest(args, headers, signal)).then(
|
|
256
|
+
res => {
|
|
257
|
+
return buildResponse(res).then(_data => {
|
|
258
|
+
return {
|
|
259
|
+
registered: <boolean>_data.registered
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
},
|
|
263
|
+
error => {
|
|
264
|
+
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
|
|
265
|
+
}
|
|
266
|
+
)
|
|
233
267
|
}
|
|
234
|
-
|
|
235
268
|
}
|
|
236
269
|
|
|
237
|
-
|
|
238
|
-
const reqHeaders: {[key: string]: string} = { ...headers, 'Content-Type': 'application/json' }
|
|
270
|
+
const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
|
|
271
|
+
const reqHeaders: { [key: string]: string } = { ...headers, 'Content-Type': 'application/json' }
|
|
239
272
|
reqHeaders[WebrpcHeader] = WebrpcHeaderValue
|
|
240
273
|
|
|
241
274
|
return {
|
|
@@ -251,18 +284,18 @@ const buildResponse = (res: Response): Promise<any> => {
|
|
|
251
284
|
let data
|
|
252
285
|
try {
|
|
253
286
|
data = JSON.parse(text)
|
|
254
|
-
} catch(error) {
|
|
287
|
+
} catch (error) {
|
|
255
288
|
let message = ''
|
|
256
|
-
if (error instanceof Error)
|
|
289
|
+
if (error instanceof Error) {
|
|
257
290
|
message = error.message
|
|
258
291
|
}
|
|
259
292
|
throw WebrpcBadResponseError.new({
|
|
260
293
|
status: res.status,
|
|
261
|
-
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
262
|
-
)
|
|
294
|
+
cause: `JSON.parse(): ${message}: response text: ${text}`
|
|
295
|
+
})
|
|
263
296
|
}
|
|
264
297
|
if (!res.ok) {
|
|
265
|
-
const code: number =
|
|
298
|
+
const code: number = typeof data.code === 'number' ? data.code : 0
|
|
266
299
|
throw (webrpcErrorByCode[code] || WebrpcError).new(data)
|
|
267
300
|
}
|
|
268
301
|
return data
|
|
@@ -444,7 +477,6 @@ export class WebrpcStreamFinishedError extends WebrpcError {
|
|
|
444
477
|
}
|
|
445
478
|
}
|
|
446
479
|
|
|
447
|
-
|
|
448
480
|
// Schema errors
|
|
449
481
|
|
|
450
482
|
export class UnauthorizedError extends WebrpcError {
|
|
@@ -603,7 +635,6 @@ export class AlreadyCollaboratorError extends WebrpcError {
|
|
|
603
635
|
}
|
|
604
636
|
}
|
|
605
637
|
|
|
606
|
-
|
|
607
638
|
export enum errors {
|
|
608
639
|
WebrpcEndpoint = 'WebrpcEndpoint',
|
|
609
640
|
WebrpcRequestFailed = 'WebrpcRequestFailed',
|
|
@@ -626,7 +657,7 @@ export enum errors {
|
|
|
626
657
|
InvalidArgument = 'InvalidArgument',
|
|
627
658
|
NotFound = 'NotFound',
|
|
628
659
|
UserNotFound = 'UserNotFound',
|
|
629
|
-
ProjectNotFound = 'ProjectNotFound'
|
|
660
|
+
ProjectNotFound = 'ProjectNotFound'
|
|
630
661
|
}
|
|
631
662
|
|
|
632
663
|
export enum WebrpcErrorCodes {
|
|
@@ -651,7 +682,7 @@ export enum WebrpcErrorCodes {
|
|
|
651
682
|
InvalidArgument = 2001,
|
|
652
683
|
NotFound = 3000,
|
|
653
684
|
UserNotFound = 3001,
|
|
654
|
-
ProjectNotFound = 3002
|
|
685
|
+
ProjectNotFound = 3002
|
|
655
686
|
}
|
|
656
687
|
|
|
657
688
|
export const webrpcErrorByCode: { [code: number]: any } = {
|
|
@@ -676,8 +707,7 @@ export const webrpcErrorByCode: { [code: number]: any } = {
|
|
|
676
707
|
[2001]: InvalidArgumentError,
|
|
677
708
|
[3000]: NotFoundError,
|
|
678
709
|
[3001]: UserNotFoundError,
|
|
679
|
-
[3002]: ProjectNotFoundError
|
|
710
|
+
[3002]: ProjectNotFoundError
|
|
680
711
|
}
|
|
681
712
|
|
|
682
713
|
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
|
|
683
|
-
|