Comparing version 2.4.1 to 2.5.0
@@ -27,2 +27,6 @@ import * as campaigns from './campaigns'; | ||
campaigns: { | ||
/** | ||
* GET /campaigns/list | ||
*/ | ||
list: (parameters?: campaigns.CampaignsListParameters) => Promise<campaigns.CampaignsListResponse>; | ||
trigger: { | ||
@@ -29,0 +33,0 @@ schedule: { |
@@ -23,2 +23,8 @@ "use strict"; | ||
this.campaigns = { | ||
/** | ||
* GET /campaigns/list | ||
*/ | ||
list: (parameters) => { | ||
return campaigns.list(this.apiUrl, this.apiKey, parameters); | ||
}, | ||
trigger: { | ||
@@ -25,0 +31,0 @@ schedule: { |
@@ -0,3 +1,4 @@ | ||
export * from './list'; | ||
export * as trigger from './trigger'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,4 +18,5 @@ "use strict"; | ||
exports.trigger = void 0; | ||
__exportStar(require("./list"), exports); | ||
exports.trigger = require("./trigger"); | ||
__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { ScheduleObject } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ import type { CampaignsTriggerSendObject } from '../types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -0,3 +1,29 @@ | ||
import type { ServerResponse } from '../common/request'; | ||
export * from './trigger/schedule/types'; | ||
export * from './trigger/types'; | ||
/** | ||
* Request parameters for campaigns list. | ||
* | ||
* {@link https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaigns/#request-parameters} | ||
*/ | ||
export interface CampaignsListParameters { | ||
page?: number; | ||
include_archived?: boolean; | ||
sort_direction?: string; | ||
'last_edit.time[gt]'?: string; | ||
} | ||
/** | ||
* Response body for campaigns list. | ||
* | ||
* {@link https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaigns/#response} | ||
*/ | ||
export interface CampaignsListResponse extends ServerResponse { | ||
campaigns: { | ||
id: string; | ||
last_edited: string; | ||
name: string; | ||
is_api_campaign: boolean; | ||
tags: string[]; | ||
}[]; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { ScheduleObject } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ import type { CanvasTriggerSendObject } from '../types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -11,11 +11,5 @@ "use strict"; | ||
function getCatalogItem(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/catalogs/${body.catalog_name}/items/${body.item_id}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/catalogs/${body.catalog_name}/items/${body.item_id}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getCatalogItem = getCatalogItem; | ||
//# sourceMappingURL=get_item.js.map |
@@ -24,3 +24,3 @@ "use strict"; | ||
hasNextPage() { | ||
return !!this.nextPageLink; | ||
return Boolean(this.nextPageLink); | ||
} | ||
@@ -34,8 +34,3 @@ next() { | ||
static async queryItems(apiUrl, apiKey, url) { | ||
const response = await (0, node_fetch_1.default)(apiUrl + url, { | ||
headers: { | ||
Authorization: `Bearer ${apiKey}`, | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
const response = await (0, node_fetch_1.default)(apiUrl + url, (0, request_1.buildOptions)({ apiKey })); | ||
const data = await response.json(); | ||
@@ -42,0 +37,0 @@ if (!response.ok) { |
@@ -11,11 +11,5 @@ "use strict"; | ||
function listCatalogs(apiUrl, apiKey) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/catalogs`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/catalogs`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.listCatalogs = listCatalogs; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { RequestBody, ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -25,3 +25,3 @@ * Response body for catalog list. | ||
} | ||
export type CatalogListItem<T extends Record<string, any> = Record<string, unknown>> = { | ||
export type CatalogListItem<T extends RequestBody = Record<string, unknown>> = { | ||
id: string; | ||
@@ -28,0 +28,0 @@ } & T; |
@@ -1,6 +0,10 @@ | ||
import { request } from './request'; | ||
import type { RequestOptions, RequestURL, ServerResponse } from './request'; | ||
/** | ||
* Sends a get request. | ||
* Makes a GET request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
export declare const get: typeof request; | ||
export declare function get<Response extends ServerResponse>(url: RequestURL, options: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=get.d.ts.map |
@@ -6,5 +6,12 @@ "use strict"; | ||
/** | ||
* Sends a get request. | ||
* Makes a GET request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
exports.get = request_1.request; | ||
function get(url, options) { | ||
return (0, request_1.request)(url, undefined, options); | ||
} | ||
exports.get = get; | ||
//# sourceMappingURL=get.js.map |
export * from './get'; | ||
export * from './options'; | ||
export * from './params'; | ||
export * from './post'; | ||
export * from './request'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,4 +18,6 @@ "use strict"; | ||
__exportStar(require("./get"), exports); | ||
__exportStar(require("./options"), exports); | ||
__exportStar(require("./params"), exports); | ||
__exportStar(require("./post"), exports); | ||
__exportStar(require("./request"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,9 @@ | ||
/// <reference types="node" /> | ||
import { URLSearchParams } from 'url'; | ||
export declare function buildParams(body: Record<string, any>): URLSearchParams; | ||
import type { RequestBody } from './request'; | ||
/** | ||
* Build query string params. | ||
* | ||
* @param parameters - Request parameters. | ||
* @returns - Query string. | ||
*/ | ||
export declare function buildParams(parameters?: RequestBody): string; | ||
//# sourceMappingURL=params.d.ts.map |
@@ -5,24 +5,58 @@ "use strict"; | ||
const url_1 = require("url"); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function buildParams(body) { | ||
return Object.entries(body).reduce((params, [key, value]) => { | ||
if (typeof value === 'boolean') { | ||
params.append(key, JSON.stringify(value)); | ||
} | ||
else if (typeof value === 'string') { | ||
params.append(key, value); | ||
} | ||
else if (typeof value === 'number') { | ||
params.append(key, value.toString()); | ||
} | ||
else if (typeof value === 'undefined') { | ||
// Intentionally skip value | ||
} | ||
else { | ||
throw new Error(`Unhandled param type for "${key}"`); | ||
} | ||
return params; | ||
/** | ||
* Build query string params. | ||
* | ||
* @param parameters - Request parameters. | ||
* @returns - Query string. | ||
*/ | ||
function buildParams(parameters) { | ||
if (!parameters) { | ||
return ''; | ||
} | ||
const searchParams = Object.entries(parameters).reduce((params, [key, value]) => { | ||
return appendParam(params, key, value); | ||
}, new url_1.URLSearchParams()); | ||
return searchParams.toString(); | ||
} | ||
exports.buildParams = buildParams; | ||
/** | ||
* Append query string param. | ||
* | ||
* @param searchParams - Search params. | ||
* @param key - Key. | ||
* @param value - Value. | ||
* @returns - URL search params. | ||
*/ | ||
function appendParam(searchParams, key, value) { | ||
if (value === undefined || value === null) { | ||
return searchParams; | ||
} | ||
if (Array.isArray(value)) { | ||
value.forEach((currentValue) => { | ||
appendParam(searchParams, key, currentValue); | ||
}); | ||
return searchParams; | ||
} | ||
searchParams.append(key, getValue(key, value)); | ||
return searchParams; | ||
} | ||
/** | ||
* Get string value. | ||
* | ||
* @param key - Key. | ||
* @param value - Value. | ||
* @returns - String value. | ||
*/ | ||
function getValue(key, value) { | ||
switch (typeof value) { | ||
case 'boolean': | ||
return JSON.stringify(value); | ||
case 'string': | ||
return value; | ||
case 'number': | ||
return value.toString(); | ||
default: | ||
throw new Error(`Unhandled param type for key "${key}"`); | ||
} | ||
} | ||
//# sourceMappingURL=params.js.map |
@@ -1,6 +0,11 @@ | ||
import { request, ServerResponse } from './request'; | ||
import type { RequestBody, RequestOptions, RequestURL, ServerResponse } from './request'; | ||
/** | ||
* Sends a post request. | ||
* Makes a POST request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param body - Request body. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
export declare function post<Response extends ServerResponse = ServerResponse>(...args: Parameters<typeof request>): Promise<Response>; | ||
export declare function post<Response extends ServerResponse>(url: RequestURL, body: RequestBody, options: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=post.d.ts.map |
@@ -6,6 +6,10 @@ "use strict"; | ||
/** | ||
* Sends a post request. | ||
* Makes a POST request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param body - Request body. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
function post(...args) { | ||
const [url, body, options] = args; | ||
function post(url, body, options) { | ||
return (0, request_1.request)(url, body, { ...options, method: request_1.RequestMethod.POST }); | ||
@@ -12,0 +16,0 @@ } |
import type { RequestInit } from 'node-fetch'; | ||
export declare enum RequestMethod { | ||
GET = "GET", | ||
POST = "POST" | ||
@@ -18,2 +17,5 @@ } | ||
} | ||
export type RequestURL = string; | ||
export type RequestBody = Record<string, any>; | ||
export type RequestOptions = RequestInit; | ||
/** | ||
@@ -27,3 +29,3 @@ * Makes a request. | ||
*/ | ||
export declare function request<Response extends ServerResponse = ServerResponse>(url: string, body?: Record<string, any>, options?: RequestInit): Promise<Response>; | ||
export declare function request<Response extends ServerResponse>(url: RequestURL, body?: RequestBody, options?: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=request.d.ts.map |
@@ -7,3 +7,2 @@ "use strict"; | ||
(function (RequestMethod) { | ||
RequestMethod["GET"] = "GET"; | ||
RequestMethod["POST"] = "POST"; | ||
@@ -27,5 +26,3 @@ })(RequestMethod || (exports.RequestMethod = RequestMethod = {})); | ||
*/ | ||
async function request(url, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
body, options) { | ||
async function request(url, body, options) { | ||
const response = await (0, node_fetch_1.default)(url, { | ||
@@ -32,0 +29,0 @@ body: body ? JSON.stringify(body) : undefined, |
@@ -18,11 +18,5 @@ "use strict"; | ||
function blacklist(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/blacklist`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/blacklist`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.blacklist = blacklist; | ||
//# sourceMappingURL=blacklist.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/bounce/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/bounce/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/spam/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/spam/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../common/request"); | ||
const params_1 = require("../common/request/params"); | ||
/** | ||
@@ -20,11 +19,5 @@ * Get upcoming scheduled campaigns and Canvases. | ||
function scheduled_broadcasts(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/messages/scheduled_broadcasts?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/messages/scheduled_broadcasts?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.scheduled_broadcasts = scheduled_broadcasts; | ||
//# sourceMappingURL=scheduled_broadcasts.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../common/request'; | ||
import type { ServerResponse } from '../common/request'; | ||
import type { ConnectedAudienceObject, UserAlias } from '../common/types'; | ||
@@ -3,0 +3,0 @@ export * from './schedule/types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/sends/id/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/sends/id/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,25 +18,5 @@ "use strict"; | ||
function get(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const params = new URLSearchParams(); | ||
if (body.subscription_group_id) { | ||
params.append('subscription_group_id', body.subscription_group_id); | ||
} | ||
; | ||
['external_id', 'email', 'phone'].forEach((key) => { | ||
if (Array.isArray(body[key])) { | ||
; | ||
body[key].forEach((value) => params.append(key, value)); | ||
} | ||
else if (body[key]) { | ||
params.append(key, body[key]); | ||
} | ||
}); | ||
return (0, request_1.get)(`${apiUrl}/subscription/status/get?${params}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/subscription/status/get?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.get = get; | ||
//# sourceMappingURL=get.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function set(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/subscription/status/set`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/subscription/status/set`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.set = set; | ||
//# sourceMappingURL=set.js.map |
@@ -18,27 +18,5 @@ "use strict"; | ||
function status(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const params = new URLSearchParams(); | ||
['external_id', 'email', 'phone'].forEach((key) => { | ||
if (Array.isArray(body[key])) { | ||
; | ||
body[key].forEach((value) => params.append(key, value)); | ||
} | ||
else if (body[key]) { | ||
params.append(key, body[key]); | ||
} | ||
}); | ||
if (body.limit) { | ||
params.append('limit', body.limit.toString()); | ||
} | ||
if (body.offset) { | ||
params.append('offset', body.offset.toString()); | ||
} | ||
return (0, request_1.get)(`${apiUrl}/subscription/user/status?${params}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/subscription/user/status?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.status = status; | ||
//# sourceMappingURL=status.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request content block. | ||
function getContentBlock(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/info?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/info?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getContentBlock = getContentBlock; | ||
//# sourceMappingURL=get.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request content block list. | ||
function listContentBlocks(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/list?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/list?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.listContentBlocks = listContentBlocks; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Request body for content block list. |
@@ -11,11 +11,5 @@ "use strict"; | ||
function createEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/templates/email/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/templates/email/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.createEmailTemplate = createEmailTemplate; | ||
//# sourceMappingURL=create.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request email template. | ||
function getEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/templates/email/info?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/templates/email/info?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getEmailTemplate = getEmailTemplate; | ||
//# sourceMappingURL=get.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request email template list | ||
function getEmailTemplateList(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/templates/email/list?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/templates/email/list?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getEmailTemplateList = getEmailTemplateList; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Request body for email template list. |
@@ -11,11 +11,5 @@ "use strict"; | ||
function updateEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/templates/email/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/templates/email/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.updateEmailTemplate = updateEmailTemplate; | ||
//# sourceMappingURL=update.js.map |
@@ -19,11 +19,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, campaignId, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/transactional/v1/campaigns/${campaignId}/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/transactional/v1/campaigns/${campaignId}/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { Attributes, TriggerProperties, UserAlias } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _new(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/alias/new`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/alias/new`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._new = _new; | ||
//# sourceMappingURL=new.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function global_control_group(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/global_control_group`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/global_control_group`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.global_control_group = global_control_group; | ||
//# sourceMappingURL=global_control_group.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function ids(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/ids`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/ids`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.ids = ids; | ||
//# sourceMappingURL=ids.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function segment(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/segment`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/segment`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.segment = segment; | ||
//# sourceMappingURL=segment.js.map |
@@ -20,11 +20,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function rename(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/rename`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/rename`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.rename = rename; | ||
//# sourceMappingURL=rename.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function identify(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/identify`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/identify`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.identify = identify; | ||
//# sourceMappingURL=identify.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function merge(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/merge`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/merge`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.merge = merge; | ||
//# sourceMappingURL=merge.js.map |
@@ -19,8 +19,3 @@ "use strict"; | ||
function track(apiUrl, apiKey, body, bulk) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const options = (0, request_1.buildOptions)({ apiKey }); | ||
if (bulk) { | ||
@@ -27,0 +22,0 @@ ; |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../common/request'; | ||
import type { ServerResponse } from '../common/request'; | ||
import type { Properties, UserAlias } from '../common/types'; | ||
@@ -3,0 +3,0 @@ export * from './alias/types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function set(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/v2/subscription/status/set`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/v2/subscription/status/set`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.set = set; | ||
//# sourceMappingURL=set.js.map |
@@ -27,2 +27,6 @@ import * as campaigns from './campaigns'; | ||
campaigns: { | ||
/** | ||
* GET /campaigns/list | ||
*/ | ||
list: (parameters?: campaigns.CampaignsListParameters) => Promise<campaigns.CampaignsListResponse>; | ||
trigger: { | ||
@@ -29,0 +33,0 @@ schedule: { |
@@ -46,2 +46,8 @@ "use strict"; | ||
this.campaigns = { | ||
/** | ||
* GET /campaigns/list | ||
*/ | ||
list: (parameters) => { | ||
return campaigns.list(this.apiUrl, this.apiKey, parameters); | ||
}, | ||
trigger: { | ||
@@ -48,0 +54,0 @@ schedule: { |
@@ -0,3 +1,4 @@ | ||
export * from './list'; | ||
export * as trigger from './trigger'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,2 +18,5 @@ "use strict"; | ||
}); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -26,9 +29,7 @@ if (mod && mod.__esModule) return mod; | ||
}; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.trigger = void 0; | ||
__exportStar(require("./list"), exports); | ||
exports.trigger = __importStar(require("./trigger")); | ||
__exportStar(require("./types"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { ScheduleObject } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ import type { CampaignsTriggerSendObject } from '../types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/campaigns/trigger/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -0,3 +1,29 @@ | ||
import type { ServerResponse } from '../common/request'; | ||
export * from './trigger/schedule/types'; | ||
export * from './trigger/types'; | ||
/** | ||
* Request parameters for campaigns list. | ||
* | ||
* {@link https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaigns/#request-parameters} | ||
*/ | ||
export interface CampaignsListParameters { | ||
page?: number; | ||
include_archived?: boolean; | ||
sort_direction?: string; | ||
'last_edit.time[gt]'?: string; | ||
} | ||
/** | ||
* Response body for campaigns list. | ||
* | ||
* {@link https://www.braze.com/docs/api/endpoints/export/campaigns/get_campaigns/#response} | ||
*/ | ||
export interface CampaignsListResponse extends ServerResponse { | ||
campaigns: { | ||
id: string; | ||
last_edited: string; | ||
name: string; | ||
is_api_campaign: boolean; | ||
tags: string[]; | ||
}[]; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { ScheduleObject } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ import type { CanvasTriggerSendObject } from '../types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/canvas/trigger/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -11,11 +11,5 @@ "use strict"; | ||
function getCatalogItem(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/catalogs/${body.catalog_name}/items/${body.item_id}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/catalogs/${body.catalog_name}/items/${body.item_id}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getCatalogItem = getCatalogItem; | ||
//# sourceMappingURL=get_item.js.map |
@@ -27,3 +27,3 @@ "use strict"; | ||
hasNextPage() { | ||
return !!this.nextPageLink; | ||
return Boolean(this.nextPageLink); | ||
} | ||
@@ -37,8 +37,3 @@ next() { | ||
static async queryItems(apiUrl, apiKey, url) { | ||
const response = await (0, node_fetch_1.default)(apiUrl + url, { | ||
headers: { | ||
Authorization: `Bearer ${apiKey}`, | ||
'Content-Type': 'application/json', | ||
}, | ||
}); | ||
const response = await (0, node_fetch_1.default)(apiUrl + url, (0, request_1.buildOptions)({ apiKey })); | ||
const data = await response.json(); | ||
@@ -45,0 +40,0 @@ if (!response.ok) { |
@@ -11,11 +11,5 @@ "use strict"; | ||
function listCatalogs(apiUrl, apiKey) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/catalogs`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/catalogs`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.listCatalogs = listCatalogs; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { RequestBody, ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -25,3 +25,3 @@ * Response body for catalog list. | ||
} | ||
export type CatalogListItem<T extends Record<string, any> = Record<string, unknown>> = { | ||
export type CatalogListItem<T extends RequestBody = Record<string, unknown>> = { | ||
id: string; | ||
@@ -28,0 +28,0 @@ } & T; |
@@ -1,6 +0,10 @@ | ||
import { request } from './request'; | ||
import type { RequestOptions, RequestURL, ServerResponse } from './request'; | ||
/** | ||
* Sends a get request. | ||
* Makes a GET request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
export declare const get: typeof request; | ||
export declare function get<Response extends ServerResponse>(url: RequestURL, options: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=get.d.ts.map |
@@ -6,5 +6,12 @@ "use strict"; | ||
/** | ||
* Sends a get request. | ||
* Makes a GET request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
exports.get = request_1.request; | ||
function get(url, options) { | ||
return (0, request_1.request)(url, undefined, options); | ||
} | ||
exports.get = get; | ||
//# sourceMappingURL=get.js.map |
export * from './get'; | ||
export * from './options'; | ||
export * from './params'; | ||
export * from './post'; | ||
export * from './request'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -18,4 +18,6 @@ "use strict"; | ||
__exportStar(require("./get"), exports); | ||
__exportStar(require("./options"), exports); | ||
__exportStar(require("./params"), exports); | ||
__exportStar(require("./post"), exports); | ||
__exportStar(require("./request"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,9 @@ | ||
/// <reference types="node" /> | ||
import { URLSearchParams } from 'url'; | ||
export declare function buildParams(body: Record<string, any>): URLSearchParams; | ||
import type { RequestBody } from './request'; | ||
/** | ||
* Build query string params. | ||
* | ||
* @param parameters - Request parameters. | ||
* @returns - Query string. | ||
*/ | ||
export declare function buildParams(parameters?: RequestBody): string; | ||
//# sourceMappingURL=params.d.ts.map |
@@ -5,24 +5,58 @@ "use strict"; | ||
const url_1 = require("url"); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function buildParams(body) { | ||
return Object.entries(body).reduce((params, [key, value]) => { | ||
if (typeof value === 'boolean') { | ||
params.append(key, JSON.stringify(value)); | ||
} | ||
else if (typeof value === 'string') { | ||
params.append(key, value); | ||
} | ||
else if (typeof value === 'number') { | ||
params.append(key, value.toString()); | ||
} | ||
else if (typeof value === 'undefined') { | ||
// Intentionally skip value | ||
} | ||
else { | ||
throw new Error(`Unhandled param type for "${key}"`); | ||
} | ||
return params; | ||
/** | ||
* Build query string params. | ||
* | ||
* @param parameters - Request parameters. | ||
* @returns - Query string. | ||
*/ | ||
function buildParams(parameters) { | ||
if (!parameters) { | ||
return ''; | ||
} | ||
const searchParams = Object.entries(parameters).reduce((params, [key, value]) => { | ||
return appendParam(params, key, value); | ||
}, new url_1.URLSearchParams()); | ||
return searchParams.toString(); | ||
} | ||
exports.buildParams = buildParams; | ||
/** | ||
* Append query string param. | ||
* | ||
* @param searchParams - Search params. | ||
* @param key - Key. | ||
* @param value - Value. | ||
* @returns - URL search params. | ||
*/ | ||
function appendParam(searchParams, key, value) { | ||
if (value === undefined || value === null) { | ||
return searchParams; | ||
} | ||
if (Array.isArray(value)) { | ||
value.forEach((currentValue) => { | ||
appendParam(searchParams, key, currentValue); | ||
}); | ||
return searchParams; | ||
} | ||
searchParams.append(key, getValue(key, value)); | ||
return searchParams; | ||
} | ||
/** | ||
* Get string value. | ||
* | ||
* @param key - Key. | ||
* @param value - Value. | ||
* @returns - String value. | ||
*/ | ||
function getValue(key, value) { | ||
switch (typeof value) { | ||
case 'boolean': | ||
return JSON.stringify(value); | ||
case 'string': | ||
return value; | ||
case 'number': | ||
return value.toString(); | ||
default: | ||
throw new Error(`Unhandled param type for key "${key}"`); | ||
} | ||
} | ||
//# sourceMappingURL=params.js.map |
@@ -1,6 +0,11 @@ | ||
import { request, ServerResponse } from './request'; | ||
import type { RequestBody, RequestOptions, RequestURL, ServerResponse } from './request'; | ||
/** | ||
* Sends a post request. | ||
* Makes a POST request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param body - Request body. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
export declare function post<Response extends ServerResponse = ServerResponse>(...args: Parameters<typeof request>): Promise<Response>; | ||
export declare function post<Response extends ServerResponse>(url: RequestURL, body: RequestBody, options: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=post.d.ts.map |
@@ -6,6 +6,10 @@ "use strict"; | ||
/** | ||
* Sends a post request. | ||
* Makes a POST request. | ||
* | ||
* @param url - Request endpoint. | ||
* @param body - Request body. | ||
* @param options - Request options. | ||
* @returns - Response. | ||
*/ | ||
function post(...args) { | ||
const [url, body, options] = args; | ||
function post(url, body, options) { | ||
return (0, request_1.request)(url, body, { ...options, method: request_1.RequestMethod.POST }); | ||
@@ -12,0 +16,0 @@ } |
import type { RequestInit } from 'node-fetch'; | ||
export declare enum RequestMethod { | ||
GET = "GET", | ||
POST = "POST" | ||
@@ -18,2 +17,5 @@ } | ||
} | ||
export type RequestURL = string; | ||
export type RequestBody = Record<string, any>; | ||
export type RequestOptions = RequestInit; | ||
/** | ||
@@ -27,3 +29,3 @@ * Makes a request. | ||
*/ | ||
export declare function request<Response extends ServerResponse = ServerResponse>(url: string, body?: Record<string, any>, options?: RequestInit): Promise<Response>; | ||
export declare function request<Response extends ServerResponse>(url: RequestURL, body?: RequestBody, options?: RequestOptions): Promise<Response>; | ||
//# sourceMappingURL=request.d.ts.map |
@@ -10,3 +10,2 @@ "use strict"; | ||
(function (RequestMethod) { | ||
RequestMethod["GET"] = "GET"; | ||
RequestMethod["POST"] = "POST"; | ||
@@ -30,5 +29,3 @@ })(RequestMethod || (exports.RequestMethod = RequestMethod = {})); | ||
*/ | ||
async function request(url, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
body, options) { | ||
async function request(url, body, options) { | ||
const response = await (0, node_fetch_1.default)(url, { | ||
@@ -35,0 +32,0 @@ body: body ? JSON.stringify(body) : undefined, |
@@ -18,11 +18,5 @@ "use strict"; | ||
function blacklist(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/blacklist`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/blacklist`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.blacklist = blacklist; | ||
//# sourceMappingURL=blacklist.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/bounce/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/bounce/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/email/spam/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/email/spam/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function update(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/schedule/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.update = update; | ||
//# sourceMappingURL=update.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../common/request"); | ||
const params_1 = require("../common/request/params"); | ||
/** | ||
@@ -20,11 +19,5 @@ * Get upcoming scheduled campaigns and Canvases. | ||
function scheduled_broadcasts(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/messages/scheduled_broadcasts?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/messages/scheduled_broadcasts?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.scheduled_broadcasts = scheduled_broadcasts; | ||
//# sourceMappingURL=scheduled_broadcasts.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/messages/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/messages/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../common/request'; | ||
import type { ServerResponse } from '../common/request'; | ||
import type { ConnectedAudienceObject, UserAlias } from '../common/types'; | ||
@@ -3,0 +3,0 @@ export * from './schedule/types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function create(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/sends/id/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/sends/id/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=create.js.map |
@@ -18,25 +18,5 @@ "use strict"; | ||
function get(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const params = new URLSearchParams(); | ||
if (body.subscription_group_id) { | ||
params.append('subscription_group_id', body.subscription_group_id); | ||
} | ||
; | ||
['external_id', 'email', 'phone'].forEach((key) => { | ||
if (Array.isArray(body[key])) { | ||
; | ||
body[key].forEach((value) => params.append(key, value)); | ||
} | ||
else if (body[key]) { | ||
params.append(key, body[key]); | ||
} | ||
}); | ||
return (0, request_1.get)(`${apiUrl}/subscription/status/get?${params}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/subscription/status/get?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.get = get; | ||
//# sourceMappingURL=get.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function set(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/subscription/status/set`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/subscription/status/set`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.set = set; | ||
//# sourceMappingURL=set.js.map |
@@ -18,27 +18,5 @@ "use strict"; | ||
function status(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const params = new URLSearchParams(); | ||
['external_id', 'email', 'phone'].forEach((key) => { | ||
if (Array.isArray(body[key])) { | ||
; | ||
body[key].forEach((value) => params.append(key, value)); | ||
} | ||
else if (body[key]) { | ||
params.append(key, body[key]); | ||
} | ||
}); | ||
if (body.limit) { | ||
params.append('limit', body.limit.toString()); | ||
} | ||
if (body.offset) { | ||
params.append('offset', body.offset.toString()); | ||
} | ||
return (0, request_1.get)(`${apiUrl}/subscription/user/status?${params}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/subscription/user/status?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.status = status; | ||
//# sourceMappingURL=status.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request content block. | ||
function getContentBlock(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/info?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/info?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getContentBlock = getContentBlock; | ||
//# sourceMappingURL=get.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request content block list. | ||
function listContentBlocks(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/list?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/content_blocks/list?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.listContentBlocks = listContentBlocks; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Request body for content block list. |
@@ -11,11 +11,5 @@ "use strict"; | ||
function createEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/templates/email/create`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/templates/email/create`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.createEmailTemplate = createEmailTemplate; | ||
//# sourceMappingURL=create.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request email template. | ||
function getEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/templates/email/info?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/templates/email/info?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getEmailTemplate = getEmailTemplate; | ||
//# sourceMappingURL=get.js.map |
@@ -5,3 +5,2 @@ "use strict"; | ||
const request_1 = require("../../common/request"); | ||
const params_1 = require("../../common/request/params"); | ||
/** | ||
@@ -13,11 +12,5 @@ * Request email template list | ||
function getEmailTemplateList(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.get)(`${apiUrl}/templates/email/list?${(0, params_1.buildParams)(body)}`, undefined, options); | ||
return (0, request_1.get)(`${apiUrl}/templates/email/list?${(0, request_1.buildParams)(body)}`, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.getEmailTemplateList = getEmailTemplateList; | ||
//# sourceMappingURL=list.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../common/request'; | ||
import type { ServerResponse } from '../../common/request'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Request body for email template list. |
@@ -11,11 +11,5 @@ "use strict"; | ||
function updateEmailTemplate(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/templates/email/update`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/templates/email/update`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.updateEmailTemplate = updateEmailTemplate; | ||
//# sourceMappingURL=update.js.map |
@@ -19,11 +19,5 @@ "use strict"; | ||
function send(apiUrl, apiKey, campaignId, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/transactional/v1/campaigns/${campaignId}/send`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/transactional/v1/campaigns/${campaignId}/send`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.send = send; | ||
//# sourceMappingURL=send.js.map |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../../../common/request'; | ||
import type { ServerResponse } from '../../../common/request'; | ||
import type { Attributes, TriggerProperties, UserAlias } from '../../../common/types'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _new(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/alias/new`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/alias/new`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._new = _new; | ||
//# sourceMappingURL=new.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function _delete(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/delete`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/delete`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports._delete = _delete; | ||
//# sourceMappingURL=delete.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function global_control_group(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/global_control_group`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/global_control_group`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.global_control_group = global_control_group; | ||
//# sourceMappingURL=global_control_group.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function ids(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/ids`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/ids`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.ids = ids; | ||
//# sourceMappingURL=ids.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function segment(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/export/segment`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/export/segment`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.segment = segment; | ||
//# sourceMappingURL=segment.js.map |
@@ -20,11 +20,5 @@ "use strict"; | ||
function remove(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/remove`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/remove`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.remove = remove; | ||
//# sourceMappingURL=remove.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function rename(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/rename`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/external_ids/rename`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.rename = rename; | ||
//# sourceMappingURL=rename.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function identify(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/identify`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/identify`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.identify = identify; | ||
//# sourceMappingURL=identify.js.map |
@@ -18,11 +18,5 @@ "use strict"; | ||
function merge(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/users/merge`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/users/merge`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.merge = merge; | ||
//# sourceMappingURL=merge.js.map |
@@ -19,8 +19,3 @@ "use strict"; | ||
function track(apiUrl, apiKey, body, bulk) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
const options = (0, request_1.buildOptions)({ apiKey }); | ||
if (bulk) { | ||
@@ -27,0 +22,0 @@ ; |
@@ -1,2 +0,2 @@ | ||
import { ServerResponse } from '../common/request'; | ||
import type { ServerResponse } from '../common/request'; | ||
import type { Properties, UserAlias } from '../common/types'; | ||
@@ -3,0 +3,0 @@ export * from './alias/types'; |
@@ -18,11 +18,5 @@ "use strict"; | ||
function set(apiUrl, apiKey, body) { | ||
const options = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${apiKey}`, | ||
}, | ||
}; | ||
return (0, request_1.post)(`${apiUrl}/v2/subscription/status/set`, body, options); | ||
return (0, request_1.post)(`${apiUrl}/v2/subscription/status/set`, body, (0, request_1.buildOptions)({ apiKey })); | ||
} | ||
exports.set = set; | ||
//# sourceMappingURL=set.js.map |
{ | ||
"name": "braze-api", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "Track users, send messages, export data, and more with Braze API.", | ||
@@ -5,0 +5,0 @@ "author": "Mark <mark@remarkablemark.org>", |
@@ -106,3 +106,3 @@ <!-- readme-start --> | ||
- [ ] /campaigns/details | ||
- [ ] /campaigns/list | ||
- [x] /campaigns/list | ||
- [ ] /sends/data_series | ||
@@ -109,0 +109,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
899
533127
8855