@trycourier/courier 4.8.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -37,7 +37,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.client = void 0;
40
- var accounts_1 = require("./accounts");
41
40
  var audiences_1 = require("./audiences");
42
41
  var audit_events_1 = require("./audit-events");
43
42
  var automations_1 = require("./automations");
@@ -48,6 +47,7 @@ var notifications_1 = require("./notifications");
48
47
  var preferences_1 = require("./preferences");
49
48
  var profile_1 = require("./profile");
50
49
  var send_1 = require("./send");
50
+ var tenants_1 = require("./tenants");
51
51
  var token_management_1 = require("./token-management");
52
52
  var users_1 = require("./users");
53
53
  var cancelMessage = function (options) {
@@ -116,8 +116,8 @@ var getMessages = function (options) {
116
116
  notification: params === null || params === void 0 ? void 0 : params.notificationId,
117
117
  recipient: params === null || params === void 0 ? void 0 : params.recipientId,
118
118
  status: params === null || params === void 0 ? void 0 : params.status,
119
- tags: params === null || params === void 0 ? void 0 : params.tags
120
- }
119
+ tags: params === null || params === void 0 ? void 0 : params.tags,
120
+ },
121
121
  })];
122
122
  case 1:
123
123
  res = _a.sent();
@@ -128,7 +128,6 @@ var getMessages = function (options) {
128
128
  };
129
129
  exports.client = function (options) {
130
130
  return {
131
- accounts: accounts_1.accounts(options),
132
131
  addRecipientToLists: profile_1.addRecipientToLists(options),
133
132
  audiences: audiences_1.audiences(options),
134
133
  auditEvents: audit_events_1.auditEvents(options),
@@ -154,7 +153,8 @@ exports.client = function (options) {
154
153
  replaceBrand: brands_1.replaceBrand(options),
155
154
  replaceProfile: profile_1.replaceProfile(options),
156
155
  send: send_1.send(options),
156
+ tenants: tenants_1.tenants(options),
157
157
  tokenManagement: token_management_1.tokenManagement(options),
158
- users: users_1.users(options)
158
+ users: users_1.users(options),
159
159
  };
160
160
  };
@@ -0,0 +1,8 @@
1
+ import { ICourierClientConfiguration } from "../types";
2
+ import * as TenantTypes from "./types";
3
+ export declare const tenants: (options: ICourierClientConfiguration) => {
4
+ delete: (tenantId: string) => Promise<void>;
5
+ get: (tenantId: string) => Promise<TenantTypes.ITenant>;
6
+ listTenants: (listOptions?: TenantTypes.ITenantListOptions | undefined) => Promise<TenantTypes.IPaginatedResult<TenantTypes.ITenant>>;
7
+ put: (tenant: Omit<TenantTypes.ITenant, "type">) => Promise<TenantTypes.ITenant>;
8
+ };
@@ -36,23 +36,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.accounts = void 0;
40
- var deleteAccount = function (options) { return function (accountId) { return __awaiter(void 0, void 0, void 0, function () {
39
+ exports.tenants = void 0;
40
+ var deleteTenant = function (options) { return function (tenantId) { return __awaiter(void 0, void 0, void 0, function () {
41
41
  return __generator(this, function (_a) {
42
42
  switch (_a.label) {
43
- case 0: return [4 /*yield*/, options.httpClient.delete("/accounts/" + accountId)];
43
+ case 0: return [4 /*yield*/, options.httpClient.delete("/tenants/" + tenantId)];
44
44
  case 1:
45
45
  _a.sent();
46
46
  return [2 /*return*/];
47
47
  }
48
48
  });
49
49
  }); }; };
50
- var getAccount = function (options) {
51
- return function (accountId) { return __awaiter(void 0, void 0, void 0, function () {
50
+ var getTenant = function (options) {
51
+ return function (tenantId) { return __awaiter(void 0, void 0, void 0, function () {
52
52
  var response;
53
53
  return __generator(this, function (_a) {
54
54
  switch (_a.label) {
55
- case 0: return [4 /*yield*/, options.httpClient.get("/accounts/" + accountId)];
55
+ case 0: return [4 /*yield*/, options.httpClient.get("/tenants/" + tenantId)];
56
56
  case 1:
57
57
  response = _a.sent();
58
58
  return [2 /*return*/, response.data];
@@ -60,16 +60,16 @@ var getAccount = function (options) {
60
60
  });
61
61
  }); };
62
62
  };
63
- var listAccounts = function (options) {
63
+ var listTenants = function (options) {
64
64
  return function (listOptions) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var response;
66
66
  return __generator(this, function (_a) {
67
67
  switch (_a.label) {
68
- case 0: return [4 /*yield*/, options.httpClient.get("/accounts", undefined, {
68
+ case 0: return [4 /*yield*/, options.httpClient.get("/tenants", undefined, {
69
69
  params: {
70
70
  cursor: (listOptions === null || listOptions === void 0 ? void 0 : listOptions.cursor) || "",
71
- limit: (listOptions === null || listOptions === void 0 ? void 0 : listOptions.limit) || "20"
72
- }
71
+ limit: (listOptions === null || listOptions === void 0 ? void 0 : listOptions.limit) || "20",
72
+ },
73
73
  })];
74
74
  case 1:
75
75
  response = _a.sent();
@@ -78,12 +78,12 @@ var listAccounts = function (options) {
78
78
  });
79
79
  }); };
80
80
  };
81
- var putAccount = function (options) {
82
- return function (account) { return __awaiter(void 0, void 0, void 0, function () {
81
+ var putTenant = function (options) {
82
+ return function (tenant) { return __awaiter(void 0, void 0, void 0, function () {
83
83
  var response;
84
84
  return __generator(this, function (_a) {
85
85
  switch (_a.label) {
86
- case 0: return [4 /*yield*/, options.httpClient.put("/accounts/" + account.id, account)];
86
+ case 0: return [4 /*yield*/, options.httpClient.put("/tenants/" + tenant.id, tenant)];
87
87
  case 1:
88
88
  response = _a.sent();
89
89
  return [2 /*return*/, response.data];
@@ -91,9 +91,9 @@ var putAccount = function (options) {
91
91
  });
92
92
  }); };
93
93
  };
94
- exports.accounts = function (options) { return ({
95
- delete: deleteAccount(options),
96
- get: getAccount(options),
97
- listAccounts: listAccounts(options),
98
- put: putAccount(options)
94
+ exports.tenants = function (options) { return ({
95
+ delete: deleteTenant(options),
96
+ get: getTenant(options),
97
+ listTenants: listTenants(options),
98
+ put: putTenant(options),
99
99
  }); };
@@ -1,8 +1,8 @@
1
- export interface IAccount {
1
+ export interface ITenant {
2
2
  brand_id?: string;
3
3
  id: string;
4
4
  name: string;
5
- parent_account_id?: string;
5
+ parent_tenant_id?: string;
6
6
  default_preferences?: {
7
7
  items: Array<{
8
8
  id: string;
@@ -14,21 +14,23 @@ export interface IAccount {
14
14
  [key: string]: any;
15
15
  };
16
16
  user_profile?: Record<string, any>;
17
- type: "account";
17
+ type: "tenant";
18
18
  }
19
19
  export interface IPaginatedResult<T> {
20
20
  cursor?: string;
21
21
  has_more: boolean;
22
22
  items: T[];
23
+ next_url?: string;
23
24
  type: "list";
25
+ url: string;
24
26
  }
25
- export interface IAccountListOptions {
27
+ export interface ITenantListOptions {
26
28
  cursor?: string;
27
29
  limit?: string;
28
30
  }
29
- export interface ICourierClientAccounts {
31
+ export interface ICourierClientTenants {
30
32
  delete: (id: string) => Promise<void>;
31
- get: (id: string) => Promise<IAccount>;
32
- listAccounts: (options?: IAccountListOptions) => Promise<IPaginatedResult<IAccount>>;
33
- put: (account: Omit<IAccount, "type">) => Promise<IAccount>;
33
+ get: (id: string) => Promise<ITenant>;
34
+ listTenants: (options?: ITenantListOptions) => Promise<IPaginatedResult<ITenant>>;
35
+ put: (tenant: Omit<ITenant, "type">) => Promise<ITenant>;
34
36
  }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ICourierClientAccounts } from "./accounts/types";
2
1
  import { ICourierClientAudiences } from "./audiences/types";
3
2
  import { auditEvents } from "./audit-events";
4
3
  import { ICourierClientAutomations } from "./automations/types";
@@ -7,6 +6,7 @@ import { ICourierClientLists, ICourierList, ICourierRecipientSubscriptionsRespon
7
6
  import { ICourierClientNotifications } from "./notifications/types";
8
7
  import { ICourierClientPreferences, IRecipientPreferences } from "./preferences/types";
9
8
  import { Message } from "./send/types";
9
+ import { ICourierClientTenants } from "./tenants/types";
10
10
  import { tokenManagement } from "./token-management";
11
11
  import { users } from "./users";
12
12
  export interface IInitHttpClientOptions {
@@ -319,7 +319,7 @@ export interface ICourierBrandGetAllResponse {
319
319
  export declare type SendResponse<T extends ICourierSendParameters | ICourierSendMessageParameters> = T extends ICourierSendParameters ? ICourierSendResponse : ICourierSendMessageResponse;
320
320
  export interface ICourierClient {
321
321
  addRecipientToLists: (params: ICourierProfileListsPostParameters) => Promise<ICourierProfilePostResponse>;
322
- accounts: ICourierClientAccounts;
322
+ tenants: ICourierClientTenants;
323
323
  audiences: ICourierClientAudiences;
324
324
  auditEvents: ReturnType<typeof auditEvents>;
325
325
  automations: ICourierClientAutomations;
@@ -63,5 +63,5 @@ var putAccounts = function (options) {
63
63
  };
64
64
  exports.users = function (options) { return ({
65
65
  put: put(options),
66
- putAccounts: putAccounts(options),
66
+ putAccounts: putAccounts(options)
67
67
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier",
3
- "version": "4.8.0",
3
+ "version": "5.0.0",
4
4
  "description": "A node.js module for communicating with the Courier REST API.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,8 +0,0 @@
1
- import { ICourierClientConfiguration } from "../types";
2
- import * as AccountTypes from "./types";
3
- export declare const accounts: (options: ICourierClientConfiguration) => {
4
- delete: (accountId: string) => Promise<void>;
5
- get: (accountId: string) => Promise<AccountTypes.IAccount>;
6
- listAccounts: (listOptions?: AccountTypes.IAccountListOptions | undefined) => Promise<AccountTypes.IPaginatedResult<AccountTypes.IAccount>>;
7
- put: (account: Omit<AccountTypes.IAccount, "type">) => Promise<AccountTypes.IAccount>;
8
- };
File without changes