@vrplatform/hyperline-client 1.0.13 → 1.0.14
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/build/main/_types.generated.d.ts +2144 -928
- package/build/main/_types.generated.js.map +1 -1
- package/build/main/client.d.ts +94 -77
- package/build/main/client.js +21 -8
- package/build/main/client.js.map +1 -1
- package/build/module/_types.generated.d.ts +2144 -928
- package/build/module/_types.generated.js.map +1 -1
- package/build/module/client.d.ts +94 -77
- package/build/module/client.js +21 -8
- package/build/module/client.js.map +1 -1
- package/package.json +1 -1
- package/src/_types.generated.ts +2144 -928
- package/src/client.ts +29 -8
package/src/client.ts
CHANGED
|
@@ -104,21 +104,36 @@ export class HyperlineAPI {
|
|
|
104
104
|
return results?.data[0];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
async getCustomers(
|
|
107
|
+
async getCustomers(
|
|
108
|
+
skip = 0,
|
|
109
|
+
take = 100,
|
|
110
|
+
query: operations['getCustomers']['parameters']['query'] = {}
|
|
111
|
+
) {
|
|
108
112
|
return await this.fetch<
|
|
109
113
|
paths['/v1/customers']['get']['responses'][200]['content']['application/json']
|
|
110
|
-
>(
|
|
114
|
+
>(
|
|
115
|
+
`/v1/customers?take=${take}&skip=${skip}&${Object.entries(query)
|
|
116
|
+
.filter(([_, value]) => value !== undefined)
|
|
117
|
+
.map(([key, value]) => `&${key}=${value}`)
|
|
118
|
+
.join('')}`
|
|
119
|
+
);
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
async getAllCustomers(
|
|
114
|
-
items: paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data'] = []
|
|
123
|
+
items: paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data'] = [],
|
|
124
|
+
query: operations['getCustomers']['parameters']['query'] = {}
|
|
115
125
|
): Promise<
|
|
116
126
|
paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data']
|
|
117
127
|
> {
|
|
118
|
-
const { data } = (await this.getCustomers(items.length
|
|
128
|
+
const { data } = (await this.getCustomers(items.length, 100, {
|
|
129
|
+
status: 'all',
|
|
130
|
+
...query,
|
|
131
|
+
})) || {
|
|
132
|
+
data: [],
|
|
133
|
+
};
|
|
119
134
|
|
|
120
135
|
return data.length
|
|
121
|
-
? this.getAllCustomers([...items, ...data])
|
|
136
|
+
? this.getAllCustomers([...items, ...data], { status: 'all', ...query })
|
|
122
137
|
: [...items, ...data];
|
|
123
138
|
}
|
|
124
139
|
|
|
@@ -344,14 +359,20 @@ export class HyperlineAPI {
|
|
|
344
359
|
}
|
|
345
360
|
|
|
346
361
|
async getAllInvoices(
|
|
347
|
-
items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = []
|
|
362
|
+
items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = [],
|
|
363
|
+
query: operations['getInvoices']['parameters']['query'] = { status: 'all' }
|
|
348
364
|
): Promise<
|
|
349
365
|
paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data']
|
|
350
366
|
> {
|
|
351
|
-
const { data } = (await this.getInvoices(items.length
|
|
367
|
+
const { data } = (await this.getInvoices(items.length, 100, {
|
|
368
|
+
status: 'all',
|
|
369
|
+
...query,
|
|
370
|
+
})) || {
|
|
371
|
+
data: [],
|
|
372
|
+
};
|
|
352
373
|
|
|
353
374
|
return data.length
|
|
354
|
-
? this.getAllInvoices([...items, ...data])
|
|
375
|
+
? this.getAllInvoices([...items, ...data], { status: 'all', ...query })
|
|
355
376
|
: [...items, ...data];
|
|
356
377
|
}
|
|
357
378
|
|