@prezly/sdk 11.7.1 → 11.8.1-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/dist/Client.cjs +45 -0
- package/dist/api/ApiClient.cjs +95 -0
- package/dist/api/DeferredJobsApiClient.cjs +99 -0
- package/dist/api/constants.cjs +10 -0
- package/dist/api/constants.js +1 -1
- package/dist/api/index.cjs +19 -0
- package/dist/endpoints/Accounts/Client.cjs +29 -0
- package/dist/endpoints/Accounts/index.cjs +25 -0
- package/dist/endpoints/Accounts/types.cjs +1 -0
- package/dist/endpoints/Billing/Client.cjs +19 -0
- package/dist/endpoints/Billing/index.cjs +25 -0
- package/dist/endpoints/Billing/types.cjs +25 -0
- package/dist/endpoints/CampaignRecipients/Client.cjs +85 -0
- package/dist/endpoints/CampaignRecipients/index.cjs +37 -0
- package/dist/endpoints/CampaignRecipients/types.cjs +1 -0
- package/dist/endpoints/Campaigns/Client.cjs +92 -0
- package/dist/endpoints/Campaigns/index.cjs +25 -0
- package/dist/endpoints/Campaigns/types.cjs +1 -0
- package/dist/endpoints/ContactsExports/Client.cjs +98 -0
- package/dist/endpoints/ContactsExports/index.cjs +37 -0
- package/dist/endpoints/ContactsExports/types.cjs +1 -0
- package/dist/endpoints/Coverage/Client.cjs +109 -0
- package/dist/endpoints/Coverage/index.cjs +25 -0
- package/dist/endpoints/Coverage/types.cjs +1 -0
- package/dist/endpoints/Jobs/Client.cjs +19 -0
- package/dist/endpoints/Jobs/index.cjs +25 -0
- package/dist/endpoints/Jobs/types.cjs +1 -0
- package/dist/endpoints/Licenses/Client.cjs +20 -0
- package/dist/endpoints/Licenses/index.cjs +15 -0
- package/dist/endpoints/NewsroomCategories/Client.cjs +55 -0
- package/dist/endpoints/NewsroomCategories/index.cjs +25 -0
- package/dist/endpoints/NewsroomCategories/types.cjs +1 -0
- package/dist/endpoints/NewsroomContacts/Client.cjs +76 -0
- package/dist/endpoints/NewsroomContacts/index.cjs +25 -0
- package/dist/endpoints/NewsroomContacts/types.cjs +1 -0
- package/dist/endpoints/NewsroomDomains/Client.cjs +48 -0
- package/dist/endpoints/NewsroomDomains/index.cjs +25 -0
- package/dist/endpoints/NewsroomDomains/types.cjs +1 -0
- package/dist/endpoints/NewsroomGalleries/Client.cjs +82 -0
- package/dist/endpoints/NewsroomGalleries/index.cjs +25 -0
- package/dist/endpoints/NewsroomGalleries/types.cjs +1 -0
- package/dist/endpoints/NewsroomLanguages/Client.cjs +100 -0
- package/dist/endpoints/NewsroomLanguages/index.cjs +25 -0
- package/dist/endpoints/NewsroomLanguages/lib.cjs +9 -0
- package/dist/endpoints/NewsroomLanguages/types.cjs +1 -0
- package/dist/endpoints/NewsroomPrivacyRequests/Client.cjs +29 -0
- package/dist/endpoints/NewsroomPrivacyRequests/index.cjs +25 -0
- package/dist/endpoints/NewsroomPrivacyRequests/types.cjs +1 -0
- package/dist/endpoints/NewsroomSubscriptions/Client.cjs +22 -0
- package/dist/endpoints/NewsroomSubscriptions/index.cjs +25 -0
- package/dist/endpoints/NewsroomSubscriptions/types.cjs +1 -0
- package/dist/endpoints/NewsroomThemes/Client.cjs +43 -0
- package/dist/endpoints/NewsroomThemes/index.cjs +15 -0
- package/dist/endpoints/NewsroomWebhooks/Client.cjs +49 -0
- package/dist/endpoints/NewsroomWebhooks/index.cjs +25 -0
- package/dist/endpoints/NewsroomWebhooks/types.cjs +1 -0
- package/dist/endpoints/Newsrooms/Client.cjs +97 -0
- package/dist/endpoints/Newsrooms/index.cjs +25 -0
- package/dist/endpoints/Newsrooms/types.cjs +1 -0
- package/dist/endpoints/NotificationSubscriptions/Client.cjs +29 -0
- package/dist/endpoints/NotificationSubscriptions/index.cjs +25 -0
- package/dist/endpoints/NotificationSubscriptions/types.cjs +1 -0
- package/dist/endpoints/SenderAddresses/Client.cjs +44 -0
- package/dist/endpoints/SenderAddresses/index.cjs +25 -0
- package/dist/endpoints/SenderAddresses/types.cjs +1 -0
- package/dist/endpoints/Signup/Client.cjs +21 -0
- package/dist/endpoints/Signup/index.cjs +25 -0
- package/dist/endpoints/Signup/types.cjs +12 -0
- package/dist/endpoints/Snippets/Client.cjs +49 -0
- package/dist/endpoints/Snippets/index.cjs +25 -0
- package/dist/endpoints/Snippets/types.cjs +1 -0
- package/dist/endpoints/Stories/Client.cjs +291 -0
- package/dist/endpoints/Stories/index.cjs +35 -0
- package/dist/endpoints/Stories/scopes.cjs +15 -0
- package/dist/endpoints/Stories/types.cjs +51 -0
- package/dist/endpoints/Stories/types.d.ts +5 -0
- package/dist/endpoints/Subscriptions/Client.cjs +58 -0
- package/dist/endpoints/Subscriptions/index.cjs +25 -0
- package/dist/endpoints/Subscriptions/types.cjs +15 -0
- package/dist/endpoints/index.cjs +56 -0
- package/dist/http/ApiError.cjs +21 -0
- package/dist/http/Http.cjs +69 -0
- package/dist/http/constants.cjs +12 -0
- package/dist/http/createRequest.cjs +106 -0
- package/dist/http/index.cjs +39 -0
- package/dist/http/lib.cjs +39 -0
- package/dist/http/types.cjs +25 -0
- package/dist/index.cjs +56 -0
- package/dist/routing.cjs +38 -0
- package/dist/types/Campaign.cjs +69 -0
- package/dist/types/Category.cjs +1 -0
- package/dist/types/Contact.cjs +82 -0
- package/dist/types/ContactDuplicateSuggestion.cjs +17 -0
- package/dist/types/ContactsExport.cjs +17 -0
- package/dist/types/ContactsScope.cjs +19 -0
- package/dist/types/Country.cjs +1 -0
- package/dist/types/CoverageEntry.cjs +32 -0
- package/dist/types/Culture.cjs +16 -0
- package/dist/types/Currency.cjs +13 -0
- package/dist/types/DnsConfigurationInstruction.cjs +1 -0
- package/dist/types/EmailRecipient.cjs +18 -0
- package/dist/types/EmailSubscription.cjs +1 -0
- package/dist/types/JobState.cjs +13 -0
- package/dist/types/License.cjs +31 -0
- package/dist/types/Newsroom.cjs +30 -0
- package/dist/types/NewsroomCompanyInformation.cjs +1 -0
- package/dist/types/NewsroomContact.cjs +1 -0
- package/dist/types/NewsroomDomain.cjs +24 -0
- package/dist/types/NewsroomGallery.cjs +16 -0
- package/dist/types/NewsroomLanguageSettings.cjs +1 -0
- package/dist/types/NewsroomTheme.cjs +38 -0
- package/dist/types/NewsroomWebhook.cjs +20 -0
- package/dist/types/NotificationSubscription.cjs +17 -0
- package/dist/types/Permissions.cjs +18 -0
- package/dist/types/Plan.cjs +18 -0
- package/dist/types/PrivacyRequest.cjs +24 -0
- package/dist/types/SEOSettings.cjs +1 -0
- package/dist/types/SEOSettings.d.ts +7 -0
- package/dist/types/SEOSettings.js +1 -0
- package/dist/types/SenderAddress.cjs +16 -0
- package/dist/types/SenderDomain.cjs +18 -0
- package/dist/types/Snippet.cjs +1 -0
- package/dist/types/Story.cjs +89 -0
- package/dist/types/Story.d.ts +2 -0
- package/dist/types/User.cjs +28 -0
- package/dist/types/UserAccount.cjs +1 -0
- package/dist/types/common/Notification.cjs +18 -0
- package/dist/types/common/OEmbedInfo.cjs +18 -0
- package/dist/types/common/Pagination.cjs +15 -0
- package/dist/types/common/Query.cjs +21 -0
- package/dist/types/common/Utm.cjs +1 -0
- package/dist/types/common/Warning.cjs +1 -0
- package/dist/types/common/index.cjs +65 -0
- package/dist/types/index.cjs +325 -0
- package/dist/utils.cjs +30 -0
- package/package.json +14 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _routing = require("../../routing.cjs");
|
|
8
|
+
class Client {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
async list() {
|
|
13
|
+
const {
|
|
14
|
+
senders
|
|
15
|
+
} = await this.apiClient.get(_routing.routing.senderAddressesUrl);
|
|
16
|
+
return senders;
|
|
17
|
+
}
|
|
18
|
+
async create(payload) {
|
|
19
|
+
const {
|
|
20
|
+
sender
|
|
21
|
+
} = await this.apiClient.post(_routing.routing.senderAddressesUrl, {
|
|
22
|
+
payload
|
|
23
|
+
});
|
|
24
|
+
return sender;
|
|
25
|
+
}
|
|
26
|
+
async get(senderId) {
|
|
27
|
+
const {
|
|
28
|
+
sender
|
|
29
|
+
} = await this.apiClient.get(`${_routing.routing.senderAddressesUrl}/${senderId}`);
|
|
30
|
+
return sender;
|
|
31
|
+
}
|
|
32
|
+
async update(senderId, payload) {
|
|
33
|
+
const {
|
|
34
|
+
sender
|
|
35
|
+
} = await this.apiClient.patch(`${_routing.routing.senderAddressesUrl}/${senderId}`, {
|
|
36
|
+
payload
|
|
37
|
+
});
|
|
38
|
+
return sender;
|
|
39
|
+
}
|
|
40
|
+
async remove(senderId) {
|
|
41
|
+
return this.apiClient.delete(`${_routing.routing.senderAddressesUrl}/${senderId}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _routing = require("../../routing.cjs");
|
|
8
|
+
class Client {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
async checkEmailAvailability(email) {
|
|
13
|
+
const url = `${_routing.routing.signup}/check-availability`;
|
|
14
|
+
return this.apiClient.post(url, {
|
|
15
|
+
payload: {
|
|
16
|
+
email
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EmailAvailability = void 0;
|
|
7
|
+
let EmailAvailability;
|
|
8
|
+
exports.EmailAvailability = EmailAvailability;
|
|
9
|
+
(function (EmailAvailability) {
|
|
10
|
+
EmailAvailability["AVAILABLE"] = "available";
|
|
11
|
+
EmailAvailability["TAKEN"] = "taken";
|
|
12
|
+
})(EmailAvailability || (exports.EmailAvailability = EmailAvailability = {}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _routing = require("../../routing.cjs");
|
|
8
|
+
class Client {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
async list() {
|
|
13
|
+
const url = _routing.routing.snippetsUrl;
|
|
14
|
+
const {
|
|
15
|
+
snippets
|
|
16
|
+
} = await this.apiClient.get(url);
|
|
17
|
+
return snippets;
|
|
18
|
+
}
|
|
19
|
+
async get(snippetId) {
|
|
20
|
+
const url = _routing.routing.snippetsUrl;
|
|
21
|
+
const {
|
|
22
|
+
snippet
|
|
23
|
+
} = await this.apiClient.get(`${url}/${snippetId}`);
|
|
24
|
+
return snippet;
|
|
25
|
+
}
|
|
26
|
+
async create(payload) {
|
|
27
|
+
const url = _routing.routing.snippetsUrl;
|
|
28
|
+
const {
|
|
29
|
+
snippet
|
|
30
|
+
} = await this.apiClient.post(url, {
|
|
31
|
+
payload
|
|
32
|
+
});
|
|
33
|
+
return snippet;
|
|
34
|
+
}
|
|
35
|
+
async update(snippetId, payload) {
|
|
36
|
+
const url = _routing.routing.snippetsUrl;
|
|
37
|
+
const {
|
|
38
|
+
snippet
|
|
39
|
+
} = await this.apiClient.patch(`${url}/${snippetId}`, {
|
|
40
|
+
payload
|
|
41
|
+
});
|
|
42
|
+
return snippet;
|
|
43
|
+
}
|
|
44
|
+
async remove(snippetId) {
|
|
45
|
+
const url = _routing.routing.snippetsUrl;
|
|
46
|
+
return this.apiClient.delete(`${url}/${snippetId}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _index = require("../../http/index.cjs");
|
|
8
|
+
var _ApiError = require("../../http/ApiError.cjs");
|
|
9
|
+
var _routing = require("../../routing.cjs");
|
|
10
|
+
class Client {
|
|
11
|
+
constructor(apiClient) {
|
|
12
|
+
this.apiClient = apiClient;
|
|
13
|
+
}
|
|
14
|
+
async list(options) {
|
|
15
|
+
const {
|
|
16
|
+
limit,
|
|
17
|
+
offset,
|
|
18
|
+
sortOrder,
|
|
19
|
+
include
|
|
20
|
+
} = options ?? {};
|
|
21
|
+
return this.apiClient.get(_routing.routing.storiesUrl, {
|
|
22
|
+
query: {
|
|
23
|
+
limit,
|
|
24
|
+
offset,
|
|
25
|
+
sort: sortOrder,
|
|
26
|
+
include: include ? include.join(',') : undefined
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async search(options) {
|
|
31
|
+
const {
|
|
32
|
+
limit,
|
|
33
|
+
offset,
|
|
34
|
+
sortOrder,
|
|
35
|
+
include,
|
|
36
|
+
query
|
|
37
|
+
} = options ?? {};
|
|
38
|
+
return this.apiClient.post(_routing.routing.storiesSearchUrl, {
|
|
39
|
+
payload: {
|
|
40
|
+
query,
|
|
41
|
+
limit,
|
|
42
|
+
offset,
|
|
43
|
+
sort: sortOrder,
|
|
44
|
+
include: include ? include.join(',') : undefined
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get story by UUID.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Implementation
|
|
55
|
+
*/
|
|
56
|
+
async get(arg, options) {
|
|
57
|
+
const include = options?.include;
|
|
58
|
+
const isArray = Array.isArray(arg);
|
|
59
|
+
if (isArray && arg.length === 0) {
|
|
60
|
+
// No need to call the API.
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
if (isArray && typeof arg[0] === 'number') {
|
|
64
|
+
const {
|
|
65
|
+
stories
|
|
66
|
+
} = await this.search({
|
|
67
|
+
limit: arg.length,
|
|
68
|
+
query: {
|
|
69
|
+
id: {
|
|
70
|
+
$in: arg
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
include
|
|
74
|
+
});
|
|
75
|
+
return stories;
|
|
76
|
+
}
|
|
77
|
+
if (isArray && typeof arg[0] === 'string') {
|
|
78
|
+
const {
|
|
79
|
+
stories
|
|
80
|
+
} = await this.search({
|
|
81
|
+
limit: arg.length,
|
|
82
|
+
query: {
|
|
83
|
+
uuid: {
|
|
84
|
+
$in: arg
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
include
|
|
88
|
+
});
|
|
89
|
+
return stories;
|
|
90
|
+
}
|
|
91
|
+
const {
|
|
92
|
+
story
|
|
93
|
+
} = await this.apiClient.get(`${_routing.routing.storiesUrl}/${arg}`, {
|
|
94
|
+
query: {
|
|
95
|
+
include: include
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return story;
|
|
99
|
+
}
|
|
100
|
+
async create(payload, options) {
|
|
101
|
+
const include = options?.include;
|
|
102
|
+
const {
|
|
103
|
+
story
|
|
104
|
+
} = await this.apiClient.post(_routing.routing.storiesUrl, {
|
|
105
|
+
payload,
|
|
106
|
+
query: {
|
|
107
|
+
include: include
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return story;
|
|
111
|
+
}
|
|
112
|
+
async duplicate(id, options) {
|
|
113
|
+
const include = options?.include;
|
|
114
|
+
const url = `${_routing.routing.storiesUrl}/${id}/duplicate`;
|
|
115
|
+
const {
|
|
116
|
+
story
|
|
117
|
+
} = await this.apiClient.post(url, {
|
|
118
|
+
query: {
|
|
119
|
+
include: include
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return story;
|
|
123
|
+
}
|
|
124
|
+
async translate(id, payload, options) {
|
|
125
|
+
const include = options?.include;
|
|
126
|
+
const url = `${_routing.routing.storiesUrl}/${id}/translate`;
|
|
127
|
+
const {
|
|
128
|
+
story
|
|
129
|
+
} = await this.apiClient.post(url, {
|
|
130
|
+
query: {
|
|
131
|
+
include: include
|
|
132
|
+
},
|
|
133
|
+
payload
|
|
134
|
+
});
|
|
135
|
+
return story;
|
|
136
|
+
}
|
|
137
|
+
async move(id, payload, options) {
|
|
138
|
+
const include = options?.include;
|
|
139
|
+
const force = options?.force;
|
|
140
|
+
const url = `${_routing.routing.storiesUrl}/${id}/move`;
|
|
141
|
+
try {
|
|
142
|
+
const {
|
|
143
|
+
story
|
|
144
|
+
} = await this.apiClient.post(url, {
|
|
145
|
+
query: {
|
|
146
|
+
include: include,
|
|
147
|
+
force
|
|
148
|
+
},
|
|
149
|
+
payload
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
status: 'success',
|
|
153
|
+
story
|
|
154
|
+
};
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (error instanceof _ApiError.ApiError && error.status === _index.HttpCodes.CONFLICT) {
|
|
157
|
+
return error.payload;
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async update(id, payload, options) {
|
|
163
|
+
const url = `${_routing.routing.storiesUrl}/${id}`;
|
|
164
|
+
const include = options?.include;
|
|
165
|
+
const {
|
|
166
|
+
story
|
|
167
|
+
} = await this.apiClient.patch(url, {
|
|
168
|
+
payload,
|
|
169
|
+
query: {
|
|
170
|
+
include: include
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return story;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* This operation is only allowed for V3 stories
|
|
178
|
+
*/
|
|
179
|
+
async autosave(id, payload, options) {
|
|
180
|
+
const url = `${_routing.routing.storiesUrl}/${id}/autosave`;
|
|
181
|
+
const include = options?.include;
|
|
182
|
+
const {
|
|
183
|
+
story
|
|
184
|
+
} = await this.apiClient.patch(url, {
|
|
185
|
+
payload,
|
|
186
|
+
query: {
|
|
187
|
+
include: include
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
return story;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* This operation is only allowed for V3 stories
|
|
195
|
+
*/
|
|
196
|
+
async revert(id, payload, options) {
|
|
197
|
+
const url = `${_routing.routing.storiesUrl}/${id}/revert`;
|
|
198
|
+
const include = options?.include;
|
|
199
|
+
const {
|
|
200
|
+
story
|
|
201
|
+
} = await this.apiClient.post(url, {
|
|
202
|
+
payload,
|
|
203
|
+
query: {
|
|
204
|
+
include: include
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
return story;
|
|
208
|
+
}
|
|
209
|
+
async publish(id, payload, options) {
|
|
210
|
+
const url = `${_routing.routing.storiesUrl}/${id}/publish`;
|
|
211
|
+
const include = options?.include;
|
|
212
|
+
const {
|
|
213
|
+
story
|
|
214
|
+
} = await this.apiClient.post(url, {
|
|
215
|
+
payload,
|
|
216
|
+
query: {
|
|
217
|
+
include: include
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return story;
|
|
221
|
+
}
|
|
222
|
+
async unpublish(id, payload, options) {
|
|
223
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
|
|
224
|
+
const include = options?.include;
|
|
225
|
+
const {
|
|
226
|
+
story
|
|
227
|
+
} = await this.apiClient.post(url, {
|
|
228
|
+
payload,
|
|
229
|
+
query: {
|
|
230
|
+
include: include
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
return story;
|
|
234
|
+
}
|
|
235
|
+
async schedule(id, payload, options) {
|
|
236
|
+
const url = `${_routing.routing.storiesUrl}/${id}/schedule`;
|
|
237
|
+
const include = options?.include;
|
|
238
|
+
const {
|
|
239
|
+
story
|
|
240
|
+
} = await this.apiClient.post(url, {
|
|
241
|
+
payload,
|
|
242
|
+
query: {
|
|
243
|
+
include: include
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
return story;
|
|
247
|
+
}
|
|
248
|
+
async unschedule(id, payload, options) {
|
|
249
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpublish`;
|
|
250
|
+
const include = options?.include;
|
|
251
|
+
const {
|
|
252
|
+
story
|
|
253
|
+
} = await this.apiClient.post(url, {
|
|
254
|
+
payload,
|
|
255
|
+
query: {
|
|
256
|
+
include: include
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
return story;
|
|
260
|
+
}
|
|
261
|
+
async pin(id, options) {
|
|
262
|
+
const url = `${_routing.routing.storiesUrl}/${id}/pin`;
|
|
263
|
+
const include = options?.include;
|
|
264
|
+
const {
|
|
265
|
+
story
|
|
266
|
+
} = await this.apiClient.post(url, {
|
|
267
|
+
query: {
|
|
268
|
+
include: include,
|
|
269
|
+
force: options?.force || undefined
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return story;
|
|
273
|
+
}
|
|
274
|
+
async unpin(id, options) {
|
|
275
|
+
const url = `${_routing.routing.storiesUrl}/${id}/unpin`;
|
|
276
|
+
const include = options?.include;
|
|
277
|
+
const {
|
|
278
|
+
story
|
|
279
|
+
} = await this.apiClient.post(url, {
|
|
280
|
+
query: {
|
|
281
|
+
include: include
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return story;
|
|
285
|
+
}
|
|
286
|
+
async delete(id) {
|
|
287
|
+
const url = `${_routing.routing.storiesUrl}/${id}`;
|
|
288
|
+
await this.apiClient.delete(url);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _scopes = require("./scopes.cjs");
|
|
27
|
+
Object.keys(_scopes).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _scopes[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Scope = void 0;
|
|
7
|
+
var _index = require("../../types/index.cjs");
|
|
8
|
+
const Scope = {
|
|
9
|
+
EXCLUDE_ARCHIVED_NEWSROOMS: {
|
|
10
|
+
'newsroom.status': {
|
|
11
|
+
$nin: [_index.Newsroom.Status.ARCHIVED]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.Scope = Scope;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EXTENDED_STORY_INCLUDED_EXTRA_FIELDS = exports.ALL_EXTRA_FIELDS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Uploadcare image JSON string.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Raw HTML string.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* String containing Prezly Content Format JSON structure.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE = {
|
|
20
|
+
thumbnail_image: true,
|
|
21
|
+
header_image: true,
|
|
22
|
+
preview_image: true,
|
|
23
|
+
social_image: true,
|
|
24
|
+
social_text: true,
|
|
25
|
+
tag_names: true,
|
|
26
|
+
content: true,
|
|
27
|
+
attached_gallery_content: true,
|
|
28
|
+
referenced_entities: true
|
|
29
|
+
}; // satisfies Record<keyof Omit<ExtendedStory, keyof Story>, boolean>; // TODO: Use Typescript `satisfies` operator, when it's out of beta
|
|
30
|
+
|
|
31
|
+
const ALL_EXTRA_FIELDS_SHAPE = {
|
|
32
|
+
thumbnail_image: true,
|
|
33
|
+
header_image: true,
|
|
34
|
+
preview_image: true,
|
|
35
|
+
social_image: true,
|
|
36
|
+
social_text: true,
|
|
37
|
+
tag_names: true,
|
|
38
|
+
content: true,
|
|
39
|
+
autosaved_content: true,
|
|
40
|
+
content_version: true,
|
|
41
|
+
last_modifying_user: true,
|
|
42
|
+
attached_gallery_content: true,
|
|
43
|
+
referenced_entities: true,
|
|
44
|
+
'campaigns.count': true,
|
|
45
|
+
'pitches.count': true
|
|
46
|
+
}; // satisfies Record<keyof Story.OnDemandFields, boolean>; // TODO: Use Typescript `satisfies` operator, when it's out of beta
|
|
47
|
+
|
|
48
|
+
const ALL_EXTRA_FIELDS = Object.keys(ALL_EXTRA_FIELDS_SHAPE);
|
|
49
|
+
exports.ALL_EXTRA_FIELDS = ALL_EXTRA_FIELDS;
|
|
50
|
+
const EXTENDED_STORY_INCLUDED_EXTRA_FIELDS = Object.keys(EXTENDED_STORY_INCLUDED_EXTRA_FIELDS_SHAPE);
|
|
51
|
+
exports.EXTENDED_STORY_INCLUDED_EXTRA_FIELDS = EXTENDED_STORY_INCLUDED_EXTRA_FIELDS;
|
|
@@ -90,6 +90,11 @@ interface GenericUpdateRequest {
|
|
|
90
90
|
categories?: Category['id'][];
|
|
91
91
|
tags?: string[];
|
|
92
92
|
is_shared_to_prpro?: boolean;
|
|
93
|
+
seo_settings?: {
|
|
94
|
+
meta_title?: string | null;
|
|
95
|
+
meta_description?: string | null;
|
|
96
|
+
canonical_url?: string | null;
|
|
97
|
+
};
|
|
93
98
|
}
|
|
94
99
|
export interface HtmlStoryCreateRequest extends GenericCreateRequest {
|
|
95
100
|
/**
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
var _routing = require("../../routing.cjs");
|
|
8
|
+
class Client {
|
|
9
|
+
constructor(apiClient) {
|
|
10
|
+
this.apiClient = apiClient;
|
|
11
|
+
}
|
|
12
|
+
async subscribeToNewsroom(newsroomId, payload) {
|
|
13
|
+
const url = _routing.routing.newsroomSubscribeUrl.replace(':newsroom_id', String(newsroomId));
|
|
14
|
+
const {
|
|
15
|
+
subscription
|
|
16
|
+
} = await this.apiClient.post(url, {
|
|
17
|
+
payload
|
|
18
|
+
});
|
|
19
|
+
return subscription;
|
|
20
|
+
}
|
|
21
|
+
async unsubscribeFromNewsroom(newsroomId, payload) {
|
|
22
|
+
const url = _routing.routing.newsroomUnsubscribeUrl.replace(':newsroom_id', String(newsroomId));
|
|
23
|
+
const {
|
|
24
|
+
subscription
|
|
25
|
+
} = await this.apiClient.post(url, {
|
|
26
|
+
payload
|
|
27
|
+
});
|
|
28
|
+
return subscription;
|
|
29
|
+
}
|
|
30
|
+
async updateNewsroomUnsubscribeDetails(newsroomId, subscriptionId, payload) {
|
|
31
|
+
const url = _routing.routing.newsroomUnsubscribeUrl.replace(':newsroom_id', String(newsroomId));
|
|
32
|
+
const {
|
|
33
|
+
subscription
|
|
34
|
+
} = await this.apiClient.patch(`${url}/${subscriptionId}`, {
|
|
35
|
+
payload
|
|
36
|
+
});
|
|
37
|
+
return subscription;
|
|
38
|
+
}
|
|
39
|
+
async unsubscribeFromLicense(payload) {
|
|
40
|
+
const url = _routing.routing.licenseUnsubscribeUrl;
|
|
41
|
+
const {
|
|
42
|
+
subscription
|
|
43
|
+
} = await this.apiClient.post(url, {
|
|
44
|
+
payload
|
|
45
|
+
});
|
|
46
|
+
return subscription;
|
|
47
|
+
}
|
|
48
|
+
async updateLicenseUnsubscribeDetails(subscriptionId, payload) {
|
|
49
|
+
const url = _routing.routing.licenseUnsubscribeUrl;
|
|
50
|
+
const {
|
|
51
|
+
subscription
|
|
52
|
+
} = await this.apiClient.patch(`${url}/${subscriptionId}`, {
|
|
53
|
+
payload
|
|
54
|
+
});
|
|
55
|
+
return subscription;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
Object.defineProperty(exports, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _Client[key];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
var _types = require("./types.cjs");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _types[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|