@prezly/sdk 21.6.0 → 21.7.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.
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "21.5.0";
7
+ const VERSION = "21.6.0";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = exports.DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -1,3 +1,3 @@
1
- const VERSION = "21.5.0";
1
+ const VERSION = "21.6.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createClient = createClient;
7
+ var _routing = require("../../routing.cjs");
8
+ function createClient(api) {
9
+ async function list() {
10
+ const url = _routing.routing.contactTagGroupsUrl;
11
+ const {
12
+ groups
13
+ } = await api.get(url);
14
+ return groups;
15
+ }
16
+ async function get(groupId) {
17
+ const url = _routing.routing.contactTagGroupsUrl;
18
+ const {
19
+ group
20
+ } = await api.get(`${url}/${groupId}`);
21
+ return group;
22
+ }
23
+ async function create(payload) {
24
+ const url = _routing.routing.contactTagGroupsUrl;
25
+ const {
26
+ group
27
+ } = await api.post(url, {
28
+ payload
29
+ });
30
+ return group;
31
+ }
32
+ async function update(groupId, payload) {
33
+ const url = _routing.routing.contactTagGroupsUrl;
34
+ const {
35
+ group
36
+ } = await api.patch(`${url}/${groupId}`, {
37
+ payload
38
+ });
39
+ return group;
40
+ }
41
+ async function addTags(groupId, payload) {
42
+ const url = _routing.routing.contactTagGroupsUrl;
43
+ const {
44
+ group
45
+ } = await api.patch(`${url}/${groupId}`, {
46
+ payload
47
+ });
48
+ return group;
49
+ }
50
+ async function doDelete(groupId) {
51
+ const url = _routing.routing.contactTagGroupsUrl;
52
+ return api.delete(`${url}/${groupId}`);
53
+ }
54
+ return {
55
+ list,
56
+ get,
57
+ create,
58
+ update,
59
+ addTags,
60
+ delete: doDelete
61
+ };
62
+ }
@@ -0,0 +1,14 @@
1
+ import type { DeferredJobsApiClient } from '../../api';
2
+ import type { ContactTagGroup } from '../../types';
3
+ import type { CreateRequest, UpdateRequest, AddTagsRequest } from './types';
4
+ type GroupId = ContactTagGroup['id'];
5
+ export type Client = ReturnType<typeof createClient>;
6
+ export declare function createClient(api: DeferredJobsApiClient): {
7
+ list: () => Promise<ContactTagGroup[]>;
8
+ get: (groupId: GroupId) => Promise<ContactTagGroup>;
9
+ create: (payload: CreateRequest) => Promise<ContactTagGroup>;
10
+ update: (groupId: GroupId, payload: UpdateRequest) => Promise<ContactTagGroup>;
11
+ addTags: (groupId: GroupId, payload: AddTagsRequest) => Promise<ContactTagGroup>;
12
+ delete: (groupId: GroupId) => Promise<void>;
13
+ };
14
+ export {};
@@ -0,0 +1,56 @@
1
+ import { routing } from "../../routing.js";
2
+ export function createClient(api) {
3
+ async function list() {
4
+ const url = routing.contactTagGroupsUrl;
5
+ const {
6
+ groups
7
+ } = await api.get(url);
8
+ return groups;
9
+ }
10
+ async function get(groupId) {
11
+ const url = routing.contactTagGroupsUrl;
12
+ const {
13
+ group
14
+ } = await api.get(`${url}/${groupId}`);
15
+ return group;
16
+ }
17
+ async function create(payload) {
18
+ const url = routing.contactTagGroupsUrl;
19
+ const {
20
+ group
21
+ } = await api.post(url, {
22
+ payload
23
+ });
24
+ return group;
25
+ }
26
+ async function update(groupId, payload) {
27
+ const url = routing.contactTagGroupsUrl;
28
+ const {
29
+ group
30
+ } = await api.patch(`${url}/${groupId}`, {
31
+ payload
32
+ });
33
+ return group;
34
+ }
35
+ async function addTags(groupId, payload) {
36
+ const url = routing.contactTagGroupsUrl;
37
+ const {
38
+ group
39
+ } = await api.patch(`${url}/${groupId}`, {
40
+ payload
41
+ });
42
+ return group;
43
+ }
44
+ async function doDelete(groupId) {
45
+ const url = routing.contactTagGroupsUrl;
46
+ return api.delete(`${url}/${groupId}`);
47
+ }
48
+ return {
49
+ list,
50
+ get,
51
+ create,
52
+ update,
53
+ addTags,
54
+ delete: doDelete
55
+ };
56
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Client = require("./Client.cjs");
7
+ Object.keys(_Client).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Client[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Client[key];
14
+ }
15
+ });
16
+ });
17
+ var _types = require("./types.cjs");
18
+ Object.keys(_types).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _types[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _types[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,2 @@
1
+ export * from './Client';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from "./Client.js";
2
+ export * from "./types.js";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Color = void 0;
7
+ let Color = exports.Color = /*#__PURE__*/function (Color) {
8
+ Color["RED"] = "red";
9
+ Color["PINK"] = "pink";
10
+ Color["ORANGE"] = "orange";
11
+ Color["YELLOW"] = "yellow";
12
+ Color["LIME"] = "lime";
13
+ Color["GREEN"] = "green";
14
+ Color["CYAN"] = "cyan";
15
+ Color["BLUE"] = "blue";
16
+ Color["INDIGO"] = "indigo";
17
+ Color["PURPLE"] = "purple";
18
+ return Color;
19
+ }({});
@@ -0,0 +1,25 @@
1
+ import type { ContactTag } from '../../types';
2
+ export declare enum Color {
3
+ RED = "red",
4
+ PINK = "pink",
5
+ ORANGE = "orange",
6
+ YELLOW = "yellow",
7
+ LIME = "lime",
8
+ GREEN = "green",
9
+ CYAN = "cyan",
10
+ BLUE = "blue",
11
+ INDIGO = "indigo",
12
+ PURPLE = "purple"
13
+ }
14
+ export interface CreateRequest {
15
+ name: string;
16
+ color: Color;
17
+ tags: ContactTag['id'][];
18
+ }
19
+ export interface UpdateRequest {
20
+ name?: string;
21
+ color?: Color;
22
+ }
23
+ export interface AddTagsRequest {
24
+ tags: ContactTag['id'][];
25
+ }
@@ -0,0 +1,13 @@
1
+ export let Color = /*#__PURE__*/function (Color) {
2
+ Color["RED"] = "red";
3
+ Color["PINK"] = "pink";
4
+ Color["ORANGE"] = "orange";
5
+ Color["YELLOW"] = "yellow";
6
+ Color["LIME"] = "lime";
7
+ Color["GREEN"] = "green";
8
+ Color["CYAN"] = "cyan";
9
+ Color["BLUE"] = "blue";
10
+ Color["INDIGO"] = "indigo";
11
+ Color["PURPLE"] = "purple";
12
+ return Color;
13
+ }({});
@@ -1,4 +1,4 @@
1
- import type { ContactTag, Query } from '../../types';
1
+ import type { ContactTag, ContactTagGroup, Query } from '../../types';
2
2
  import type { SortOrder } from '../../types';
3
3
  export interface ListOptions {
4
4
  sortOrder?: SortOrder | string;
@@ -12,6 +12,7 @@ export interface SearchOptions extends ListOptions {
12
12
  export type SearchResponse = ListResponse;
13
13
  export interface CreateRequest {
14
14
  name: string;
15
+ group?: ContactTagGroup['id'] | null;
15
16
  }
16
17
  export interface CreateOptions {
17
18
  force?: boolean;
@@ -22,6 +23,7 @@ export interface CreateResponse {
22
23
  }
23
24
  export interface UpdateRequest {
24
25
  name: string;
26
+ group?: ContactTagGroup['id'] | null;
25
27
  }
26
28
  export interface UpdateOptions {
27
29
  force?: boolean;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Subscriptions = exports.Stories = exports.Snippets = exports.SenderAddresses = exports.PricingTables = exports.NotificationSubscriptions = exports.Newsrooms = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomHub = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Contacts = exports.ContactTags = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
6
+ exports.Subscriptions = exports.Stories = exports.Snippets = exports.SenderAddresses = exports.PricingTables = exports.NotificationSubscriptions = exports.Newsrooms = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomHub = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Contacts = exports.ContactTags = exports.ContactTagGroups = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
7
7
  var _Accounts = _interopRequireWildcard(require("./Accounts/index.cjs"));
8
8
  exports.Accounts = _Accounts;
9
9
  var _Billing = _interopRequireWildcard(require("./Billing/index.cjs"));
@@ -12,6 +12,8 @@ var _CampaignRecipients = _interopRequireWildcard(require("./CampaignRecipients/
12
12
  exports.CampaignRecipients = _CampaignRecipients;
13
13
  var _Campaigns = _interopRequireWildcard(require("./Campaigns/index.cjs"));
14
14
  exports.Campaigns = _Campaigns;
15
+ var _ContactTagGroups = _interopRequireWildcard(require("./ContactTagGroups/index.cjs"));
16
+ exports.ContactTagGroups = _ContactTagGroups;
15
17
  var _ContactTags = _interopRequireWildcard(require("./ContactTags/index.cjs"));
16
18
  exports.ContactTags = _ContactTags;
17
19
  var _Contacts = _interopRequireWildcard(require("./Contacts/index.cjs"));
@@ -2,6 +2,7 @@ export * as Accounts from './Accounts';
2
2
  export * as Billing from './Billing';
3
3
  export * as CampaignRecipients from './CampaignRecipients';
4
4
  export * as Campaigns from './Campaigns';
5
+ export * as ContactTagGroups from './ContactTagGroups';
5
6
  export * as ContactTags from './ContactTags';
6
7
  export * as Contacts from './Contacts';
7
8
  export * as ContactsExports from './ContactsExports';
@@ -2,6 +2,7 @@ export * as Accounts from "./Accounts/index.js";
2
2
  export * as Billing from "./Billing/index.js";
3
3
  export * as CampaignRecipients from "./CampaignRecipients/index.js";
4
4
  export * as Campaigns from "./Campaigns/index.js";
5
+ export * as ContactTagGroups from "./ContactTagGroups/index.js";
5
6
  export * as ContactTags from "./ContactTags/index.js";
6
7
  export * as Contacts from "./Contacts/index.js";
7
8
  export * as ContactsExports from "./ContactsExports/index.js";
package/dist/routing.cjs CHANGED
@@ -11,6 +11,7 @@ const routing = exports.routing = {
11
11
  campaignRecipientsUrl: '/v2/campaigns/:campaign_id/recipients',
12
12
  contactsExportsUrl: '/v2/contacts/exports',
13
13
  contactsUrl: '/v2/contacts',
14
+ contactTagGroupsUrl: '/v2/contact-tag-groups',
14
15
  contactTagsUrl: '/v2/contact-tags',
15
16
  coverageUrl: '/v2/coverage',
16
17
  jobsUrl: '/v2/jobs',
package/dist/routing.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const routing: {
5
5
  campaignRecipientsUrl: string;
6
6
  contactsExportsUrl: string;
7
7
  contactsUrl: string;
8
+ contactTagGroupsUrl: string;
8
9
  contactTagsUrl: string;
9
10
  coverageUrl: string;
10
11
  jobsUrl: string;
package/dist/routing.js CHANGED
@@ -5,6 +5,7 @@ export const routing = {
5
5
  campaignRecipientsUrl: '/v2/campaigns/:campaign_id/recipients',
6
6
  contactsExportsUrl: '/v2/contacts/exports',
7
7
  contactsUrl: '/v2/contacts',
8
+ contactTagGroupsUrl: '/v2/contact-tag-groups',
8
9
  contactTagsUrl: '/v2/contact-tags',
9
10
  coverageUrl: '/v2/coverage',
10
11
  jobsUrl: '/v2/jobs',
@@ -1,3 +1,4 @@
1
+ import type { ContactTagGroupRef } from './ContactTagGroup';
1
2
  import type { UserRef } from './User';
2
3
  type Iso8601DateTime = string;
3
4
  export interface ContactTag {
@@ -10,6 +11,7 @@ export interface ContactTag {
10
11
  creator: UserRef | null;
11
12
  last_updated_by_user: UserRef | null;
12
13
  is_demo: boolean;
14
+ group: ContactTagGroupRef | null;
13
15
  }
14
16
  export declare namespace ContactTag {
15
17
  type Identifier = ContactTag['id'] | ContactTag['name'];
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,7 @@
1
+ export interface ContactTagGroupRef {
2
+ id: number;
3
+ name: string;
4
+ color: string;
5
+ }
6
+ export interface ContactTagGroup extends ContactTagGroupRef {
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -69,6 +69,17 @@ Object.keys(_ContactDuplicateSuggestion).forEach(function (key) {
69
69
  }
70
70
  });
71
71
  });
72
+ var _ContactTagGroup = require("./ContactTagGroup.cjs");
73
+ Object.keys(_ContactTagGroup).forEach(function (key) {
74
+ if (key === "default" || key === "__esModule") return;
75
+ if (key in exports && exports[key] === _ContactTagGroup[key]) return;
76
+ Object.defineProperty(exports, key, {
77
+ enumerable: true,
78
+ get: function () {
79
+ return _ContactTagGroup[key];
80
+ }
81
+ });
82
+ });
72
83
  var _ContactTag = require("./ContactTag.cjs");
73
84
  Object.keys(_ContactTag).forEach(function (key) {
74
85
  if (key === "default" || key === "__esModule") return;
@@ -4,6 +4,7 @@ export * from './Campaign';
4
4
  export * from './Category';
5
5
  export * from './Contact';
6
6
  export * from './ContactDuplicateSuggestion';
7
+ export * from './ContactTagGroup';
7
8
  export * from './ContactTag';
8
9
  export * from './ContactsBulkSelector';
9
10
  export * from './ContactsExport';
@@ -5,6 +5,7 @@ export * from "./Campaign.js";
5
5
  export * from "./Category.js";
6
6
  export * from "./Contact.js";
7
7
  export * from "./ContactDuplicateSuggestion.js";
8
+ export * from "./ContactTagGroup.js";
8
9
  export * from "./ContactTag.js";
9
10
  export * from "./ContactsBulkSelector.js";
10
11
  export * from "./ContactsExport.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "21.6.0",
3
+ "version": "21.7.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",