omnisend-node-sdk
Version:
🔹 Typesafe Omnisend API SDK for Node.js
51 lines (50 loc) • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Events = void 0;
const http_client_1 = require("../http-client");
class Events {
constructor(http) {
/**
* @description Get custom event, created in Omnisend app.
*
* @tags Events
* @name GetEventsEventId
* @summary Get custom event
* @request GET:/events/{eventID}
* @secure
*/
this.getEventsEventId = (eventId, params = {}) => this.http.request(Object.assign({ path: `/events/${eventId}`, method: "GET", secure: true, format: "json" }, params));
/**
* @description Trigger custom event to Omnisend. To make your custom automation flow to work you need: 1. Create a custom event in the [Omnisend application](https://app.omnisend.com) while adding custom `fields`. 2. Create flow(s) with that custom event. 3. Pass all required fields (`eventID`, `email`, `phone`), including the required custom `fields`, that you created in Step 2.
*
* @tags Events
* @name PostEventsEventId
* @summary Trigger custom event
* @request POST:/events/{eventID}
* @secure
*/
this.postEventsEventId = (eventId, data, params = {}) => this.http.request(Object.assign({ path: `/events/${eventId}`, method: "POST", body: data, secure: true, type: http_client_1.ContentType.Json }, params));
/**
* @description Get custom events, created in Omnisend app.
*
* @tags Events
* @name GetEvents
* @summary List custom events
* @request GET:/events
* @secure
*/
this.getEvents = (params = {}) => this.http.request(Object.assign({ path: `/events`, method: "GET", secure: true, format: "json" }, params));
/**
* @description Trigger (by event’s system name) or create event. If custom event doesn’t exist - it will be created with passed event’s fields. Custom event field types will be determined automatically*. If existing custom event will be triggered with additional fields - they will be added to custom event fields. If triggered existing custom event's field types will differ from existing ones, you’ll get an error. **Note:** numbers like 10, 10.00, 10.0 will be interpreted as **integers**. If you want custom event field to be interpreted as **float**, pass **10.01** or etc (number not with leading zeros).
*
* @tags Events
* @name PostEvents
* @summary Trigger or create custom event
* @request POST:/events
* @secure
*/
this.postEvents = (data, params = {}) => this.http.request(Object.assign({ path: `/events`, method: "POST", body: data, secure: true, type: http_client_1.ContentType.Json }, params));
this.http = http;
}
}
exports.Events = Events;