forked from stellar/js-stellar-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcall_builder.js.html
425 lines (405 loc) · 52.7 KB
/
call_builder.js.html
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>call_builder.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AccountCallBuilder.html">AccountCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#accountId">accountId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#forAsset">forAsset</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#forLiquidityPool">forLiquidityPool</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#forSigner">forSigner</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#sponsor">sponsor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AccountRequiresMemoError.html">AccountRequiresMemoError</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AccountResponse.html">AccountResponse</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountResponse.html#accountId">accountId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountResponse.html#incrementSequenceNumber">incrementSequenceNumber</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AccountResponse.html#sequenceNumber">sequenceNumber</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AssetsCallBuilder.html">AssetsCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#forCode">forCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#forIssuer">forIssuer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AssetsCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="CallBuilder.html">CallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html">ClaimableBalanceCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#asset">asset</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#claimableBalance">claimableBalance</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#claimant">claimant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#sponsor">sponsor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="ClaimableBalanceCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Config.html">Config</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Config.html#.getTimeout">getTimeout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Config.html#.isAllowHttp">isAllowHttp</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Config.html#.setAllowHttp">setAllowHttp</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Config.html#.setDefault">setDefault</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Config.html#.setTimeout">setTimeout</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="EffectCallBuilder.html">EffectCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forLedger">forLedger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forLiquidityPool">forLiquidityPool</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forOperation">forOperation</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#forTransaction">forTransaction</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="EffectCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="FederationServer.html">FederationServer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="FederationServer.html#.createForDomain">createForDomain</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="FederationServer.html#.resolve">resolve</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="FederationServer.html#resolveAccountId">resolveAccountId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="FederationServer.html#resolveAddress">resolveAddress</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="FederationServer.html#resolveTransactionId">resolveTransactionId</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="LedgerCallBuilder.html">LedgerCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#ledger">ledger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LedgerCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html">LiquidityPoolCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#forAssets">forAssets</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#liquidityPoolId">liquidityPoolId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LiquidityPoolCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="OfferCallBuilder.html">OfferCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#buying">buying</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#offer">offer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#selling">selling</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#sponsor">sponsor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OfferCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="OperationCallBuilder.html">OperationCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forClaimableBalance">forClaimableBalance</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forLedger">forLedger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forLiquidityPool">forLiquidityPool</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#forTransaction">forTransaction</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#includeFailed">includeFailed</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#operation">operation</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="OperationCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="OrderbookCallBuilder.html">OrderbookCallBuilder</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="PathCallBuilder.html">PathCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PathCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="PaymentCallBuilder.html">PaymentCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#forLedger">forLedger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#forTransaction">forTransaction</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="PaymentCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Server.html">Server</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#accounts">accounts</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#assets">assets</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#checkMemoRequired">checkMemoRequired</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#claimableBalances">claimableBalances</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#effects">effects</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#feeStats">feeStats</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#fetchBaseFee">fetchBaseFee</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#fetchTimebounds">fetchTimebounds</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#ledgers">ledgers</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#liquidityPools">liquidityPools</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#loadAccount">loadAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#offers">offers</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#operations">operations</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#orderbook">orderbook</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#payments">payments</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#strictReceivePaths">strictReceivePaths</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#strictSendPaths">strictSendPaths</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#submitTransaction">submitTransaction</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#tradeAggregation">tradeAggregation</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#trades">trades</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Server.html#transactions">transactions</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="StellarTomlResolver.html">StellarTomlResolver</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StellarTomlResolver.html#.resolve">resolve</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html">StrictReceivePathCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictReceivePathCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html">StrictSendPathCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="StrictSendPathCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html">TradeAggregationCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradeAggregationCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TradesCallBuilder.html">TradesCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forAssetPair">forAssetPair</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forLiquidityPool">forLiquidityPool</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forOffer">forOffer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#forType">forType</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TradesCallBuilder.html#stream">stream</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="TransactionCallBuilder.html">TransactionCallBuilder</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#call">call</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#cursor">cursor</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#forAccount">forAccount</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#forClaimableBalance">forClaimableBalance</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#forEndpoint">forEndpoint</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#forLedger">forLedger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#forLiquidityPool">forLiquidityPool</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#includeFailed">includeFailed</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#join">join</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#limit">limit</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#order">order</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#stream">stream</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="TransactionCallBuilder.html#transaction">transaction</a></span></li><li class="nav-heading">Namespaces</li><li class="nav-heading"><span class="nav-item-type type-namespace">N</span><span class="nav-item-name"><a href="Utils.html">Utils</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.buildChallengeTx">buildChallengeTx</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.gatherTxSigners">gatherTxSigners</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.readChallengeTx">readChallengeTx</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.validateTimebounds">validateTimebounds</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.verifyChallengeTxSigners">verifyChallengeTxSigners</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.verifyChallengeTxThreshold">verifyChallengeTxThreshold</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Utils.html#.verifyTxSignedBy">verifyTxSignedBy</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#getCurrentServerTime">getCurrentServerTime</a></span></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#SERVER_TIME_MAP">SERVER_TIME_MAP</a></span></li>
</nav>
<div id="main">
<h1 class="page-title">call_builder.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import { __awaiter } from "tslib";
import isNode from "detect-node";
import URI from "urijs";
import URITemplate from "urijs/src/URITemplate";
import { BadRequestError, NetworkError, NotFoundError } from "./errors";
import HorizonAxiosClient from "./horizon_axios_client";
/* tslint:disable-next-line:no-var-requires */
const version = require("../package.json").version;
// Resources which can be included in the Horizon response via the `join`
// query-param.
const JOINABLE = ["transaction"];
let EventSource;
const anyGlobal = global;
if (anyGlobal.EventSource) {
EventSource = anyGlobal.EventSource;
}
else if (isNode) {
/* tslint:disable-next-line:no-var-requires */
EventSource = require("eventsource");
}
else {
EventSource = anyGlobal.window.EventSource;
}
/**
* Creates a new {@link CallBuilder} pointed to server defined by serverUrl.
*
* This is an **abstract** class. Do not create this object directly, use {@link Server} class.
* @param {string} serverUrl URL of Horizon server
* @class CallBuilder
*/
export class CallBuilder {
constructor(serverUrl, neighborRoot = "") {
this.url = serverUrl.clone();
this.filter = [];
this.originalSegments = this.url.segment() || [];
this.neighborRoot = neighborRoot;
}
/**
* Triggers a HTTP request using this builder's current configuration.
* @returns {Promise} a Promise that resolves to the server's response.
*/
call() {
this.checkFilter();
return this._sendNormalRequest(this.url).then((r) => this._parseResponse(r));
}
//// TODO: Migrate to async, BUT that's a change in behavior and tests "rejects two filters" will fail.
//// It's because async will check within promise, which makes more sense when using awaits instead of Promises.
// public async call(): Promise<T> {
// this.checkFilter();
// const r = await this._sendNormalRequest(this.url);
// return this._parseResponse(r);
// }
//// /* actually equals */
//// public call(): Promise<T> {
//// return Promise.resolve().then(() => {
//// this.checkFilter();
//// return this._sendNormalRequest(this.url)
//// }).then((r) => {
//// this._parseResponse(r)
//// });
//// }
/**
* Creates an EventSource that listens for incoming messages from the server. To stop listening for new
* events call the function returned by this method.
* @see [Horizon Response Format](https://developers.stellar.org/api/introduction/response-format/)
* @see [MDN EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)
* @param {object} [options] EventSource options.
* @param {function} [options.onmessage] Callback function to handle incoming messages.
* @param {function} [options.onerror] Callback function to handle errors.
* @param {number} [options.reconnectTimeout] Custom stream connection timeout in ms, default is 15 seconds.
* @returns {function} Close function. Run to close the connection and stop listening for new events.
*/
stream(options = {}) {
this.checkFilter();
this.url.setQuery("X-Client-Name", "js-stellar-sdk");
this.url.setQuery("X-Client-Version", version);
// EventSource object
let es;
// timeout is the id of the timeout to be triggered if there were no new messages
// in the last 15 seconds. The timeout is reset when a new message arrive.
// It prevents closing EventSource object in case of 504 errors as `readyState`
// property is not reliable.
let timeout;
const createTimeout = () => {
timeout = setTimeout(() => {
if (es) {
es.close();
}
/* tslint:disable-next-line:no-use-before-declare */
es = createEventSource();
}, options.reconnectTimeout || 15 * 1000);
};
const createEventSource = () => {
try {
es = new EventSource(this.url.toString());
}
catch (err) {
if (options.onerror) {
options.onerror(err);
}
}
createTimeout();
if (es) {
// when receiving the close message from Horizon we should
// close the connection and recreate the event source
let closed = false;
const onClose = () => {
if (closed) {
return;
}
clearTimeout(timeout);
es.close();
createEventSource();
closed = true;
};
const onMessage = (message) => {
if (message.type === "close") {
onClose();
return;
}
const result = message.data
? this._parseRecord(JSON.parse(message.data))
: message;
if (result.paging_token) {
this.url.setQuery("cursor", result.paging_token);
}
clearTimeout(timeout);
createTimeout();
if (typeof options.onmessage !== "undefined") {
options.onmessage(result);
}
};
const onError = (error) => {
if (options.onerror) {
options.onerror(error);
}
};
// use addEventListener too, just in case
if (es.addEventListener) {
es.addEventListener("message", onMessage.bind(this));
es.addEventListener("error", onError.bind(this));
es.addEventListener("close", onClose.bind(this));
}
else {
es.onmessage = onMessage.bind(this);
es.onerror = onError.bind(this);
}
}
return es;
};
createEventSource();
return function close() {
clearTimeout(timeout);
if (es) {
es.close();
}
};
}
/**
* Sets `cursor` parameter for the current call. Returns the CallBuilder object on which this method has been called.
* @see [Paging](https://developers.stellar.org/api/introduction/pagination/)
* @param {string} cursor A cursor is a value that points to a specific location in a collection of resources.
* @returns {object} current CallBuilder instance
*/
cursor(cursor) {
this.url.setQuery("cursor", cursor);
return this;
}
/**
* Sets `limit` parameter for the current call. Returns the CallBuilder object on which this method has been called.
* @see [Paging](https://developers.stellar.org/api/introduction/pagination/)
* @param {number} number Number of records the server should return.
* @returns {object} current CallBuilder instance
*/
limit(recordsNumber) {
this.url.setQuery("limit", recordsNumber.toString());
return this;
}
/**
* Sets `order` parameter for the current call. Returns the CallBuilder object on which this method has been called.
* @param {"asc"|"desc"} direction Sort direction
* @returns {object} current CallBuilder instance
*/
order(direction) {
this.url.setQuery("order", direction);
return this;
}
/**
* Sets `join` parameter for the current call. The `join` parameter
* includes the requested resource in the response. Currently, the
* only valid value for the parameter is `transactions` and is only
* supported on the operations and payments endpoints. The response
* will include a `transaction` field for each operation in the
* response.
*
* @param {"transactions"} join Records to be included in the response.
* @returns {object} current CallBuilder instance.
*/
join(include) {
this.url.setQuery("join", include);
return this;
}
/**
* A helper method to craft queries to "neighbor" endpoints.
*
* For example, we have an `/effects` suffix endpoint on many different
* "root" endpoints, such as `/transactions/:id` and `/accounts/:id`. So,
* it's helpful to be able to conveniently create queries to the
* `/accounts/:id/effects` endpoint:
*
* this.forEndpoint("accounts", accountId)`.
*
* @param {string} endpoint neighbor endpoint in question, like /operations
* @param {string} param filter parameter, like an operation ID
*
* @returns {CallBuilder} this CallBuilder instance
*/
forEndpoint(endpoint, param) {
if (this.neighborRoot === "") {
throw new Error("Invalid usage: neighborRoot not set in constructor");
}
this.filter.push([endpoint, param, this.neighborRoot]);
return this;
}
/**
* @private
* @returns {void}
*/
checkFilter() {
if (this.filter.length >= 2) {
throw new BadRequestError("Too many filters specified", this.filter);
}
if (this.filter.length === 1) {
// append filters to original segments
const newSegment = this.originalSegments.concat(this.filter[0]);
this.url.segment(newSegment);
}
}
/**
* Convert a link object to a function that fetches that link.
* @private
* @param {object} link A link object
* @param {bool} link.href the URI of the link
* @param {bool} [link.templated] Whether the link is templated
* @returns {function} A function that requests the link
*/
_requestFnForLink(link) {
return (opts = {}) => __awaiter(this, void 0, void 0, function* () {
let uri;
if (link.templated) {
const template = URITemplate(link.href);
uri = URI(template.expand(opts)); // TODO: fix upstream types.
}
else {
uri = URI(link.href);
}
const r = yield this._sendNormalRequest(uri);
return this._parseResponse(r);
});
}
/**
* Given the json response, find and convert each link into a function that
* calls that link.
* @private
* @param {object} json JSON response
* @returns {object} JSON response with string links replaced with functions
*/
_parseRecord(json) {
if (!json._links) {
return json;
}
for (const key of Object.keys(json._links)) {
const n = json._links[key];
let included = false;
// If the key with the link name already exists, create a copy
if (typeof json[key] !== "undefined") {
json[`${key}_attr`] = json[key];
included = true;
}
/*
If the resource can be side-loaded using `join` query-param then don't
try to load from the server. We need to whitelist the keys which are
joinable, since there are other keys like `ledger` which is included in
some payloads, but doesn't represent the ledger resource, in that
scenario we want to make the call to the server using the URL from links.
*/
if (included && JOINABLE.indexOf(key) >= 0) {
const record = this._parseRecord(json[key]);
// Maintain a promise based API so the behavior is the same whether you
// are loading from the server or in-memory (via join).
json[key] = () => __awaiter(this, void 0, void 0, function* () { return record; });
}
else {
json[key] = this._requestFnForLink(n);
}
}
return json;
}
_sendNormalRequest(initialUrl) {
return __awaiter(this, void 0, void 0, function* () {
let url = initialUrl;
if (url.authority() === "") {
url = url.authority(this.url.authority());
}
if (url.protocol() === "") {
url = url.protocol(this.url.protocol());
}
return HorizonAxiosClient.get(url.toString())
.then((response) => response.data)
.catch(this._handleNetworkError);
});
}
/**
* @private
* @param {object} json Response object
* @returns {object} Extended response
*/
_parseResponse(json) {
if (json._embedded && json._embedded.records) {
return this._toCollectionPage(json);
}
return this._parseRecord(json);
}
/**
* @private
* @param {object} json Response object
* @returns {object} Extended response object
*/
_toCollectionPage(json) {
for (let i = 0; i < json._embedded.records.length; i += 1) {
json._embedded.records[i] = this._parseRecord(json._embedded.records[i]);
}
return {
records: json._embedded.records,
next: () => __awaiter(this, void 0, void 0, function* () {
const r = yield this._sendNormalRequest(URI(json._links.next.href));
return this._toCollectionPage(r);
}),
prev: () => __awaiter(this, void 0, void 0, function* () {
const r = yield this._sendNormalRequest(URI(json._links.prev.href));
return this._toCollectionPage(r);
}),
};
}
/**
* @private
* @param {object} error Network error object
* @returns {Promise<Error>} Promise that rejects with a human-readable error
*/
_handleNetworkError(error) {
return __awaiter(this, void 0, void 0, function* () {
if (error.response && error.response.status && error.response.statusText) {
switch (error.response.status) {
case 404:
return Promise.reject(new NotFoundError(error.response.statusText, error.response.data));
default:
return Promise.reject(new NetworkError(error.response.statusText, error.response.data));
}
}
else {
return Promise.reject(new Error(error.message));
}
});
}
}
//# sourceMappingURL=call_builder.js.map</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Jan 19 2022 15:31:06 GMT-0800 (Pacific Standard Time) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>