@prezly/sdk 11.12.0 → 12.0.1
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/NewsroomHub/Client.cjs +35 -4
- package/dist/endpoints/NewsroomHub/Client.d.ts +6 -3
- package/dist/endpoints/NewsroomHub/Client.js +34 -3
- package/dist/endpoints/NewsroomHub/types.d.ts +8 -4
- package/dist/types/Campaign.d.ts +1 -0
- package/package.json +1 -1
package/dist/api/constants.cjs
CHANGED
|
@@ -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 = "
|
|
7
|
+
const VERSION = "12.0.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;
|
package/dist/api/constants.js
CHANGED
|
@@ -10,14 +10,14 @@ class Client {
|
|
|
10
10
|
this.apiClient = apiClient;
|
|
11
11
|
}
|
|
12
12
|
async list(newsroomId) {
|
|
13
|
-
const url =
|
|
13
|
+
const url = generateUrl(newsroomId);
|
|
14
14
|
const {
|
|
15
15
|
members
|
|
16
16
|
} = await this.apiClient.get(url);
|
|
17
17
|
return members;
|
|
18
18
|
}
|
|
19
|
-
async
|
|
20
|
-
const url =
|
|
19
|
+
async linkMany(newsroomId, payload) {
|
|
20
|
+
const url = generateUrl(newsroomId);
|
|
21
21
|
const {
|
|
22
22
|
members
|
|
23
23
|
} = await this.apiClient.post(url, {
|
|
@@ -25,5 +25,36 @@ class Client {
|
|
|
25
25
|
});
|
|
26
26
|
return members;
|
|
27
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
|
+
}
|
|
28
52
|
}
|
|
29
|
-
exports.Client = Client;
|
|
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
|
+
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { DeferredJobsApiClient } from '../../api';
|
|
2
2
|
import type { NewsroomRef } from '../../types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LinkOptions, HubMember, LinkManyRequest } from './types';
|
|
4
4
|
declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
|
|
5
5
|
export declare class Client {
|
|
6
6
|
private readonly apiClient;
|
|
7
7
|
constructor(apiClient: DeferredJobsApiClient);
|
|
8
|
-
list(newsroomId: NewsroomId): Promise<
|
|
9
|
-
|
|
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>;
|
|
10
13
|
}
|
|
11
14
|
export {};
|
|
@@ -4,14 +4,14 @@ export class Client {
|
|
|
4
4
|
this.apiClient = apiClient;
|
|
5
5
|
}
|
|
6
6
|
async list(newsroomId) {
|
|
7
|
-
const url =
|
|
7
|
+
const url = generateUrl(newsroomId);
|
|
8
8
|
const {
|
|
9
9
|
members
|
|
10
10
|
} = await this.apiClient.get(url);
|
|
11
11
|
return members;
|
|
12
12
|
}
|
|
13
|
-
async
|
|
14
|
-
const url =
|
|
13
|
+
async linkMany(newsroomId, payload) {
|
|
14
|
+
const url = generateUrl(newsroomId);
|
|
15
15
|
const {
|
|
16
16
|
members
|
|
17
17
|
} = await this.apiClient.post(url, {
|
|
@@ -19,4 +19,35 @@ export class Client {
|
|
|
19
19
|
});
|
|
20
20
|
return members;
|
|
21
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)}`;
|
|
22
53
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { NewsroomRef } from '../../types';
|
|
2
2
|
declare type NewsroomId = NewsroomRef['uuid'] | NewsroomRef['id'];
|
|
3
|
+
export interface HubMember {
|
|
4
|
+
newsroom: NewsroomRef;
|
|
5
|
+
is_displaying_stories_in_hub: boolean;
|
|
6
|
+
}
|
|
3
7
|
export interface ListResponse {
|
|
4
|
-
members:
|
|
8
|
+
members: HubMember[];
|
|
5
9
|
}
|
|
6
|
-
export interface
|
|
10
|
+
export interface LinkManyRequest {
|
|
7
11
|
members: NewsroomId[];
|
|
8
12
|
}
|
|
9
|
-
export interface
|
|
10
|
-
|
|
13
|
+
export interface LinkOptions {
|
|
14
|
+
is_displaying_stories_in_hub?: boolean;
|
|
11
15
|
}
|
|
12
16
|
export {};
|
package/dist/types/Campaign.d.ts
CHANGED