Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mailerlite-api-v2-node

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailerlite-api-v2-node - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

17

dist/@types/@types/index.d.ts

@@ -50,2 +50,3 @@ import { AxiosRequestConfig } from 'axios'

export type CampaignAction = 'send' | 'cancel'
export type CampaignStatus = 'sent' | 'draft' | 'outbox'

@@ -113,12 +114,14 @@

export interface SubsriberFields {
city: string
company: string
[key: string]: any
// TODO: consider adding optional key hints for city, company, etc.
export interface SubscriberFields {
[key: string]: string | number | Date
}
// TODO: remove in next major version
export interface SubsriberFields extends SubscriberFields {}
export interface SubscriberData {
email: string
name?: string
fields?: SubsriberFields
fields?: SubscriberFields
resubscribe?: boolean

@@ -135,3 +138,3 @@ type?: 'unsubscribed' | 'active' | 'unconfirmed'

type?: 'unsubscribed' | 'active'
fields?: SubsriberFields
fields?: SubscriberFields
resendAutoresponders?: boolean

@@ -170,3 +173,3 @@ }

name?: string
fields?: SubsriberFields
fields?: SubscriberFields
resubscribe?: boolean

@@ -173,0 +176,0 @@ type?: 'unsubscribed' | 'active' | 'unconfirmed'

@@ -44,3 +44,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('me')];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('me')];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -65,3 +68,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, this.getAccount()];
switch (_a.label) {
case 0: return [4 /*yield*/, this.getAccount()];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -68,0 +74,0 @@ });

@@ -44,5 +44,8 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.post('batch', {
requests: requests,
})];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('batch', {
requests: requests,
})];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -49,0 +52,0 @@ });

import { AxiosInstance } from 'axios';
import { CampaignContent, CampaignData, CampaignQuery, CampaignSendData, CampaignStatus } from '../@types';
import { CampaignAction, CampaignContent, CampaignData, CampaignQuery, CampaignSendData, CampaignStatus } from '../@types';
export default function (client: AxiosInstance): {
actOnCampaign(campaignId: number, action: 'send' | 'cancel', data?: CampaignSendData): Promise<import("axios").AxiosResponse<any>>;
actOnCampaign(campaignId: number, action: CampaignAction, data?: CampaignSendData): Promise<import("axios").AxiosResponse<any>>;
getCampaigns(status?: CampaignStatus, params?: CampaignQuery): Promise<import("axios").AxiosResponse<any>>;

@@ -6,0 +6,0 @@ getCampaignCount(status?: CampaignStatus): Promise<number>;

@@ -45,3 +45,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.post("/campaigns/" + campaignId + "/actions/" + action, data)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post("/campaigns/" + campaignId + "/actions/" + action, data)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -55,3 +58,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("campaigns/" + status, { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("campaigns/" + status, { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -77,12 +83,16 @@ });

return __generator(this, function (_a) {
if (!campaign.groups && !campaign.segments) {
throw new Error('Groups or segments have to be specified');
switch (_a.label) {
case 0:
if (!campaign.groups && !campaign.segments) {
throw new Error('Groups or segments have to be specified');
}
if (campaign.type === 'regular' && !campaign.subject) {
throw new Error('Mail subject is required if campaign type is regular.');
}
if (campaign.type === 'ab' && !campaign.abSettings && typeof campaign.abSettings !== 'object') {
throw new Error('AbSettings are required if campaign type is ab.');
}
return [4 /*yield*/, client.post('campaigns', campaign)];
case 1: return [2 /*return*/, _a.sent()];
}
if (campaign.type === 'regular' && !campaign.subject) {
throw new Error('Mail subject is required if campaign type is regular.');
}
if (campaign.type === 'ab' && !campaign.abSettings && typeof campaign.abSettings !== 'object') {
throw new Error('AbSettings are required if campaign type is ab.');
}
return [2 /*return*/, client.post('campaigns', campaign)];
});

@@ -94,3 +104,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("campaigns/" + campaignId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("campaigns/" + campaignId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -102,3 +115,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.put("campaigns/" + campaignId + "/content", content)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.put("campaigns/" + campaignId + "/content", content)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -105,0 +121,0 @@ });

@@ -44,3 +44,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('fields')];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('fields')];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -52,3 +55,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post('fields', field)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('fields', field)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -60,3 +66,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.put("fields/" + fieldId, fieldUpdate)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.put("fields/" + fieldId, fieldUpdate)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -68,3 +77,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("fields/" + fieldId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("fields/" + fieldId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -71,0 +83,0 @@ });

@@ -56,3 +56,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('groups', { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('groups', { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -64,3 +67,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("groups/" + groupId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("groups/" + groupId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -72,3 +78,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post('groups', group)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('groups', group)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -80,3 +89,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.put("groups/" + groupId, groupUpdate)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.put("groups/" + groupId, groupUpdate)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -88,3 +100,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("groups/" + groupId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("groups/" + groupId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -96,3 +111,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post("groups/" + groupId + "/subscribers", subscriber)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post("groups/" + groupId + "/subscribers", subscriber)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -105,3 +123,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post("groups/" + groupId + "/subscribers/import", __assign({ subscribers: subscribers }, importOptions))];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post("groups/" + groupId + "/subscribers/import", __assign({ subscribers: subscribers }, importOptions))];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -113,3 +134,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("groups/" + groupId + "/subscribers/import/" + importId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("groups/" + groupId + "/subscribers/import/" + importId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -121,3 +145,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("groups/" + groupId + "/subscribers/" + subscriberId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("groups/" + groupId + "/subscribers/" + subscriberId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -130,3 +157,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("groups/" + groupId + "/subscribers")];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("groups/" + groupId + "/subscribers")];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -152,3 +182,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("groups/" + groupId + "/subscribers/" + subscriberType, { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("groups/" + groupId + "/subscribers/" + subscriberType, { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -173,3 +206,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("groups/" + groupId + "/subscribers/" + subscriberIdentifier)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("groups/" + groupId + "/subscribers/" + subscriberIdentifier)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -176,0 +212,0 @@ });

@@ -73,3 +73,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('segments', { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('segments', { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -76,0 +79,0 @@ });

@@ -44,3 +44,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('settings/double_optin')];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('settings/double_optin')];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -65,5 +68,8 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post('settings/double_optin', {
enable: isEnabled,
})];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('settings/double_optin', {
enable: isEnabled,
})];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -75,3 +81,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, this.setDoubleOptin(true)];
switch (_a.label) {
case 0: return [4 /*yield*/, this.setDoubleOptin(true)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -83,3 +92,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, this.setDoubleOptin(false)];
switch (_a.label) {
case 0: return [4 /*yield*/, this.setDoubleOptin(false)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -86,0 +98,0 @@ });

@@ -44,3 +44,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('stats')];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('stats')];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -47,0 +50,0 @@ });

@@ -45,3 +45,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('subscribers', { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('subscribers', { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -53,3 +56,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post('subscribers', subscriber)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('subscribers', subscriber)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -61,3 +67,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("subscribers/" + identifier)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("subscribers/" + identifier)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -69,3 +78,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.put("subscribers/" + identifier, subscriber)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.put("subscribers/" + identifier, subscriber)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -78,3 +90,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get('subscribers/search', { params: params })];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('subscribers/search', { params: params })];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -86,3 +101,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("subscribers/" + identifier + "/activity")];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("subscribers/" + identifier + "/activity")];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -93,4 +111,13 @@ });

return __awaiter(this, void 0, void 0, function () {
var url;
return __generator(this, function (_a) {
return [2 /*return*/, client.get("subscribers/" + identifier + "/actvity/" + activityType)];
switch (_a.label) {
case 0:
url = [
"subscribers/" + identifier + "/actvity",
activityType,
].join('/');
return [4 /*yield*/, client.get(url)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -102,3 +129,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("subscribers/" + identifier + "/groups")];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("subscribers/" + identifier + "/groups")];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -110,3 +140,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("subscribers/" + identifier)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("subscribers/" + identifier)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -113,0 +146,0 @@ });

@@ -44,5 +44,8 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('timezones', {
baseURL: 'https://api.mailerlite.com/api/master/',
})];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('timezones', {
baseURL: 'https://api.mailerlite.com/api/master/',
})];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -54,5 +57,8 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("timezones/" + timezoneId, {
baseURL: 'https://api.mailerlite.com/api/master/',
})];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("timezones/" + timezoneId, {
baseURL: 'https://api.mailerlite.com/api/master/',
})];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -59,0 +65,0 @@ });

@@ -70,3 +70,6 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, client.get('webhooks')];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get('webhooks')];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -78,3 +81,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.get("webhooks/" + webhookId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.get("webhooks/" + webhookId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -86,3 +92,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post('webhooks', webhook)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post('webhooks', webhook)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -94,3 +103,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.post("webhooks/" + webhookId, webhook)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.post("webhooks/" + webhookId, webhook)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -102,3 +114,6 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, client.delete("webhooks/" + webhookId)];
switch (_a.label) {
case 0: return [4 /*yield*/, client.delete("webhooks/" + webhookId)];
case 1: return [2 /*return*/, _a.sent()];
}
});

@@ -105,0 +120,0 @@ });

@@ -70,3 +70,6 @@ "use strict";

}, function (error) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, Promise.reject(error)];
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.reject(error)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); });

@@ -79,3 +82,6 @@ }

}, function (error) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, Promise.reject(error)];
switch (_a.label) {
case 0: return [4 /*yield*/, Promise.reject(error)];
case 1: return [2 /*return*/, _a.sent()];
}
}); }); });

@@ -82,0 +88,0 @@ return client;

@@ -48,3 +48,3 @@ import { Options } from './@types';

removeField(fieldId: number): Promise<import("axios").AxiosResponse<any>>;
actOnCampaign(campaignId: number, action: "send" | "cancel", data?: import("./@types").CampaignSendData): Promise<import("axios").AxiosResponse<any>>;
actOnCampaign(campaignId: number, action: import("./@types").CampaignAction, data?: import("./@types").CampaignSendData): Promise<import("axios").AxiosResponse<any>>;
getCampaigns(status?: import("./@types").CampaignStatus, params?: import("./@types").CampaignQuery): Promise<import("axios").AxiosResponse<any>>;

@@ -51,0 +51,0 @@ getCampaignCount(status?: import("./@types").CampaignStatus): Promise<number>;

{
"name": "mailerlite-api-v2-node",
"version": "1.0.2",
"version": "1.1.0",
"description": "[MailerLite API v2](https://developers.mailerlite.com/docs/getting-started-with-mailerlite-api) [Node.js](https://nodejs.org/en/) SDK. It is mostly a thin wrapper on [axios](https://github.com/axios/axios) that provides [authentication](https://developers.mailerlite.com/docs/authentication), response/request camelCase transformations, Typescript type definitions and some handy shorthand methods.",

@@ -23,18 +23,18 @@ "main": "dist/index.js",

"devDependencies": {
"@types/jest": "^25.2.3",
"@types/node": "^14.0.11",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"eslint": "^7.1.0",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-config-standard-with-typescript": "^18.0.2",
"eslint-plugin-import": "^2.20.2",
"eslint-config-standard-with-typescript": "^19.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"jest": "^26.0.1",
"husky": "^4.3.0",
"jest": "^26.6.0",
"jest-extended": "^0.11.5",
"ts-jest": "^26.1.0",
"typescript": "^3.9.5"
"ts-jest": "^26.4.1",
"typescript": "^4.0.3"
},

@@ -41,0 +41,0 @@ "husky": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc