@prezly/sdk 25.3.0 → 25.4.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/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/endpoints/Templates/Client.cjs +52 -0
- package/dist/endpoints/Templates/Client.d.ts +13 -0
- package/dist/endpoints/Templates/Client.js +46 -0
- package/dist/endpoints/Templates/index.cjs +27 -0
- package/dist/endpoints/Templates/index.d.ts +2 -0
- package/dist/endpoints/Templates/index.js +2 -0
- package/dist/endpoints/Templates/types.cjs +1 -0
- package/dist/endpoints/Templates/types.d.ts +8 -0
- package/dist/endpoints/Templates/types.js +1 -0
- package/dist/endpoints/index.cjs +3 -1
- package/dist/endpoints/index.d.ts +1 -0
- package/dist/endpoints/index.js +1 -0
- package/dist/routing.cjs +2 -1
- package/dist/routing.d.ts +1 -0
- package/dist/routing.js +2 -1
- package/dist/types/Template.cjs +1 -0
- package/dist/types/Template.d.ts +11 -0
- package/dist/types/Template.js +1 -0
- package/dist/types/index.cjs +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
package/dist/api/constants.cjs
CHANGED
|
@@ -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 = "25.
|
|
7
|
+
const VERSION = "25.3.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})`;
|
package/dist/api/constants.js
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
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.templatesUrl;
|
|
11
|
+
const {
|
|
12
|
+
templates
|
|
13
|
+
} = await api.get(url);
|
|
14
|
+
return templates;
|
|
15
|
+
}
|
|
16
|
+
async function get(templateId) {
|
|
17
|
+
const url = _routing.routing.templatesUrl;
|
|
18
|
+
const {
|
|
19
|
+
template
|
|
20
|
+
} = await api.get(`${url}/${templateId}`);
|
|
21
|
+
return template;
|
|
22
|
+
}
|
|
23
|
+
async function create(payload) {
|
|
24
|
+
const url = _routing.routing.templatesUrl;
|
|
25
|
+
const {
|
|
26
|
+
template
|
|
27
|
+
} = await api.post(url, {
|
|
28
|
+
payload
|
|
29
|
+
});
|
|
30
|
+
return template;
|
|
31
|
+
}
|
|
32
|
+
async function update(templateId, payload) {
|
|
33
|
+
const url = _routing.routing.templatesUrl;
|
|
34
|
+
const {
|
|
35
|
+
template
|
|
36
|
+
} = await api.patch(`${url}/${templateId}`, {
|
|
37
|
+
payload
|
|
38
|
+
});
|
|
39
|
+
return template;
|
|
40
|
+
}
|
|
41
|
+
async function doDelete(templateId) {
|
|
42
|
+
const url = _routing.routing.templatesUrl;
|
|
43
|
+
return api.delete(`${url}/${templateId}`);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
list,
|
|
47
|
+
get,
|
|
48
|
+
create,
|
|
49
|
+
update,
|
|
50
|
+
delete: doDelete
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DeferredJobsApiClient } from '../../api';
|
|
2
|
+
import type { Template } from '../../types';
|
|
3
|
+
import type { CreateRequest, UpdateRequest } from './types';
|
|
4
|
+
type TemplateId = Template['id'];
|
|
5
|
+
export type Client = ReturnType<typeof createClient>;
|
|
6
|
+
export declare function createClient(api: DeferredJobsApiClient): {
|
|
7
|
+
list: () => Promise<Template[]>;
|
|
8
|
+
get: (templateId: TemplateId) => Promise<Template>;
|
|
9
|
+
create: (payload: CreateRequest) => Promise<Template>;
|
|
10
|
+
update: (templateId: TemplateId, payload: UpdateRequest) => Promise<Template>;
|
|
11
|
+
delete: (templateId: TemplateId) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { routing } from "../../routing.js";
|
|
2
|
+
export function createClient(api) {
|
|
3
|
+
async function list() {
|
|
4
|
+
const url = routing.templatesUrl;
|
|
5
|
+
const {
|
|
6
|
+
templates
|
|
7
|
+
} = await api.get(url);
|
|
8
|
+
return templates;
|
|
9
|
+
}
|
|
10
|
+
async function get(templateId) {
|
|
11
|
+
const url = routing.templatesUrl;
|
|
12
|
+
const {
|
|
13
|
+
template
|
|
14
|
+
} = await api.get(`${url}/${templateId}`);
|
|
15
|
+
return template;
|
|
16
|
+
}
|
|
17
|
+
async function create(payload) {
|
|
18
|
+
const url = routing.templatesUrl;
|
|
19
|
+
const {
|
|
20
|
+
template
|
|
21
|
+
} = await api.post(url, {
|
|
22
|
+
payload
|
|
23
|
+
});
|
|
24
|
+
return template;
|
|
25
|
+
}
|
|
26
|
+
async function update(templateId, payload) {
|
|
27
|
+
const url = routing.templatesUrl;
|
|
28
|
+
const {
|
|
29
|
+
template
|
|
30
|
+
} = await api.patch(`${url}/${templateId}`, {
|
|
31
|
+
payload
|
|
32
|
+
});
|
|
33
|
+
return template;
|
|
34
|
+
}
|
|
35
|
+
async function doDelete(templateId) {
|
|
36
|
+
const url = routing.templatesUrl;
|
|
37
|
+
return api.delete(`${url}/${templateId}`);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
list,
|
|
41
|
+
get,
|
|
42
|
+
create,
|
|
43
|
+
update,
|
|
44
|
+
delete: doDelete
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/endpoints/index.cjs
CHANGED
|
@@ -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.CoverageIntegrations = exports.Coverage = exports.ContactsExports = exports.Contacts = exports.ContactTags = exports.ContactTagGroups = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
|
|
6
|
+
exports.Templates = 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.CoverageIntegrations = 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"));
|
|
@@ -60,6 +60,8 @@ var _Stories = _interopRequireWildcard(require("./Stories/index.cjs"));
|
|
|
60
60
|
exports.Stories = _Stories;
|
|
61
61
|
var _Subscriptions = _interopRequireWildcard(require("./Subscriptions/index.cjs"));
|
|
62
62
|
exports.Subscriptions = _Subscriptions;
|
|
63
|
+
var _Templates = _interopRequireWildcard(require("./Templates/index.cjs"));
|
|
64
|
+
exports.Templates = _Templates;
|
|
63
65
|
var _NotificationSubscriptions = _interopRequireWildcard(require("./NotificationSubscriptions/index.cjs"));
|
|
64
66
|
exports.NotificationSubscriptions = _NotificationSubscriptions;
|
|
65
67
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -26,4 +26,5 @@ export * as SenderAddresses from './SenderAddresses';
|
|
|
26
26
|
export * as Snippets from './Snippets';
|
|
27
27
|
export * as Stories from './Stories';
|
|
28
28
|
export * as Subscriptions from './Subscriptions';
|
|
29
|
+
export * as Templates from './Templates';
|
|
29
30
|
export * as NotificationSubscriptions from './NotificationSubscriptions';
|
package/dist/endpoints/index.js
CHANGED
|
@@ -26,4 +26,5 @@ export * as SenderAddresses from "./SenderAddresses/index.js";
|
|
|
26
26
|
export * as Snippets from "./Snippets/index.js";
|
|
27
27
|
export * as Stories from "./Stories/index.js";
|
|
28
28
|
export * as Subscriptions from "./Subscriptions/index.js";
|
|
29
|
+
export * as Templates from "./Templates/index.js";
|
|
29
30
|
export * as NotificationSubscriptions from "./NotificationSubscriptions/index.js";
|
package/dist/routing.cjs
CHANGED
|
@@ -40,5 +40,6 @@ const routing = exports.routing = {
|
|
|
40
40
|
storiesUrl: '/v2/stories',
|
|
41
41
|
storiesSearchUrl: '/v2/stories/search',
|
|
42
42
|
storyCoverageUrl: '/v1/stories/:story_id/reports/coverage',
|
|
43
|
-
snippetsUrl: '/v2/snippets'
|
|
43
|
+
snippetsUrl: '/v2/snippets',
|
|
44
|
+
templatesUrl: '/v2/templates'
|
|
44
45
|
};
|
package/dist/routing.d.ts
CHANGED
package/dist/routing.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Iso8601DateTime } from './common';
|
|
2
|
+
import type { UserRef } from './User';
|
|
3
|
+
export interface Template {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
creator: UserRef | null;
|
|
8
|
+
last_modifying_user: UserRef | null;
|
|
9
|
+
created_at: Iso8601DateTime;
|
|
10
|
+
modified_at: Iso8601DateTime;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.cjs
CHANGED
|
@@ -454,6 +454,17 @@ Object.keys(_Story).forEach(function (key) {
|
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
});
|
|
457
|
+
var _Template = require("./Template.cjs");
|
|
458
|
+
Object.keys(_Template).forEach(function (key) {
|
|
459
|
+
if (key === "default" || key === "__esModule") return;
|
|
460
|
+
if (key in exports && exports[key] === _Template[key]) return;
|
|
461
|
+
Object.defineProperty(exports, key, {
|
|
462
|
+
enumerable: true,
|
|
463
|
+
get: function () {
|
|
464
|
+
return _Template[key];
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
457
468
|
var _User = require("./User.cjs");
|
|
458
469
|
Object.keys(_User).forEach(function (key) {
|
|
459
470
|
if (key === "default" || key === "__esModule") return;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from './Snippet';
|
|
|
39
39
|
export * from './SortOrder';
|
|
40
40
|
export * from './BulkDeletePayload';
|
|
41
41
|
export * from './Story';
|
|
42
|
+
export * from './Template';
|
|
42
43
|
export * from './User';
|
|
43
44
|
export * from './UserAccount';
|
|
44
45
|
export * from './NotificationSubscription';
|
package/dist/types/index.js
CHANGED
|
@@ -40,6 +40,7 @@ export * from "./Snippet.js";
|
|
|
40
40
|
export * from "./SortOrder.js";
|
|
41
41
|
export * from "./BulkDeletePayload.js";
|
|
42
42
|
export * from "./Story.js";
|
|
43
|
+
export * from "./Template.js";
|
|
43
44
|
export * from "./User.js";
|
|
44
45
|
export * from "./UserAccount.js";
|
|
45
46
|
export * from "./NotificationSubscription.js";
|