@prezly/sdk 20.3.0 → 20.5.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.
Files changed (100) hide show
  1. package/dist/Client.cjs +1 -0
  2. package/dist/Client.d.ts +2 -2
  3. package/dist/Client.js +2 -2
  4. package/dist/api/constants.cjs +1 -1
  5. package/dist/api/constants.js +1 -1
  6. package/dist/endpoints/Billing/types.cjs +6 -6
  7. package/dist/endpoints/Billing/types.js +6 -6
  8. package/dist/endpoints/ContactTags/Client.cjs +134 -0
  9. package/dist/endpoints/ContactTags/Client.d.ts +21 -0
  10. package/dist/endpoints/ContactTags/Client.js +126 -0
  11. package/dist/endpoints/ContactTags/index.cjs +27 -0
  12. package/dist/endpoints/ContactTags/index.d.ts +2 -0
  13. package/dist/endpoints/ContactTags/index.js +2 -0
  14. package/dist/endpoints/ContactTags/types.cjs +1 -0
  15. package/dist/endpoints/ContactTags/types.d.ts +40 -0
  16. package/dist/endpoints/ContactTags/types.js +1 -0
  17. package/dist/endpoints/Contacts/Client.cjs +2 -2
  18. package/dist/endpoints/Contacts/Client.d.ts +7 -10
  19. package/dist/endpoints/Contacts/Client.js +2 -2
  20. package/dist/endpoints/PricingTables/types.cjs +12 -12
  21. package/dist/endpoints/PricingTables/types.js +12 -12
  22. package/dist/endpoints/Stories/Client.d.ts +1 -1
  23. package/dist/endpoints/Subscriptions/types.cjs +3 -3
  24. package/dist/endpoints/Subscriptions/types.js +3 -3
  25. package/dist/endpoints/index.cjs +3 -1
  26. package/dist/endpoints/index.d.ts +1 -0
  27. package/dist/endpoints/index.js +1 -0
  28. package/dist/http/types.cjs +6 -6
  29. package/dist/http/types.js +6 -6
  30. package/dist/routing.cjs +1 -0
  31. package/dist/routing.d.ts +1 -0
  32. package/dist/routing.js +1 -0
  33. package/dist/types/BillingCycle.cjs +3 -3
  34. package/dist/types/BillingCycle.js +3 -3
  35. package/dist/types/Campaign.cjs +18 -18
  36. package/dist/types/Campaign.js +18 -18
  37. package/dist/types/Category.cjs +1 -0
  38. package/dist/types/Category.js +1 -0
  39. package/dist/types/Contact.cjs +18 -18
  40. package/dist/types/Contact.js +18 -18
  41. package/dist/types/ContactDuplicateSuggestion.cjs +3 -3
  42. package/dist/types/ContactDuplicateSuggestion.js +4 -3
  43. package/dist/types/ContactTag.cjs +8 -0
  44. package/dist/types/ContactTag.d.ts +16 -0
  45. package/dist/types/ContactTag.js +2 -0
  46. package/dist/types/ContactsExport.cjs +3 -3
  47. package/dist/types/ContactsExport.js +3 -3
  48. package/dist/types/ContactsScope.cjs +3 -3
  49. package/dist/types/ContactsScope.js +3 -3
  50. package/dist/types/CoverageEntry.cjs +6 -6
  51. package/dist/types/CoverageEntry.js +6 -6
  52. package/dist/types/Culture.cjs +3 -3
  53. package/dist/types/Culture.js +3 -3
  54. package/dist/types/Currency.cjs +3 -3
  55. package/dist/types/Currency.js +3 -3
  56. package/dist/types/EmailRecipient.cjs +3 -3
  57. package/dist/types/EmailRecipient.js +3 -3
  58. package/dist/types/JobState.cjs +3 -3
  59. package/dist/types/JobState.js +3 -3
  60. package/dist/types/License.cjs +9 -9
  61. package/dist/types/License.js +9 -9
  62. package/dist/types/Newsroom.cjs +12 -12
  63. package/dist/types/Newsroom.js +12 -12
  64. package/dist/types/NewsroomDomain.cjs +6 -6
  65. package/dist/types/NewsroomDomain.js +6 -6
  66. package/dist/types/NewsroomGallery.cjs +6 -6
  67. package/dist/types/NewsroomGallery.js +6 -6
  68. package/dist/types/NewsroomTheme.cjs +8 -7
  69. package/dist/types/NewsroomTheme.js +8 -7
  70. package/dist/types/NewsroomWebhook.cjs +3 -3
  71. package/dist/types/NewsroomWebhook.js +3 -3
  72. package/dist/types/NotificationSubscription.cjs +3 -3
  73. package/dist/types/NotificationSubscription.js +3 -3
  74. package/dist/types/Permissions.cjs +3 -3
  75. package/dist/types/Permissions.js +3 -3
  76. package/dist/types/Plan.cjs +7 -7
  77. package/dist/types/Plan.js +8 -8
  78. package/dist/types/PrivacyRequest.cjs +6 -6
  79. package/dist/types/PrivacyRequest.js +6 -6
  80. package/dist/types/SenderAddress.cjs +3 -3
  81. package/dist/types/SenderAddress.js +3 -3
  82. package/dist/types/SenderDomain.cjs +3 -3
  83. package/dist/types/SenderDomain.js +3 -3
  84. package/dist/types/SortOrder.cjs +3 -3
  85. package/dist/types/SortOrder.js +3 -3
  86. package/dist/types/Story.cjs +12 -12
  87. package/dist/types/Story.js +12 -12
  88. package/dist/types/User.cjs +6 -6
  89. package/dist/types/User.js +6 -6
  90. package/dist/types/common/Notification.cjs +3 -3
  91. package/dist/types/common/Notification.js +3 -3
  92. package/dist/types/common/OEmbedInfo.cjs +3 -3
  93. package/dist/types/common/OEmbedInfo.js +3 -3
  94. package/dist/types/common/Pagination.cjs +3 -3
  95. package/dist/types/common/Pagination.js +3 -3
  96. package/dist/types/common/Query.js +1 -0
  97. package/dist/types/index.cjs +11 -0
  98. package/dist/types/index.d.ts +1 -0
  99. package/dist/types/index.js +1 -0
  100. package/package.json +1 -1
package/dist/Client.cjs CHANGED
@@ -29,6 +29,7 @@ function createClient({
29
29
  campaigns: _index2.Campaigns.createClient(api),
30
30
  campaignRecipients: _index2.CampaignRecipients.createClient(api),
31
31
  contacts: _index2.Contacts.createClient(api),
32
+ contactTags: _index2.ContactTags.createClient(api),
32
33
  contactsExports: _index2.ContactsExports.createClient(api),
33
34
  coverage: _index2.Coverage.createClient(api),
34
35
  jobs: _index2.Jobs.createClient(api),
package/dist/Client.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { DeferredJobsApiClient } from './api';
2
2
  import { type Fetch } from './api';
3
- import { Contacts } from './endpoints';
4
- import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
3
+ import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, Contacts, ContactTags, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
5
4
  import type { HeadersMap } from './http';
6
5
  export interface ClientOptions {
7
6
  accessToken: string;
@@ -16,6 +15,7 @@ export interface Client {
16
15
  campaigns: Campaigns.Client;
17
16
  campaignRecipients: CampaignRecipients.Client;
18
17
  contacts: Contacts.Client;
18
+ contactTags: ContactTags.Client;
19
19
  contactsExports: ContactsExports.Client;
20
20
  coverage: Coverage.Client;
21
21
  jobs: Jobs.Client;
package/dist/Client.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { createApiClient, createDeferredJobsApiClient } from "./api/index.js";
2
- import { Contacts } from "./endpoints/index.js";
3
- import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
2
+ import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, Contacts, ContactTags, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
4
3
  import { createHttpClient } from "./http/index.js";
5
4
  const DEFAULT_BASE_URL = 'https://api.prezly.com';
6
5
  export function createClient({
@@ -24,6 +23,7 @@ export function createClient({
24
23
  campaigns: Campaigns.createClient(api),
25
24
  campaignRecipients: CampaignRecipients.createClient(api),
26
25
  contacts: Contacts.createClient(api),
26
+ contactTags: ContactTags.createClient(api),
27
27
  contactsExports: ContactsExports.createClient(api),
28
28
  coverage: Coverage.createClient(api),
29
29
  jobs: Jobs.createClient(api),
@@ -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 = "20.2.0";
7
+ const VERSION = "20.4.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 = "20.2.0";
1
+ const VERSION = "20.4.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SignupPlan = exports.SignupCurrency = void 0;
7
- let SignupPlan = exports.SignupPlan = /*#__PURE__*/function (SignupPlan) {
7
+ let SignupPlan = exports.SignupPlan = void 0;
8
+ (function (SignupPlan) {
8
9
  SignupPlan["STARTER"] = "starter";
9
10
  SignupPlan["CORE"] = "core";
10
11
  SignupPlan["PREMIUM"] = "premium";
11
- return SignupPlan;
12
- }({});
13
- let SignupCurrency = exports.SignupCurrency = /*#__PURE__*/function (SignupCurrency) {
12
+ })(SignupPlan || (exports.SignupPlan = SignupPlan = {}));
13
+ let SignupCurrency = exports.SignupCurrency = void 0;
14
+ (function (SignupCurrency) {
14
15
  SignupCurrency["EUR"] = "eur";
15
16
  SignupCurrency["USD"] = "usd";
16
- return SignupCurrency;
17
- }({});
17
+ })(SignupCurrency || (exports.SignupCurrency = SignupCurrency = {}));
@@ -1,11 +1,11 @@
1
- export let SignupPlan = /*#__PURE__*/function (SignupPlan) {
1
+ export let SignupPlan;
2
+ (function (SignupPlan) {
2
3
  SignupPlan["STARTER"] = "starter";
3
4
  SignupPlan["CORE"] = "core";
4
5
  SignupPlan["PREMIUM"] = "premium";
5
- return SignupPlan;
6
- }({});
7
- export let SignupCurrency = /*#__PURE__*/function (SignupCurrency) {
6
+ })(SignupPlan || (SignupPlan = {}));
7
+ export let SignupCurrency;
8
+ (function (SignupCurrency) {
8
9
  SignupCurrency["EUR"] = "eur";
9
10
  SignupCurrency["USD"] = "usd";
10
- return SignupCurrency;
11
- }({});
11
+ })(SignupCurrency || (SignupCurrency = {}));
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createClient = createClient;
7
+ var _routing = require("../../routing.cjs");
8
+ var _index = require("../../types/index.cjs");
9
+ // Not putting these into the `./types` module to keep it local.
10
+
11
+ function createClient(api) {
12
+ async function list(options = {}) {
13
+ const {
14
+ sortOrder
15
+ } = options;
16
+ const {
17
+ tags
18
+ } = await api.get(_routing.routing.contactsTagsUrl, {
19
+ query: {
20
+ sort: _index.SortOrder.stringify(sortOrder)
21
+ }
22
+ });
23
+ return {
24
+ tags
25
+ };
26
+ }
27
+ async function search(options = {}) {
28
+ const {
29
+ query,
30
+ sortOrder
31
+ } = options;
32
+ const {
33
+ tags
34
+ } = await api.post(_routing.routing.contactsTagsUrl, {
35
+ query: {
36
+ sort: _index.SortOrder.stringify(sortOrder),
37
+ query: _index.Query.stringify(query)
38
+ }
39
+ });
40
+ return {
41
+ tags
42
+ };
43
+ }
44
+ async function get(id) {
45
+ const url = `${_routing.routing.contactsTagsUrl}/${id}`;
46
+ const {
47
+ tag
48
+ } = await api.get(url);
49
+ return tag;
50
+ }
51
+ async function create(payload, {
52
+ force = false
53
+ } = {}) {
54
+ const data = await api.post(_routing.routing.contactsTagsUrl, {
55
+ payload,
56
+ query: {
57
+ force: force || undefined // Convert `false` to `undefined`
58
+ }
59
+ });
60
+ return {
61
+ tag: data.tag,
62
+ deleted: data.deleted_tags_ids
63
+ };
64
+ }
65
+ async function update(id, payload, {
66
+ force = false
67
+ } = {}) {
68
+ const url = `${_routing.routing.contactsTagsUrl}/${id}`;
69
+ const data = await api.patch(url, {
70
+ payload,
71
+ query: {
72
+ force: force || undefined // Convert `false` to `undefined`
73
+ }
74
+ });
75
+ return {
76
+ tag: data.tag,
77
+ deleted: data.deleted_tags_ids
78
+ };
79
+ }
80
+ async function merge({
81
+ name,
82
+ tags
83
+ }) {
84
+ const url = `${_routing.routing.contactsTagsUrl}/merge`;
85
+ const data = await api.post(url, {
86
+ payload: {
87
+ name,
88
+ tags
89
+ }
90
+ });
91
+ return {
92
+ tag: data.tag,
93
+ deleted: data.deleted_tags_ids
94
+ };
95
+ }
96
+ async function doDelete(id) {
97
+ const url = `${_routing.routing.contactsTagsUrl}/${id}`;
98
+ const data = await api.delete(url);
99
+ return {
100
+ deleted: data.deleted_tags_ids
101
+ };
102
+ }
103
+ async function doDeleteMany(ids) {
104
+ const data = await api.delete(_routing.routing.contactsTagsUrl, {
105
+ query: {
106
+ id: ids
107
+ }
108
+ });
109
+ return {
110
+ deleted: data.deleted_tags_ids
111
+ };
112
+ }
113
+ async function doDeleteUnused() {
114
+ const data = await api.delete(_routing.routing.contactsTagsUrl, {
115
+ query: {
116
+ filter: 'unused'
117
+ }
118
+ });
119
+ return {
120
+ deleted: data.deleted_tags_ids
121
+ };
122
+ }
123
+ return {
124
+ list,
125
+ search,
126
+ get,
127
+ create,
128
+ update,
129
+ merge,
130
+ delete: doDelete,
131
+ deleteMany: doDeleteMany,
132
+ deleteUnused: doDeleteUnused
133
+ };
134
+ }
@@ -0,0 +1,21 @@
1
+ import type { DeferredJobsApiClient } from '../../api';
2
+ import { type Contact, type ContactTag } from '../../types';
3
+ import type { CreateOptions, CreateRequest, CreateResponse, ListOptions, ListResponse, MergeRequest, MergeResponse, SearchOptions, SearchResponse, UpdateOptions, UpdateRequest, UpdateResponse } from './types';
4
+ export type Client = ReturnType<typeof createClient>;
5
+ export declare function createClient(api: DeferredJobsApiClient): {
6
+ list: (options?: ListOptions) => Promise<ListResponse>;
7
+ search: (options?: SearchOptions) => Promise<SearchResponse>;
8
+ get: (id: ContactTag['id']) => Promise<ContactTag>;
9
+ create: (payload: CreateRequest, { force }?: CreateOptions) => Promise<CreateResponse>;
10
+ update: (id: Contact['id'], payload: UpdateRequest, { force }?: UpdateOptions) => Promise<UpdateResponse>;
11
+ merge: ({ name, tags }: MergeRequest) => Promise<MergeResponse>;
12
+ delete: (id: ContactTag['id']) => Promise<{
13
+ deleted: number[];
14
+ }>;
15
+ deleteMany: (ids: ContactTag['id'][]) => Promise<{
16
+ deleted: number[];
17
+ }>;
18
+ deleteUnused: () => Promise<{
19
+ deleted: number[];
20
+ }>;
21
+ };
@@ -0,0 +1,126 @@
1
+ import { routing } from "../../routing.js";
2
+ import { Query, SortOrder } from "../../types/index.js"; // Not putting these into the `./types` module to keep it local.
3
+ export function createClient(api) {
4
+ async function list(options = {}) {
5
+ const {
6
+ sortOrder
7
+ } = options;
8
+ const {
9
+ tags
10
+ } = await api.get(routing.contactsTagsUrl, {
11
+ query: {
12
+ sort: SortOrder.stringify(sortOrder)
13
+ }
14
+ });
15
+ return {
16
+ tags
17
+ };
18
+ }
19
+ async function search(options = {}) {
20
+ const {
21
+ query,
22
+ sortOrder
23
+ } = options;
24
+ const {
25
+ tags
26
+ } = await api.post(routing.contactsTagsUrl, {
27
+ query: {
28
+ sort: SortOrder.stringify(sortOrder),
29
+ query: Query.stringify(query)
30
+ }
31
+ });
32
+ return {
33
+ tags
34
+ };
35
+ }
36
+ async function get(id) {
37
+ const url = `${routing.contactsTagsUrl}/${id}`;
38
+ const {
39
+ tag
40
+ } = await api.get(url);
41
+ return tag;
42
+ }
43
+ async function create(payload, {
44
+ force = false
45
+ } = {}) {
46
+ const data = await api.post(routing.contactsTagsUrl, {
47
+ payload,
48
+ query: {
49
+ force: force || undefined // Convert `false` to `undefined`
50
+ }
51
+ });
52
+ return {
53
+ tag: data.tag,
54
+ deleted: data.deleted_tags_ids
55
+ };
56
+ }
57
+ async function update(id, payload, {
58
+ force = false
59
+ } = {}) {
60
+ const url = `${routing.contactsTagsUrl}/${id}`;
61
+ const data = await api.patch(url, {
62
+ payload,
63
+ query: {
64
+ force: force || undefined // Convert `false` to `undefined`
65
+ }
66
+ });
67
+ return {
68
+ tag: data.tag,
69
+ deleted: data.deleted_tags_ids
70
+ };
71
+ }
72
+ async function merge({
73
+ name,
74
+ tags
75
+ }) {
76
+ const url = `${routing.contactsTagsUrl}/merge`;
77
+ const data = await api.post(url, {
78
+ payload: {
79
+ name,
80
+ tags
81
+ }
82
+ });
83
+ return {
84
+ tag: data.tag,
85
+ deleted: data.deleted_tags_ids
86
+ };
87
+ }
88
+ async function doDelete(id) {
89
+ const url = `${routing.contactsTagsUrl}/${id}`;
90
+ const data = await api.delete(url);
91
+ return {
92
+ deleted: data.deleted_tags_ids
93
+ };
94
+ }
95
+ async function doDeleteMany(ids) {
96
+ const data = await api.delete(routing.contactsTagsUrl, {
97
+ query: {
98
+ id: ids
99
+ }
100
+ });
101
+ return {
102
+ deleted: data.deleted_tags_ids
103
+ };
104
+ }
105
+ async function doDeleteUnused() {
106
+ const data = await api.delete(routing.contactsTagsUrl, {
107
+ query: {
108
+ filter: 'unused'
109
+ }
110
+ });
111
+ return {
112
+ deleted: data.deleted_tags_ids
113
+ };
114
+ }
115
+ return {
116
+ list,
117
+ search,
118
+ get,
119
+ create,
120
+ update,
121
+ merge,
122
+ delete: doDelete,
123
+ deleteMany: doDeleteMany,
124
+ deleteUnused: doDeleteUnused
125
+ };
126
+ }
@@ -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 @@
1
+ "use strict";
@@ -0,0 +1,40 @@
1
+ import type { ContactTag, Query } from '../../types';
2
+ import type { SortOrder } from '../../types';
3
+ export interface ListOptions {
4
+ sortOrder?: SortOrder | string;
5
+ }
6
+ export interface ListResponse {
7
+ tags: ContactTag[];
8
+ }
9
+ export interface SearchOptions extends ListOptions {
10
+ query?: Query;
11
+ }
12
+ export type SearchResponse = ListResponse;
13
+ export interface CreateRequest {
14
+ name: string;
15
+ }
16
+ export interface CreateOptions {
17
+ force?: boolean;
18
+ }
19
+ export interface CreateResponse {
20
+ tag: ContactTag;
21
+ deleted: ContactTag['id'][];
22
+ }
23
+ export interface UpdateRequest {
24
+ name: string;
25
+ }
26
+ export interface UpdateOptions {
27
+ force?: boolean;
28
+ }
29
+ export interface UpdateResponse {
30
+ tag: ContactTag;
31
+ deleted: ContactTag['id'][];
32
+ }
33
+ export interface MergeRequest {
34
+ name: string;
35
+ tags: ContactTag.Identifier[];
36
+ }
37
+ export interface MergeResponse {
38
+ tag: ContactTag;
39
+ deleted: ContactTag['id'][];
40
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -10,7 +10,7 @@ function createClient(api) {
10
10
  /**
11
11
  * List Contacts Exports with sorting, and pagination.
12
12
  */
13
- async function list(options) {
13
+ async function list(options = {}) {
14
14
  const {
15
15
  limit,
16
16
  offset,
@@ -37,7 +37,7 @@ function createClient(api) {
37
37
  /**
38
38
  * List Contacts Exports with sorting, pagination, and filtering.
39
39
  */
40
- async function search(options) {
40
+ async function search(options = {}) {
41
41
  const {
42
42
  limit,
43
43
  offset,
@@ -1,22 +1,19 @@
1
1
  import type { ProgressPromise } from '@prezly/progress-promise';
2
2
  import type { DeferredJobsApiClient } from '../../api';
3
- import type { Contact } from '../../types';
3
+ import type { ContactTag, Contact } from '../../types';
4
4
  import type { BulkDeleteResponse, BulkSelector, CreateRequest, ListOptions, ListResponse, SearchOptions, SearchResponse, UpdateRequest } from './types';
5
- type TagId = number;
6
- type TagName = string;
7
5
  export type Client = ReturnType<typeof createClient>;
8
6
  export declare function createClient(api: DeferredJobsApiClient): {
9
- list: (options: ListOptions) => Promise<ListResponse>;
10
- search: (options: SearchOptions) => Promise<SearchResponse>;
7
+ list: (options?: ListOptions) => Promise<ListResponse>;
8
+ search: (options?: SearchOptions) => Promise<SearchResponse>;
11
9
  get: (id: Contact['id']) => Promise<Contact>;
12
10
  getMany: (ids: Contact['id'][]) => Promise<Contact[]>;
13
11
  create: (payload: CreateRequest) => Promise<Contact>;
14
12
  update: (id: Contact['id'], payload: UpdateRequest) => Promise<Contact>;
15
- tag: (id: Contact['id'], tags: (TagId | TagName)[]) => Promise<Contact>;
16
- untag: (id: Contact['id'], tags: (TagId | TagName)[]) => Promise<Contact>;
17
- bulkTag: (selector: BulkSelector, tags: (TagId | TagName)[]) => ProgressPromise<undefined>;
18
- bulkUntag: (selector: BulkSelector, tags: (TagId | TagName)[]) => ProgressPromise<undefined>;
13
+ tag: (id: Contact['id'], tags: ContactTag.Identifier[]) => Promise<Contact>;
14
+ untag: (id: Contact['id'], tags: ContactTag.Identifier[]) => Promise<Contact>;
15
+ bulkTag: (selector: BulkSelector, tags: ContactTag.Identifier[]) => ProgressPromise<undefined>;
16
+ bulkUntag: (selector: BulkSelector, tags: ContactTag.Identifier[]) => ProgressPromise<undefined>;
19
17
  delete: (id: Contact['id']) => Promise<void>;
20
18
  bulkDelete: (selector: BulkSelector) => Promise<BulkDeleteResponse>;
21
19
  };
22
- export {};
@@ -4,7 +4,7 @@ export function createClient(api) {
4
4
  /**
5
5
  * List Contacts Exports with sorting, and pagination.
6
6
  */
7
- async function list(options) {
7
+ async function list(options = {}) {
8
8
  const {
9
9
  limit,
10
10
  offset,
@@ -31,7 +31,7 @@ export function createClient(api) {
31
31
  /**
32
32
  * List Contacts Exports with sorting, pagination, and filtering.
33
33
  */
34
- async function search(options) {
34
+ async function search(options = {}) {
35
35
  const {
36
36
  limit,
37
37
  offset,
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TableId = exports.OptionId = exports.LimitId = exports.AddOnId = void 0;
7
- let TableId = exports.TableId = /*#__PURE__*/function (TableId) {
7
+ let TableId = exports.TableId = void 0;
8
+ (function (TableId) {
8
9
  TableId["STANDARD"] = "standard";
9
10
  TableId["AGENCY"] = "agency";
10
- return TableId;
11
- }({});
12
- let OptionId = exports.OptionId = /*#__PURE__*/function (OptionId) {
11
+ })(TableId || (exports.TableId = TableId = {}));
12
+ let OptionId = exports.OptionId = void 0;
13
+ (function (OptionId) {
13
14
  OptionId["STARTER"] = "starter";
14
15
  OptionId["CORE"] = "core";
15
16
  OptionId["PREMIUM"] = "premium";
@@ -18,18 +19,17 @@ let OptionId = exports.OptionId = /*#__PURE__*/function (OptionId) {
18
19
  OptionId["AGENCY_MEDIUM"] = "agency_medium";
19
20
  OptionId["AGENCY_LARGE"] = "agency_large";
20
21
  OptionId["AGENCY_HUGE"] = "agency_huge";
21
- return OptionId;
22
- }({});
23
- let LimitId = exports.LimitId = /*#__PURE__*/function (LimitId) {
22
+ })(OptionId || (exports.OptionId = OptionId = {}));
23
+ let LimitId = exports.LimitId = void 0;
24
+ (function (LimitId) {
24
25
  LimitId["STORIES"] = "stories";
25
26
  LimitId["USERS"] = "users";
26
27
  LimitId["SITES"] = "sites";
27
28
  LimitId["CONTACTS"] = "contacts";
28
29
  LimitId["EMAIL_SENDS"] = "email_sends";
29
30
  LimitId["CUSTOM_SENDER_ADDRESSES"] = "custom_sender_addresses";
30
- return LimitId;
31
- }({});
32
- let AddOnId = exports.AddOnId = /*#__PURE__*/function (AddOnId) {
31
+ })(LimitId || (exports.LimitId = LimitId = {}));
32
+ let AddOnId = exports.AddOnId = void 0;
33
+ (function (AddOnId) {
33
34
  AddOnId["SITE"] = "site";
34
- return AddOnId;
35
- }({});
35
+ })(AddOnId || (exports.AddOnId = AddOnId = {}));
@@ -1,9 +1,10 @@
1
- export let TableId = /*#__PURE__*/function (TableId) {
1
+ export let TableId;
2
+ (function (TableId) {
2
3
  TableId["STANDARD"] = "standard";
3
4
  TableId["AGENCY"] = "agency";
4
- return TableId;
5
- }({});
6
- export let OptionId = /*#__PURE__*/function (OptionId) {
5
+ })(TableId || (TableId = {}));
6
+ export let OptionId;
7
+ (function (OptionId) {
7
8
  OptionId["STARTER"] = "starter";
8
9
  OptionId["CORE"] = "core";
9
10
  OptionId["PREMIUM"] = "premium";
@@ -12,18 +13,17 @@ export let OptionId = /*#__PURE__*/function (OptionId) {
12
13
  OptionId["AGENCY_MEDIUM"] = "agency_medium";
13
14
  OptionId["AGENCY_LARGE"] = "agency_large";
14
15
  OptionId["AGENCY_HUGE"] = "agency_huge";
15
- return OptionId;
16
- }({});
17
- export let LimitId = /*#__PURE__*/function (LimitId) {
16
+ })(OptionId || (OptionId = {}));
17
+ export let LimitId;
18
+ (function (LimitId) {
18
19
  LimitId["STORIES"] = "stories";
19
20
  LimitId["USERS"] = "users";
20
21
  LimitId["SITES"] = "sites";
21
22
  LimitId["CONTACTS"] = "contacts";
22
23
  LimitId["EMAIL_SENDS"] = "email_sends";
23
24
  LimitId["CUSTOM_SENDER_ADDRESSES"] = "custom_sender_addresses";
24
- return LimitId;
25
- }({});
26
- export let AddOnId = /*#__PURE__*/function (AddOnId) {
25
+ })(LimitId || (LimitId = {}));
26
+ export let AddOnId;
27
+ (function (AddOnId) {
27
28
  AddOnId["SITE"] = "site";
28
- return AddOnId;
29
- }({});
29
+ })(AddOnId || (AddOnId = {}));
@@ -14,7 +14,7 @@ type Exactly<Concrete, Abstract> = Concrete & Record<Exclude<keyof Concrete, key
14
14
  type InferExtraFields<T> = T extends Required<IncludeOptions<infer I>> ? Pick<Story.ExtraFields, I> : unknown;
15
15
  export type Client = ReturnType<typeof createClient>;
16
16
  export declare function createClient(api: DeferredJobsApiClient): {
17
- list: <Options extends ListOptions<keyof Story.ExtraFields>>(options?: Exactly<Options, ListOptions>) => Promise<ListResponse<Story & InferExtraFields<Options>>>;
17
+ list: <Options extends ListOptions<keyof Story.ExtraFields>>(options?: Exactly<Options, ListOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options>>>;
18
18
  search: <Options_1 extends SearchOptions<keyof Story.ExtraFields>>(options?: Exactly<Options_1, SearchOptions<keyof Story.ExtraFields>> | undefined) => Promise<ListResponse<Story & InferExtraFields<Options_1>>>;
19
19
  get: {
20
20
  <Options_2 extends IncludeOptions<keyof Story.ExtraFields> & {
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.UnsubscribeReason = void 0;
7
- let UnsubscribeReason = exports.UnsubscribeReason = /*#__PURE__*/function (UnsubscribeReason) {
7
+ let UnsubscribeReason = exports.UnsubscribeReason = void 0;
8
+ (function (UnsubscribeReason) {
8
9
  UnsubscribeReason["UNKNOWN"] = "unknown";
9
10
  UnsubscribeReason["UNWANTED"] = "unwanted";
10
11
  UnsubscribeReason["SPAM"] = "spam";
11
12
  UnsubscribeReason["NEVER_SIGNED_UP"] = "never_signed_up";
12
13
  UnsubscribeReason["OTHER"] = "other";
13
- return UnsubscribeReason;
14
- }({});
14
+ })(UnsubscribeReason || (exports.UnsubscribeReason = UnsubscribeReason = {}));
@@ -1,8 +1,8 @@
1
- export let UnsubscribeReason = /*#__PURE__*/function (UnsubscribeReason) {
1
+ export let UnsubscribeReason;
2
+ (function (UnsubscribeReason) {
2
3
  UnsubscribeReason["UNKNOWN"] = "unknown";
3
4
  UnsubscribeReason["UNWANTED"] = "unwanted";
4
5
  UnsubscribeReason["SPAM"] = "spam";
5
6
  UnsubscribeReason["NEVER_SIGNED_UP"] = "never_signed_up";
6
7
  UnsubscribeReason["OTHER"] = "other";
7
- return UnsubscribeReason;
8
- }({});
8
+ })(UnsubscribeReason || (UnsubscribeReason = {}));