@prezly/sdk 11.11.0 → 12.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/dist/Client.cjs CHANGED
@@ -35,6 +35,7 @@ function createClient({
35
35
  newsroomPrivacyRequests: new _index2.NewsroomPrivacyRequests.Client(apiClient),
36
36
  newsroomDomains: new _index2.NewsroomDomains.Client(apiClient),
37
37
  newsroomGalleries: new _index2.NewsroomGalleries.Client(apiClient),
38
+ newsroomHub: new _index2.NewsroomHub.Client(apiClient),
38
39
  senderAddresses: new _index2.SenderAddresses.Client(apiClient),
39
40
  signup: new _index2.Signup.Client(apiClient),
40
41
  stories: new _index2.Stories.Client(apiClient),
package/dist/Client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
1
+ import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
2
2
  import type { HeadersMap } from './http';
3
3
  export interface ClientOptions {
4
4
  accessToken: string;
@@ -23,6 +23,7 @@ export interface Client {
23
23
  newsroomPrivacyRequests: NewsroomPrivacyRequests.Client;
24
24
  newsroomDomains: NewsroomDomains.Client;
25
25
  newsroomGalleries: NewsroomGalleries.Client;
26
+ newsroomHub: NewsroomHub.Client;
26
27
  senderAddresses: SenderAddresses.Client;
27
28
  signup: Signup.Client;
28
29
  stories: Stories.Client;
package/dist/Client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ApiClient, DeferredJobsApiClient } from "./api/index.js";
2
- import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
2
+ import { Accounts, Billing, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, SenderAddresses, Signup, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
3
3
  const DEFAULT_BASE_URL = 'https://api.prezly.com';
4
4
  export function createClient({
5
5
  accessToken,
@@ -29,6 +29,7 @@ export function createClient({
29
29
  newsroomPrivacyRequests: new NewsroomPrivacyRequests.Client(apiClient),
30
30
  newsroomDomains: new NewsroomDomains.Client(apiClient),
31
31
  newsroomGalleries: new NewsroomGalleries.Client(apiClient),
32
+ newsroomHub: new NewsroomHub.Client(apiClient),
32
33
  senderAddresses: new SenderAddresses.Client(apiClient),
33
34
  signup: new Signup.Client(apiClient),
34
35
  stories: new Stories.Client(apiClient),
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "11.10.0";
7
+ const VERSION = "11.12.0";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
10
10
  exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
@@ -1,3 +1,3 @@
1
- const VERSION = "11.10.0";
1
+ const VERSION = "11.12.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,60 @@
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(newsroomId) {
13
+ const url = generateUrl(newsroomId);
14
+ const {
15
+ members
16
+ } = await this.apiClient.get(url);
17
+ return members;
18
+ }
19
+ async linkMany(newsroomId, payload) {
20
+ const url = generateUrl(newsroomId);
21
+ const {
22
+ members
23
+ } = await this.apiClient.post(url, {
24
+ payload
25
+ });
26
+ return members;
27
+ }
28
+ async member(newsroomId, memberId) {
29
+ const url = generateUrl(newsroomId, memberId);
30
+ const {
31
+ member
32
+ } = await this.apiClient.get(url);
33
+ return member;
34
+ }
35
+ async link(newsroomId, memberId, options = {}) {
36
+ const {
37
+ is_displaying_stories_in_hub
38
+ } = options;
39
+ const url = generateUrl(newsroomId, memberId);
40
+ const {
41
+ member
42
+ } = await this.apiClient.post(url, {
43
+ payload: {
44
+ is_displaying_stories_in_hub
45
+ }
46
+ });
47
+ return member;
48
+ }
49
+ async unlink(newsroomId, memberId) {
50
+ await this.apiClient.delete(generateUrl(newsroomId, memberId));
51
+ }
52
+ }
53
+ exports.Client = Client;
54
+ function generateUrl(newsroomId, memberId) {
55
+ const url = _routing.routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
56
+ if (typeof memberId === 'undefined') {
57
+ return url;
58
+ }
59
+ return `${url}/${String(memberId)}`;
60
+ }
@@ -0,0 +1,14 @@
1
+ import type { DeferredJobsApiClient } from '../../api';
2
+ import type { NewsroomRef } from '../../types';
3
+ import type { LinkOptions, HubMember, LinkManyRequest } from './types';
4
+ declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
5
+ export declare class Client {
6
+ private readonly apiClient;
7
+ constructor(apiClient: DeferredJobsApiClient);
8
+ list(newsroomId: NewsroomId): Promise<HubMember[]>;
9
+ linkMany(newsroomId: NewsroomId, payload: LinkManyRequest): Promise<HubMember[]>;
10
+ member(newsroomId: NewsroomId, memberId: NewsroomId): Promise<HubMember>;
11
+ link(newsroomId: NewsroomId, memberId: NewsroomId, options?: LinkOptions): Promise<HubMember>;
12
+ unlink(newsroomId: NewsroomId, memberId: NewsroomId): Promise<void>;
13
+ }
14
+ export {};
@@ -0,0 +1,53 @@
1
+ import { routing } from "../../routing.js";
2
+ export class Client {
3
+ constructor(apiClient) {
4
+ this.apiClient = apiClient;
5
+ }
6
+ async list(newsroomId) {
7
+ const url = generateUrl(newsroomId);
8
+ const {
9
+ members
10
+ } = await this.apiClient.get(url);
11
+ return members;
12
+ }
13
+ async linkMany(newsroomId, payload) {
14
+ const url = generateUrl(newsroomId);
15
+ const {
16
+ members
17
+ } = await this.apiClient.post(url, {
18
+ payload
19
+ });
20
+ return members;
21
+ }
22
+ async member(newsroomId, memberId) {
23
+ const url = generateUrl(newsroomId, memberId);
24
+ const {
25
+ member
26
+ } = await this.apiClient.get(url);
27
+ return member;
28
+ }
29
+ async link(newsroomId, memberId, options = {}) {
30
+ const {
31
+ is_displaying_stories_in_hub
32
+ } = options;
33
+ const url = generateUrl(newsroomId, memberId);
34
+ const {
35
+ member
36
+ } = await this.apiClient.post(url, {
37
+ payload: {
38
+ is_displaying_stories_in_hub
39
+ }
40
+ });
41
+ return member;
42
+ }
43
+ async unlink(newsroomId, memberId) {
44
+ await this.apiClient.delete(generateUrl(newsroomId, memberId));
45
+ }
46
+ }
47
+ function generateUrl(newsroomId, memberId) {
48
+ const url = routing.newsroomHubUrl.replace(':newsroom_id', String(newsroomId));
49
+ if (typeof memberId === 'undefined') {
50
+ return url;
51
+ }
52
+ return `${url}/${String(memberId)}`;
53
+ }
@@ -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,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,16 @@
1
+ import type { NewsroomRef } from '../../types';
2
+ declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
3
+ export interface HubMember {
4
+ newsroom: NewsroomRef;
5
+ is_displaying_stories_in_hub: boolean;
6
+ }
7
+ export interface ListResponse {
8
+ members: HubMember[];
9
+ }
10
+ export interface LinkManyRequest {
11
+ members: NewsroomId[];
12
+ }
13
+ export interface LinkOptions {
14
+ is_displaying_stories_in_hub?: boolean;
15
+ }
16
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NotificationSubscriptions = exports.Subscriptions = exports.Stories = exports.Snippets = exports.Signup = exports.SenderAddresses = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.Newsrooms = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = exports.Campaigns = exports.CampaignRecipients = exports.Billing = exports.Accounts = void 0;
6
+ exports.NotificationSubscriptions = exports.Subscriptions = exports.Stories = exports.Snippets = exports.Signup = exports.SenderAddresses = exports.NewsroomWebhooks = exports.NewsroomThemes = exports.NewsroomSubscriptions = exports.Newsrooms = exports.NewsroomPrivacyRequests = exports.NewsroomLanguages = exports.NewsroomHub = exports.NewsroomGalleries = exports.NewsroomDomains = exports.NewsroomContacts = exports.NewsroomCategories = exports.Licenses = exports.Jobs = exports.Coverage = exports.ContactsExports = 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"));
@@ -28,6 +28,8 @@ var _NewsroomDomains = _interopRequireWildcard(require("./NewsroomDomains/index.
28
28
  exports.NewsroomDomains = _NewsroomDomains;
29
29
  var _NewsroomGalleries = _interopRequireWildcard(require("./NewsroomGalleries/index.cjs"));
30
30
  exports.NewsroomGalleries = _NewsroomGalleries;
31
+ var _NewsroomHub = _interopRequireWildcard(require("./NewsroomHub/index.cjs"));
32
+ exports.NewsroomHub = _NewsroomHub;
31
33
  var _NewsroomLanguages = _interopRequireWildcard(require("./NewsroomLanguages/index.cjs"));
32
34
  exports.NewsroomLanguages = _NewsroomLanguages;
33
35
  var _NewsroomPrivacyRequests = _interopRequireWildcard(require("./NewsroomPrivacyRequests/index.cjs"));
@@ -10,6 +10,7 @@ export * as NewsroomCategories from './NewsroomCategories';
10
10
  export * as NewsroomContacts from './NewsroomContacts';
11
11
  export * as NewsroomDomains from './NewsroomDomains';
12
12
  export * as NewsroomGalleries from './NewsroomGalleries';
13
+ export * as NewsroomHub from './NewsroomHub';
13
14
  export * as NewsroomLanguages from './NewsroomLanguages';
14
15
  export * as NewsroomPrivacyRequests from './NewsroomPrivacyRequests';
15
16
  export * as Newsrooms from './Newsrooms';
@@ -10,6 +10,7 @@ export * as NewsroomCategories from "./NewsroomCategories/index.js";
10
10
  export * as NewsroomContacts from "./NewsroomContacts/index.js";
11
11
  export * as NewsroomDomains from "./NewsroomDomains/index.js";
12
12
  export * as NewsroomGalleries from "./NewsroomGalleries/index.js";
13
+ export * as NewsroomHub from "./NewsroomHub/index.js";
13
14
  export * as NewsroomLanguages from "./NewsroomLanguages/index.js";
14
15
  export * as NewsroomPrivacyRequests from "./NewsroomPrivacyRequests/index.js";
15
16
  export * as Newsrooms from "./Newsrooms/index.js";
package/dist/routing.cjs CHANGED
@@ -27,6 +27,7 @@ const routing = {
27
27
  newsroomPrivacyRequestsUrl: '/v2/newsrooms/:newsroom_id/privacy-requests',
28
28
  newsroomDomainsUrl: '/v2/newsrooms/:newsroom_id/domains',
29
29
  newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
30
+ newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
30
31
  notificationSubscriptionsUrl: '/v2/notification-subscriptions',
31
32
  senderAddressesUrl: '/v2/sender-addresses',
32
33
  signup: '/v2/signup',
package/dist/routing.d.ts CHANGED
@@ -21,6 +21,7 @@ export declare const routing: {
21
21
  newsroomPrivacyRequestsUrl: string;
22
22
  newsroomDomainsUrl: string;
23
23
  newsroomGalleriesUrl: string;
24
+ newsroomHubUrl: string;
24
25
  notificationSubscriptionsUrl: string;
25
26
  senderAddressesUrl: string;
26
27
  signup: string;
package/dist/routing.js CHANGED
@@ -21,6 +21,7 @@ export const routing = {
21
21
  newsroomPrivacyRequestsUrl: '/v2/newsrooms/:newsroom_id/privacy-requests',
22
22
  newsroomDomainsUrl: '/v2/newsrooms/:newsroom_id/domains',
23
23
  newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
24
+ newsroomHubUrl: '/v2/newsrooms/:newsroom_id/hub',
24
25
  notificationSubscriptionsUrl: '/v2/notification-subscriptions',
25
26
  senderAddressesUrl: '/v2/sender-addresses',
26
27
  signup: '/v2/signup',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "11.11.0",
3
+ "version": "12.0.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",