@vrplatform/hyperline-client 1.0.13 → 1.0.15
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 +5230 -1716
- package/build/main/_types.generated.js.map +1 -1
- package/build/main/client.d.ts +564 -313
- package/build/main/client.js +38 -10
- package/build/main/client.js.map +1 -1
- package/build/main/const.d.ts +3 -1
- package/build/main/const.js +2 -0
- package/build/main/const.js.map +1 -1
- package/build/module/_types.generated.d.ts +5230 -1716
- package/build/module/_types.generated.js.map +1 -1
- package/build/module/client.d.ts +564 -313
- package/build/module/client.js +38 -10
- package/build/module/client.js.map +1 -1
- package/build/module/const.d.ts +3 -1
- package/build/module/const.js +2 -0
- package/build/module/const.js.map +1 -1
- package/package.json +1 -1
- package/src/_types.generated.ts +5230 -1716
- package/src/client.ts +62 -10
- package/src/const.ts +3 -1
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
|
|
|
@@ -245,6 +260,17 @@ export class HyperlineAPI {
|
|
|
245
260
|
}
|
|
246
261
|
|
|
247
262
|
async updateSubscription(
|
|
263
|
+
id: string,
|
|
264
|
+
data: NonNullable<
|
|
265
|
+
paths['/v2/subscriptions/{id}']['put']['requestBody']
|
|
266
|
+
>['content']['application/json']
|
|
267
|
+
) {
|
|
268
|
+
return await this.fetch<
|
|
269
|
+
paths['/v2/subscriptions/{id}']['put']['responses'][200]['content']['application/json']
|
|
270
|
+
>(`/v2/subscriptions/${id}`, { method: 'PUT' }, data);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async createSubscriptionUpdate(
|
|
248
274
|
id: string,
|
|
249
275
|
data: NonNullable<
|
|
250
276
|
paths['/v1/subscriptions/{id}/update']['post']['requestBody']
|
|
@@ -327,10 +353,24 @@ export class HyperlineAPI {
|
|
|
327
353
|
);
|
|
328
354
|
}
|
|
329
355
|
|
|
330
|
-
async getInvoicesByCustomerId(
|
|
356
|
+
async getInvoicesByCustomerId(
|
|
357
|
+
id: string,
|
|
358
|
+
filters?: Partial<operations['getInvoices']['parameters']['query']>
|
|
359
|
+
) {
|
|
360
|
+
const queryParams = new URLSearchParams();
|
|
361
|
+
queryParams.append('customerId__equals', id);
|
|
362
|
+
|
|
363
|
+
if (filters) {
|
|
364
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
365
|
+
if (value !== undefined && value !== null) {
|
|
366
|
+
queryParams.append(key, value.toString());
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
331
371
|
return await this.fetch<
|
|
332
372
|
paths['/v1/invoices']['get']['responses'][200]['content']['application/json']
|
|
333
|
-
>(`/v1/invoices
|
|
373
|
+
>(`/v1/invoices?${queryParams.toString()}`);
|
|
334
374
|
}
|
|
335
375
|
|
|
336
376
|
async getInvoiceDownload(id: string) {
|
|
@@ -344,19 +384,31 @@ export class HyperlineAPI {
|
|
|
344
384
|
}
|
|
345
385
|
|
|
346
386
|
async getAllInvoices(
|
|
347
|
-
items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = []
|
|
387
|
+
items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = [],
|
|
388
|
+
query: operations['getInvoices']['parameters']['query'] = { status: 'all' }
|
|
348
389
|
): Promise<
|
|
349
390
|
paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data']
|
|
350
391
|
> {
|
|
351
|
-
const { data } = (await this.getInvoices(items.length
|
|
392
|
+
const { data } = (await this.getInvoices(items.length, 100, {
|
|
393
|
+
status: 'all',
|
|
394
|
+
...query,
|
|
395
|
+
})) || {
|
|
396
|
+
data: [],
|
|
397
|
+
};
|
|
352
398
|
|
|
353
399
|
return data.length
|
|
354
|
-
? this.getAllInvoices([...items, ...data])
|
|
400
|
+
? this.getAllInvoices([...items, ...data], { status: 'all', ...query })
|
|
355
401
|
: [...items, ...data];
|
|
356
402
|
}
|
|
357
403
|
|
|
358
404
|
// OTHERS
|
|
359
405
|
|
|
406
|
+
async getPaymentMethod(customerId: string, paymentMethodId: string) {
|
|
407
|
+
return await this.fetch<
|
|
408
|
+
paths['/v1/customers/{id}/payment-methods/{paymentMethodId}']['get']['responses'][200]['content']['application/json']
|
|
409
|
+
>(`/v1/customers/${customerId}/payment-methods/${paymentMethodId}`);
|
|
410
|
+
}
|
|
411
|
+
|
|
360
412
|
async createBillableEvent(data: CreateBillableEvent[]) {
|
|
361
413
|
if (!data.length) return { events_created: [] };
|
|
362
414
|
|
package/src/const.ts
CHANGED
|
@@ -29,6 +29,7 @@ export const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';
|
|
|
29
29
|
export const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';
|
|
30
30
|
export const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';
|
|
31
31
|
export const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';
|
|
32
|
+
export const HYPERLINE_DEFAULT_MIN_AMOUNT = 12500;
|
|
32
33
|
|
|
33
34
|
export const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';
|
|
34
35
|
export const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';
|
|
@@ -39,6 +40,7 @@ export const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';
|
|
|
39
40
|
export const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';
|
|
40
41
|
export const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';
|
|
41
42
|
export const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';
|
|
43
|
+
export const GL_HYPERLINE_DEFAULT_MIN_AMOUNT = 25000;
|
|
42
44
|
|
|
43
45
|
export const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';
|
|
44
46
|
export const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';
|
|
@@ -71,7 +73,7 @@ export const WEBHOOKS = {
|
|
|
71
73
|
|
|
72
74
|
export const CURRENCY_MAP: Record<
|
|
73
75
|
currency_enum,
|
|
74
|
-
HyperlineEntities['
|
|
76
|
+
HyperlineEntities['Invoice']['currency'] | undefined
|
|
75
77
|
> = {
|
|
76
78
|
aed: 'AED',
|
|
77
79
|
afn: 'AFN',
|