@tryvital/vital-node
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -45,2 +45,13 @@ import { AxiosInstance } from 'axios'; | ||
public async test( | ||
event_code: 'HISTORICAL_DATA_UPDATE' | 'CREATED', | ||
webhook_type: 'activity' | 'body' | 'sleep' | 'workouts' | ||
): Promise<ClientFacingWebhook> { | ||
const resp = await this.client.post(this.baseURL.concat('/webhooks/test'), { | ||
event_code, | ||
webhook_type, | ||
}); | ||
return resp.data; | ||
} | ||
public constructWebhookEvent( | ||
@@ -47,0 +58,0 @@ payload: string, |
@@ -11,3 +11,4 @@ import { AxiosInstance } from 'axios'; | ||
deregister(webhookId: string): Promise<ClientFacingWebhook>; | ||
test(event_code: 'HISTORICAL_DATA_UPDATE' | 'CREATED', webhook_type: 'activity' | 'body' | 'sleep' | 'workouts'): Promise<ClientFacingWebhook>; | ||
constructWebhookEvent(payload: string, header: string, secret: string, tolerance?: number): Record<string, unknown>; | ||
} |
@@ -90,2 +90,18 @@ "use strict"; | ||
}; | ||
WebhooksApi.prototype.test = function (event_code, webhook_type) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var resp; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.client.post(this.baseURL.concat('/webhooks/test'), { | ||
event_code: event_code, | ||
webhook_type: webhook_type, | ||
})]; | ||
case 1: | ||
resp = _a.sent(); | ||
return [2 /*return*/, resp.data]; | ||
} | ||
}); | ||
}); | ||
}; | ||
WebhooksApi.prototype.constructWebhookEvent = function (payload, header, secret, tolerance) { | ||
@@ -92,0 +108,0 @@ if (tolerance === void 0) { tolerance = undefined; } |
{ | ||
"name": "@tryvital/vital-node", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"description": "Node client for Vital", | ||
@@ -5,0 +5,0 @@ "author": "maitham", |
552083
9545