@prezly/sdk 10.0.0 → 10.1.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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Stories, Snippets, Subscriptions } from './endpoints';
1
+ import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
2
2
  import type { HeadersMap } from './http';
3
3
  export interface ClientOptions {
4
4
  accessToken: string;
@@ -25,5 +25,6 @@ export interface Client {
25
25
  stories: Stories.Client;
26
26
  snippets: Snippets.Client;
27
27
  subscriptions: Subscriptions.Client;
28
+ notificationSubscriptions: NotificationSubscriptions.Client;
28
29
  }
29
30
  export declare function createClient({ accessToken, baseUrl, headers, }: ClientOptions): Client;
package/dist/Client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ApiClient, DeferredJobsApiClient } from "./api/index.js";
2
- import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, Stories, Snippets, Subscriptions } from "./endpoints/index.js";
2
+ import { Accounts, Campaigns, CampaignRecipients, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, SenderAddresses, 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,
@@ -30,6 +30,7 @@ export function createClient({
30
30
  senderAddresses: new SenderAddresses.Client(apiClient),
31
31
  stories: new Stories.Client(apiClient),
32
32
  snippets: new Snippets.Client(apiClient),
33
- subscriptions: new Subscriptions.Client(apiClient)
33
+ subscriptions: new Subscriptions.Client(apiClient),
34
+ notificationSubscriptions: new NotificationSubscriptions.Client(apiClient)
34
35
  };
35
36
  }
@@ -1,3 +1,3 @@
1
- const VERSION = "9.0.3";
1
+ const VERSION = "10.0.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,9 @@
1
+ import type { DeferredJobsApiClient } from '../../api';
2
+ import type { NotificationSubscription } from '../../types';
3
+ import type { NotificationSubscriptionsUpdateRequest } from './types';
4
+ export declare class Client {
5
+ private readonly apiClient;
6
+ constructor(apiClient: DeferredJobsApiClient);
7
+ list(): Promise<NotificationSubscription[]>;
8
+ update(payload: NotificationSubscriptionsUpdateRequest): Promise<NotificationSubscription[]>;
9
+ }
@@ -0,0 +1,22 @@
1
+ import { routing } from "../../routing.js";
2
+ export class Client {
3
+ constructor(apiClient) {
4
+ this.apiClient = apiClient;
5
+ }
6
+ async list() {
7
+ const url = routing.notificationSubscriptionsUrl;
8
+ const {
9
+ subscriptions
10
+ } = await this.apiClient.get(url);
11
+ return subscriptions;
12
+ }
13
+ async update(payload) {
14
+ const url = routing.notificationSubscriptionsUrl;
15
+ const {
16
+ subscriptions
17
+ } = await this.apiClient.patch(url, {
18
+ payload
19
+ });
20
+ return subscriptions;
21
+ }
22
+ }
@@ -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,6 @@
1
+ export interface NotificationSubscriptionsUpdateRequest {
2
+ subscriptions: {
3
+ notification_type: string;
4
+ is_email_subscribed: boolean;
5
+ }[];
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -18,3 +18,4 @@ export * as SenderAddresses from './SenderAddresses';
18
18
  export * as Snippets from './Snippets';
19
19
  export * as Stories from './Stories';
20
20
  export * as Subscriptions from './Subscriptions';
21
+ export * as NotificationSubscriptions from './NotificationSubscriptions';
@@ -17,4 +17,5 @@ export * as NewsroomWebhooks from "./NewsroomWebhooks/index.js";
17
17
  export * as SenderAddresses from "./SenderAddresses/index.js";
18
18
  export * as Snippets from "./Snippets/index.js";
19
19
  export * as Stories from "./Stories/index.js";
20
- export * as Subscriptions from "./Subscriptions/index.js";
20
+ export * as Subscriptions from "./Subscriptions/index.js";
21
+ export * as NotificationSubscriptions from "./NotificationSubscriptions/index.js";
package/dist/routing.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare const routing: {
19
19
  newsroomPrivacyRequestsUrl: string;
20
20
  newsroomDomainsUrl: string;
21
21
  newsroomGalleriesUrl: string;
22
+ notificationSubscriptionsUrl: string;
22
23
  senderAddressesUrl: string;
23
24
  storiesUrl: string;
24
25
  storiesSearchUrl: string;
package/dist/routing.js CHANGED
@@ -19,6 +19,7 @@ export const routing = {
19
19
  newsroomPrivacyRequestsUrl: '/v2/newsrooms/:newsroom_id/privacy-requests',
20
20
  newsroomDomainsUrl: '/v2/newsrooms/:newsroom_id/domains',
21
21
  newsroomGalleriesUrl: '/v2/newsrooms/:newsroom_id/galleries',
22
+ notificationSubscriptionsUrl: '/v2/notification-subscriptions',
22
23
  senderAddressesUrl: '/v2/sender-addresses',
23
24
  storiesUrl: '/v2/stories',
24
25
  storiesSearchUrl: '/v2/stories/search',
@@ -0,0 +1,8 @@
1
+ import type { NotificationType } from './NotificationType';
2
+ export interface NotificationSubscription {
3
+ notification_type: NotificationType;
4
+ is_email_subscribed: boolean;
5
+ is_receiving: boolean;
6
+ missing_permissions: string[];
7
+ missing_features: string[];
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { NotificationTypeArea } from './NotificationTypeArea';
2
+ export interface NotificationType {
3
+ id: string;
4
+ title: string;
5
+ description: string | null;
6
+ area: NotificationTypeArea;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare enum NotificationTypeArea {
2
+ CAMPAIGNS = "Campaigns",
3
+ CONTACTS = "Contacts",
4
+ BILLING_AND_LEGAL = "Billing & Legal"
5
+ }
@@ -0,0 +1,6 @@
1
+ export let NotificationTypeArea;
2
+ (function (NotificationTypeArea) {
3
+ NotificationTypeArea["CAMPAIGNS"] = "Campaigns";
4
+ NotificationTypeArea["CONTACTS"] = "Contacts";
5
+ NotificationTypeArea["BILLING_AND_LEGAL"] = "Billing & Legal";
6
+ })(NotificationTypeArea || (NotificationTypeArea = {}));
@@ -27,3 +27,6 @@ export * from './Snippet';
27
27
  export * from './Story';
28
28
  export * from './User';
29
29
  export * from './UserAccount';
30
+ export * from './NotificationSubscription';
31
+ export * from './NotificationType';
32
+ export * from './NotificationTypeArea';
@@ -27,4 +27,7 @@ export * from "./SenderDomain.js";
27
27
  export * from "./Snippet.js";
28
28
  export * from "./Story.js";
29
29
  export * from "./User.js";
30
- export * from "./UserAccount.js";
30
+ export * from "./UserAccount.js";
31
+ export * from "./NotificationSubscription.js";
32
+ export * from "./NotificationType.js";
33
+ export * from "./NotificationTypeArea.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "10.0.0",
3
+ "version": "10.1.0-0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",