@vrplatform/hyperline-client 1.0.12 → 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/src/client.ts CHANGED
@@ -104,21 +104,36 @@ export class HyperlineAPI {
104
104
  return results?.data[0];
105
105
  }
106
106
 
107
- async getCustomers(skip = 0, take = 100) {
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
- >(`/v1/customers?take=${take}&skip=${skip}`);
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)) || { data: [] };
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)) || { data: [] };
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
 
@@ -1 +0,0 @@
1
- {"root":["../../src/_types.generated.ts","../../src/index.ts"],"errors":true,"version":"5.7.3"}
@@ -1 +0,0 @@
1
- export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
@@ -1,6 +0,0 @@
1
- export function arrayBufferToBase64(arrayBuffer) {
2
- const uint8Array = new Uint8Array(arrayBuffer);
3
- const binaryString = String.fromCharCode.apply(null, uint8Array);
4
- return btoa(binaryString);
5
- }
6
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"src/","sources":["utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC1D,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,UAAiB,CAAC,CAAC;IACxE,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["export function arrayBufferToBase64(arrayBuffer: ArrayBuffer) {\n const uint8Array = new Uint8Array(arrayBuffer);\n const binaryString = String.fromCharCode.apply(null, uint8Array as any);\n return btoa(binaryString);\n}\n"]}
@@ -1 +0,0 @@
1
- export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
@@ -1,6 +0,0 @@
1
- export function arrayBufferToBase64(arrayBuffer) {
2
- const uint8Array = new Uint8Array(arrayBuffer);
3
- const binaryString = String.fromCharCode.apply(null, uint8Array);
4
- return btoa(binaryString);
5
- }
6
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"src/","sources":["utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC1D,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,UAAiB,CAAC,CAAC;IACxE,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["export function arrayBufferToBase64(arrayBuffer: ArrayBuffer) {\n const uint8Array = new Uint8Array(arrayBuffer);\n const binaryString = String.fromCharCode.apply(null, uint8Array as any);\n return btoa(binaryString);\n}\n"]}