@prezly/sdk 19.9.0 → 20.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 +28 -28
- package/dist/Client.d.ts +2 -1
- package/dist/Client.js +29 -29
- package/dist/api/ApiClient.cjs +36 -34
- package/dist/api/ApiClient.d.ts +8 -12
- package/dist/api/ApiClient.js +34 -31
- package/dist/api/DeferredJobsApiClient.cjs +20 -18
- package/dist/api/DeferredJobsApiClient.d.ts +8 -10
- package/dist/api/DeferredJobsApiClient.js +18 -15
- package/dist/api/constants.cjs +1 -1
- package/dist/api/constants.js +1 -1
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +2 -2
- package/dist/endpoints/Accounts/Client.cjs +14 -13
- package/dist/endpoints/Accounts/Client.d.ts +6 -7
- package/dist/endpoints/Accounts/Client.js +12 -10
- package/dist/endpoints/Billing/Client.cjs +11 -11
- package/dist/endpoints/Billing/Client.d.ts +5 -6
- package/dist/endpoints/Billing/Client.js +9 -8
- package/dist/endpoints/CampaignRecipients/Client.cjs +26 -21
- package/dist/endpoints/CampaignRecipients/Client.d.ts +13 -14
- package/dist/endpoints/CampaignRecipients/Client.js +24 -18
- package/dist/endpoints/Campaigns/Client.cjs +38 -29
- package/dist/endpoints/Campaigns/Client.d.ts +14 -15
- package/dist/endpoints/Campaigns/Client.js +36 -26
- package/dist/endpoints/Contacts/Client.cjs +41 -32
- package/dist/endpoints/Contacts/Client.d.ts +15 -22
- package/dist/endpoints/Contacts/Client.js +39 -29
- package/dist/endpoints/ContactsExports/Client.cjs +20 -18
- package/dist/endpoints/ContactsExports/Client.d.ts +8 -31
- package/dist/endpoints/ContactsExports/Client.js +18 -15
- package/dist/endpoints/Coverage/Client.cjs +29 -23
- package/dist/endpoints/Coverage/Client.d.ts +12 -13
- package/dist/endpoints/Coverage/Client.js +27 -20
- package/dist/endpoints/Jobs/Client.cjs +8 -9
- package/dist/endpoints/Jobs/Client.d.ts +4 -5
- package/dist/endpoints/Jobs/Client.js +6 -6
- package/dist/endpoints/Licenses/Client.cjs +8 -9
- package/dist/endpoints/Licenses/Client.d.ts +4 -5
- package/dist/endpoints/Licenses/Client.js +6 -6
- package/dist/endpoints/NewsroomCategories/Client.cjs +20 -17
- package/dist/endpoints/NewsroomCategories/Client.d.ts +8 -9
- package/dist/endpoints/NewsroomCategories/Client.js +18 -14
- package/dist/endpoints/NewsroomContacts/Client.cjs +23 -19
- package/dist/endpoints/NewsroomContacts/Client.d.ts +9 -10
- package/dist/endpoints/NewsroomContacts/Client.js +21 -16
- package/dist/endpoints/NewsroomDomains/Client.cjs +23 -19
- package/dist/endpoints/NewsroomDomains/Client.d.ts +9 -10
- package/dist/endpoints/NewsroomDomains/Client.js +21 -16
- package/dist/endpoints/NewsroomGalleries/Client.cjs +26 -21
- package/dist/endpoints/NewsroomGalleries/Client.d.ts +10 -11
- package/dist/endpoints/NewsroomGalleries/Client.js +24 -18
- package/dist/endpoints/NewsroomHub/Client.cjs +26 -23
- package/dist/endpoints/NewsroomHub/Client.d.ts +8 -9
- package/dist/endpoints/NewsroomHub/Client.js +25 -21
- package/dist/endpoints/NewsroomLanguages/Client.cjs +26 -21
- package/dist/endpoints/NewsroomLanguages/Client.d.ts +16 -24
- package/dist/endpoints/NewsroomLanguages/Client.js +24 -18
- package/dist/endpoints/NewsroomPrivacyRequests/Client.cjs +11 -11
- package/dist/endpoints/NewsroomPrivacyRequests/Client.d.ts +5 -6
- package/dist/endpoints/NewsroomPrivacyRequests/Client.js +9 -8
- package/dist/endpoints/NewsroomSubscriptions/Client.cjs +24 -13
- package/dist/endpoints/NewsroomSubscriptions/Client.d.ts +8 -9
- package/dist/endpoints/NewsroomSubscriptions/Client.js +23 -11
- package/dist/endpoints/NewsroomThemes/Client.cjs +17 -15
- package/dist/endpoints/NewsroomThemes/Client.d.ts +7 -8
- package/dist/endpoints/NewsroomThemes/Client.js +15 -12
- package/dist/endpoints/NewsroomWebhooks/Client.cjs +20 -17
- package/dist/endpoints/NewsroomWebhooks/Client.d.ts +8 -9
- package/dist/endpoints/NewsroomWebhooks/Client.js +18 -14
- package/dist/endpoints/Newsrooms/Client.cjs +35 -27
- package/dist/endpoints/Newsrooms/Client.d.ts +13 -14
- package/dist/endpoints/Newsrooms/Client.js +33 -24
- package/dist/endpoints/NotificationSubscriptions/Client.cjs +11 -11
- package/dist/endpoints/NotificationSubscriptions/Client.d.ts +5 -6
- package/dist/endpoints/NotificationSubscriptions/Client.js +9 -8
- package/dist/endpoints/PricingTables/Client.cjs +11 -11
- package/dist/endpoints/PricingTables/Client.d.ts +5 -6
- package/dist/endpoints/PricingTables/Client.js +9 -8
- package/dist/endpoints/SenderAddresses/Client.cjs +20 -17
- package/dist/endpoints/SenderAddresses/Client.d.ts +8 -9
- package/dist/endpoints/SenderAddresses/Client.js +18 -14
- package/dist/endpoints/Snippets/Client.cjs +20 -17
- package/dist/endpoints/Snippets/Client.d.ts +8 -9
- package/dist/endpoints/Snippets/Client.js +18 -14
- package/dist/endpoints/Stories/Client.cjs +63 -46
- package/dist/endpoints/Stories/Client.d.ts +109 -128
- package/dist/endpoints/Stories/Client.js +62 -44
- package/dist/endpoints/Subscriptions/Client.cjs +20 -17
- package/dist/endpoints/Subscriptions/Client.d.ts +8 -9
- package/dist/endpoints/Subscriptions/Client.js +18 -14
- package/package.json +1 -1
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
2
|
import { SortOrder } from "../../types/index.js";
|
|
3
|
-
export
|
|
4
|
-
constructor(apiClient) {
|
|
5
|
-
this.apiClient = apiClient;
|
|
6
|
-
}
|
|
7
|
-
|
|
3
|
+
export function createClient(api) {
|
|
8
4
|
/**
|
|
9
5
|
* @deprecated Use `subscribeToNewsroom` from `Subscriptions` instead
|
|
10
6
|
*/
|
|
11
|
-
async subscribe(newsroomId, payload) {
|
|
12
|
-
const url =
|
|
13
|
-
return
|
|
7
|
+
async function subscribe(newsroomId, payload) {
|
|
8
|
+
const url = generateUrl(newsroomId);
|
|
9
|
+
return api.post(url, {
|
|
14
10
|
payload
|
|
15
11
|
});
|
|
16
12
|
}
|
|
17
|
-
async list(newsroomId, {
|
|
13
|
+
async function list(newsroomId, {
|
|
18
14
|
limit,
|
|
19
15
|
offset,
|
|
20
16
|
search,
|
|
21
17
|
sortOrder
|
|
22
18
|
} = {}) {
|
|
23
|
-
const url =
|
|
24
|
-
return
|
|
19
|
+
const url = generateUrl(newsroomId);
|
|
20
|
+
return api.get(url, {
|
|
25
21
|
query: {
|
|
26
22
|
limit,
|
|
27
23
|
offset,
|
|
@@ -30,4 +26,20 @@ export class Client {
|
|
|
30
26
|
}
|
|
31
27
|
});
|
|
32
28
|
}
|
|
29
|
+
async function doExport(newsroomId) {
|
|
30
|
+
const url = generateUrl(newsroomId, '/export');
|
|
31
|
+
const response = await api.post(url);
|
|
32
|
+
return {
|
|
33
|
+
downloadUrl: response.download_url
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
subscribe,
|
|
38
|
+
list,
|
|
39
|
+
export: doExport
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function generateUrl(newsroomId, suffix = '') {
|
|
43
|
+
const url = routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
|
|
44
|
+
return url + suffix;
|
|
33
45
|
}
|
|
@@ -3,41 +3,43 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createClient = createClient;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.apiClient = apiClient;
|
|
11
|
-
}
|
|
12
|
-
async apply(newsroomId, themeId, settings) {
|
|
8
|
+
function createClient(api) {
|
|
9
|
+
async function apply(newsroomId, themeId, settings) {
|
|
13
10
|
const url = _routing.routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
14
11
|
const {
|
|
15
12
|
theme
|
|
16
|
-
} = await
|
|
13
|
+
} = await api.post(`${url}/${themeId}`, {
|
|
17
14
|
payload: settings
|
|
18
15
|
});
|
|
19
16
|
return theme;
|
|
20
17
|
}
|
|
21
|
-
async get(newsroomId, themeId) {
|
|
18
|
+
async function get(newsroomId, themeId) {
|
|
22
19
|
const url = _routing.routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
23
20
|
const {
|
|
24
21
|
theme
|
|
25
|
-
} = await
|
|
22
|
+
} = await api.get(`${url}/${themeId}`);
|
|
26
23
|
return theme;
|
|
27
24
|
}
|
|
28
|
-
async getActive(newsroomId) {
|
|
25
|
+
async function getActive(newsroomId) {
|
|
29
26
|
const url = _routing.routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
30
27
|
const {
|
|
31
28
|
theme
|
|
32
|
-
} = await
|
|
29
|
+
} = await api.get(`${url}/active`);
|
|
33
30
|
return theme;
|
|
34
31
|
}
|
|
35
|
-
async list(newsroomId) {
|
|
32
|
+
async function list(newsroomId) {
|
|
36
33
|
const url = _routing.routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
37
34
|
const {
|
|
38
35
|
themes
|
|
39
|
-
} = await
|
|
36
|
+
} = await api.get(url);
|
|
40
37
|
return themes;
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
return {
|
|
40
|
+
apply,
|
|
41
|
+
get,
|
|
42
|
+
getActive,
|
|
43
|
+
list
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -2,12 +2,11 @@ import type { DeferredJobsApiClient } from '../../api';
|
|
|
2
2
|
import type { Newsroom, NewsroomTheme, NewsroomThemePreset } from '../../types';
|
|
3
3
|
type NewsroomId = Newsroom['uuid'] | Newsroom['id'];
|
|
4
4
|
type NewsroomThemeId = NewsroomTheme['id'];
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
5
|
+
export type Client = ReturnType<typeof createClient>;
|
|
6
|
+
export declare function createClient(api: DeferredJobsApiClient): {
|
|
7
|
+
apply: (newsroomId: NewsroomId, themeId: NewsroomThemeId, settings: NewsroomThemePreset['settings']) => Promise<NewsroomThemePreset>;
|
|
8
|
+
get: (newsroomId: NewsroomId, themeId: NewsroomThemeId) => Promise<NewsroomThemePreset>;
|
|
9
|
+
getActive: (newsroomId: NewsroomId) => Promise<NewsroomThemePreset>;
|
|
10
|
+
list: (newsroomId: NewsroomId) => Promise<NewsroomThemePreset[]>;
|
|
11
|
+
};
|
|
13
12
|
export {};
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
this.apiClient = apiClient;
|
|
5
|
-
}
|
|
6
|
-
async apply(newsroomId, themeId, settings) {
|
|
2
|
+
export function createClient(api) {
|
|
3
|
+
async function apply(newsroomId, themeId, settings) {
|
|
7
4
|
const url = routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
8
5
|
const {
|
|
9
6
|
theme
|
|
10
|
-
} = await
|
|
7
|
+
} = await api.post(`${url}/${themeId}`, {
|
|
11
8
|
payload: settings
|
|
12
9
|
});
|
|
13
10
|
return theme;
|
|
14
11
|
}
|
|
15
|
-
async get(newsroomId, themeId) {
|
|
12
|
+
async function get(newsroomId, themeId) {
|
|
16
13
|
const url = routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
17
14
|
const {
|
|
18
15
|
theme
|
|
19
|
-
} = await
|
|
16
|
+
} = await api.get(`${url}/${themeId}`);
|
|
20
17
|
return theme;
|
|
21
18
|
}
|
|
22
|
-
async getActive(newsroomId) {
|
|
19
|
+
async function getActive(newsroomId) {
|
|
23
20
|
const url = routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
24
21
|
const {
|
|
25
22
|
theme
|
|
26
|
-
} = await
|
|
23
|
+
} = await api.get(`${url}/active`);
|
|
27
24
|
return theme;
|
|
28
25
|
}
|
|
29
|
-
async list(newsroomId) {
|
|
26
|
+
async function list(newsroomId) {
|
|
30
27
|
const url = routing.newsroomThemesUrl.replace(':newsroom_id', String(newsroomId));
|
|
31
28
|
const {
|
|
32
29
|
themes
|
|
33
|
-
} = await
|
|
30
|
+
} = await api.get(url);
|
|
34
31
|
return themes;
|
|
35
32
|
}
|
|
33
|
+
return {
|
|
34
|
+
apply,
|
|
35
|
+
get,
|
|
36
|
+
getActive,
|
|
37
|
+
list
|
|
38
|
+
};
|
|
36
39
|
}
|
|
@@ -3,47 +3,50 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createClient = createClient;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.apiClient = apiClient;
|
|
11
|
-
}
|
|
12
|
-
async list(newsroomId) {
|
|
8
|
+
function createClient(api) {
|
|
9
|
+
async function list(newsroomId) {
|
|
13
10
|
const url = _routing.routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
14
11
|
const {
|
|
15
12
|
webhooks
|
|
16
|
-
} = await
|
|
13
|
+
} = await api.get(url);
|
|
17
14
|
return webhooks;
|
|
18
15
|
}
|
|
19
|
-
async create(newsroomId, payload) {
|
|
16
|
+
async function create(newsroomId, payload) {
|
|
20
17
|
const url = _routing.routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
21
18
|
const {
|
|
22
19
|
webhook
|
|
23
|
-
} = await
|
|
20
|
+
} = await api.post(url, {
|
|
24
21
|
payload
|
|
25
22
|
});
|
|
26
23
|
return webhook;
|
|
27
24
|
}
|
|
28
|
-
async get(newsroomId, webhookId) {
|
|
25
|
+
async function get(newsroomId, webhookId) {
|
|
29
26
|
const url = _routing.routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
30
27
|
const {
|
|
31
28
|
webhook
|
|
32
|
-
} = await
|
|
29
|
+
} = await api.get(`${url}/${webhookId}`);
|
|
33
30
|
return webhook;
|
|
34
31
|
}
|
|
35
|
-
async update(newsroomId, webhookId, payload) {
|
|
32
|
+
async function update(newsroomId, webhookId, payload) {
|
|
36
33
|
const url = _routing.routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
37
34
|
const {
|
|
38
35
|
webhook
|
|
39
|
-
} = await
|
|
36
|
+
} = await api.patch(`${url}/${webhookId}`, {
|
|
40
37
|
payload
|
|
41
38
|
});
|
|
42
39
|
return webhook;
|
|
43
40
|
}
|
|
44
|
-
async
|
|
41
|
+
async function doDelete(newsroomId, webhookId) {
|
|
45
42
|
const url = _routing.routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
46
|
-
return
|
|
43
|
+
return api.delete(`${url}/${webhookId}`);
|
|
47
44
|
}
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
return {
|
|
46
|
+
list,
|
|
47
|
+
create,
|
|
48
|
+
get,
|
|
49
|
+
update,
|
|
50
|
+
delete: doDelete
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -2,13 +2,12 @@ import type { DeferredJobsApiClient } from '../../api';
|
|
|
2
2
|
import type { Newsroom, NewsroomWebhook } from '../../types';
|
|
3
3
|
import type { CreateRequest, UpdateRequest } from './types';
|
|
4
4
|
type NewsroomId = Newsroom['uuid'] | Newsroom['id'];
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
export type Client = ReturnType<typeof createClient>;
|
|
6
|
+
export declare function createClient(api: DeferredJobsApiClient): {
|
|
7
|
+
list: (newsroomId: NewsroomId) => Promise<NewsroomWebhook[]>;
|
|
8
|
+
create: (newsroomId: NewsroomId, payload: CreateRequest) => Promise<NewsroomWebhook>;
|
|
9
|
+
get: (newsroomId: NewsroomId, webhookId: NewsroomWebhook['id']) => Promise<NewsroomWebhook>;
|
|
10
|
+
update: (newsroomId: NewsroomId, webhookId: NewsroomWebhook['id'], payload: UpdateRequest) => Promise<NewsroomWebhook>;
|
|
11
|
+
delete: (newsroomId: NewsroomId, webhookId: NewsroomWebhook['id']) => Promise<void>;
|
|
12
|
+
};
|
|
14
13
|
export {};
|
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
this.apiClient = apiClient;
|
|
5
|
-
}
|
|
6
|
-
async list(newsroomId) {
|
|
2
|
+
export function createClient(api) {
|
|
3
|
+
async function list(newsroomId) {
|
|
7
4
|
const url = routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
8
5
|
const {
|
|
9
6
|
webhooks
|
|
10
|
-
} = await
|
|
7
|
+
} = await api.get(url);
|
|
11
8
|
return webhooks;
|
|
12
9
|
}
|
|
13
|
-
async create(newsroomId, payload) {
|
|
10
|
+
async function create(newsroomId, payload) {
|
|
14
11
|
const url = routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
15
12
|
const {
|
|
16
13
|
webhook
|
|
17
|
-
} = await
|
|
14
|
+
} = await api.post(url, {
|
|
18
15
|
payload
|
|
19
16
|
});
|
|
20
17
|
return webhook;
|
|
21
18
|
}
|
|
22
|
-
async get(newsroomId, webhookId) {
|
|
19
|
+
async function get(newsroomId, webhookId) {
|
|
23
20
|
const url = routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
24
21
|
const {
|
|
25
22
|
webhook
|
|
26
|
-
} = await
|
|
23
|
+
} = await api.get(`${url}/${webhookId}`);
|
|
27
24
|
return webhook;
|
|
28
25
|
}
|
|
29
|
-
async update(newsroomId, webhookId, payload) {
|
|
26
|
+
async function update(newsroomId, webhookId, payload) {
|
|
30
27
|
const url = routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
31
28
|
const {
|
|
32
29
|
webhook
|
|
33
|
-
} = await
|
|
30
|
+
} = await api.patch(`${url}/${webhookId}`, {
|
|
34
31
|
payload
|
|
35
32
|
});
|
|
36
33
|
return webhook;
|
|
37
34
|
}
|
|
38
|
-
async
|
|
35
|
+
async function doDelete(newsroomId, webhookId) {
|
|
39
36
|
const url = routing.newsroomWebhooksUrl.replace(':newsroom_id', String(newsroomId));
|
|
40
|
-
return
|
|
37
|
+
return api.delete(`${url}/${webhookId}`);
|
|
41
38
|
}
|
|
39
|
+
return {
|
|
40
|
+
list,
|
|
41
|
+
create,
|
|
42
|
+
get,
|
|
43
|
+
update,
|
|
44
|
+
delete: doDelete
|
|
45
|
+
};
|
|
42
46
|
}
|
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createClient = createClient;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
8
|
var _index = require("../../types/index.cjs");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.apiClient = apiClient;
|
|
12
|
-
}
|
|
13
|
-
async list({
|
|
9
|
+
function createClient(api) {
|
|
10
|
+
async function list({
|
|
14
11
|
limit,
|
|
15
12
|
offset,
|
|
16
13
|
search,
|
|
17
14
|
sortOrder
|
|
18
15
|
} = {}) {
|
|
19
|
-
return
|
|
16
|
+
return api.get(_routing.routing.newsroomsUrl, {
|
|
20
17
|
query: {
|
|
21
18
|
limit,
|
|
22
19
|
offset,
|
|
@@ -25,7 +22,7 @@ class Client {
|
|
|
25
22
|
}
|
|
26
23
|
});
|
|
27
24
|
}
|
|
28
|
-
async search(options = {}) {
|
|
25
|
+
async function search(options = {}) {
|
|
29
26
|
const {
|
|
30
27
|
query,
|
|
31
28
|
limit,
|
|
@@ -34,7 +31,7 @@ class Client {
|
|
|
34
31
|
sortOrder
|
|
35
32
|
} = options;
|
|
36
33
|
// TODO: Introduce dedicated Search POST API
|
|
37
|
-
return
|
|
34
|
+
return api.get(_routing.routing.newsroomsUrl, {
|
|
38
35
|
query: {
|
|
39
36
|
query: _index.Query.stringify(query),
|
|
40
37
|
limit,
|
|
@@ -44,54 +41,65 @@ class Client {
|
|
|
44
41
|
}
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
|
-
async get(id) {
|
|
44
|
+
async function get(id) {
|
|
48
45
|
const {
|
|
49
46
|
newsroom
|
|
50
|
-
} = await
|
|
47
|
+
} = await api.get(`${_routing.routing.newsroomsUrl}/${id}`);
|
|
51
48
|
return newsroom;
|
|
52
49
|
}
|
|
53
|
-
async create(payload) {
|
|
50
|
+
async function create(payload) {
|
|
54
51
|
const {
|
|
55
52
|
newsroom
|
|
56
|
-
} = await
|
|
53
|
+
} = await api.post(_routing.routing.newsroomsUrl, {
|
|
57
54
|
payload
|
|
58
55
|
});
|
|
59
56
|
return newsroom;
|
|
60
57
|
}
|
|
61
|
-
async update(id, payload) {
|
|
58
|
+
async function update(id, payload) {
|
|
62
59
|
const {
|
|
63
60
|
newsroom
|
|
64
|
-
} = await
|
|
61
|
+
} = await api.patch(`${_routing.routing.newsroomsUrl}/${id}`, {
|
|
65
62
|
payload
|
|
66
63
|
});
|
|
67
64
|
return newsroom;
|
|
68
65
|
}
|
|
69
|
-
async archive(id) {
|
|
66
|
+
async function archive(id) {
|
|
70
67
|
const {
|
|
71
68
|
newsroom
|
|
72
|
-
} = await
|
|
69
|
+
} = await api.post(`${_routing.routing.newsroomsUrl}/${id}/archive`);
|
|
73
70
|
return newsroom;
|
|
74
71
|
}
|
|
75
|
-
async unarchive(id) {
|
|
72
|
+
async function unarchive(id) {
|
|
76
73
|
const {
|
|
77
74
|
newsroom
|
|
78
|
-
} = await
|
|
75
|
+
} = await api.post(`${_routing.routing.newsroomsUrl}/${id}/unarchive`);
|
|
79
76
|
return newsroom;
|
|
80
77
|
}
|
|
81
|
-
async
|
|
82
|
-
return
|
|
78
|
+
async function doDelete(id) {
|
|
79
|
+
return api.delete(`${_routing.routing.newsroomsUrl}/${id}`);
|
|
83
80
|
}
|
|
84
|
-
async takeOffline(id) {
|
|
81
|
+
async function takeOffline(id) {
|
|
85
82
|
const {
|
|
86
83
|
newsroom
|
|
87
|
-
} = await
|
|
84
|
+
} = await api.post(`${_routing.routing.newsroomsUrl}/${id}/offline`);
|
|
88
85
|
return newsroom;
|
|
89
86
|
}
|
|
90
|
-
async takeOnline(id) {
|
|
87
|
+
async function takeOnline(id) {
|
|
91
88
|
const {
|
|
92
89
|
newsroom
|
|
93
|
-
} = await
|
|
90
|
+
} = await api.post(`${_routing.routing.newsroomsUrl}/${id}/online`);
|
|
94
91
|
return newsroom;
|
|
95
92
|
}
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
return {
|
|
94
|
+
list,
|
|
95
|
+
search,
|
|
96
|
+
get,
|
|
97
|
+
create,
|
|
98
|
+
update,
|
|
99
|
+
archive,
|
|
100
|
+
unarchive,
|
|
101
|
+
delete: doDelete,
|
|
102
|
+
takeOnline,
|
|
103
|
+
takeOffline
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -2,18 +2,17 @@ import type { DeferredJobsApiClient } from '../../api';
|
|
|
2
2
|
import type { Newsroom } from '../../types';
|
|
3
3
|
import type { CreateRequest, ListOptions, ListResponse, SearchOptions, UpdateRequest } from './types';
|
|
4
4
|
type NewsroomId = Newsroom['uuid'] | Newsroom['id'];
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
takeOffline(id: NewsroomId)
|
|
17
|
-
|
|
18
|
-
}
|
|
5
|
+
export type Client = ReturnType<typeof createClient>;
|
|
6
|
+
export declare function createClient(api: DeferredJobsApiClient): {
|
|
7
|
+
list: ({ limit, offset, search, sortOrder, }?: ListOptions) => Promise<ListResponse>;
|
|
8
|
+
search: (options?: SearchOptions) => Promise<ListResponse>;
|
|
9
|
+
get: (id: NewsroomId) => Promise<Newsroom>;
|
|
10
|
+
create: (payload: CreateRequest) => Promise<Newsroom>;
|
|
11
|
+
update: (id: NewsroomId, payload: UpdateRequest) => Promise<Newsroom>;
|
|
12
|
+
archive: (id: NewsroomId) => Promise<Newsroom>;
|
|
13
|
+
unarchive: (id: NewsroomId) => Promise<Newsroom>;
|
|
14
|
+
delete: (id: NewsroomId) => Promise<void>;
|
|
15
|
+
takeOnline: (id: NewsroomId) => Promise<Newsroom>;
|
|
16
|
+
takeOffline: (id: NewsroomId) => Promise<Newsroom>;
|
|
17
|
+
};
|
|
19
18
|
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { routing } from "../../routing.js";
|
|
2
2
|
import { Query, SortOrder } from "../../types/index.js";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
this.apiClient = apiClient;
|
|
6
|
-
}
|
|
7
|
-
async list({
|
|
3
|
+
export function createClient(api) {
|
|
4
|
+
async function list({
|
|
8
5
|
limit,
|
|
9
6
|
offset,
|
|
10
7
|
search,
|
|
11
8
|
sortOrder
|
|
12
9
|
} = {}) {
|
|
13
|
-
return
|
|
10
|
+
return api.get(routing.newsroomsUrl, {
|
|
14
11
|
query: {
|
|
15
12
|
limit,
|
|
16
13
|
offset,
|
|
@@ -19,7 +16,7 @@ export class Client {
|
|
|
19
16
|
}
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
async search(options = {}) {
|
|
19
|
+
async function search(options = {}) {
|
|
23
20
|
const {
|
|
24
21
|
query,
|
|
25
22
|
limit,
|
|
@@ -28,7 +25,7 @@ export class Client {
|
|
|
28
25
|
sortOrder
|
|
29
26
|
} = options;
|
|
30
27
|
// TODO: Introduce dedicated Search POST API
|
|
31
|
-
return
|
|
28
|
+
return api.get(routing.newsroomsUrl, {
|
|
32
29
|
query: {
|
|
33
30
|
query: Query.stringify(query),
|
|
34
31
|
limit,
|
|
@@ -38,53 +35,65 @@ export class Client {
|
|
|
38
35
|
}
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
|
-
async get(id) {
|
|
38
|
+
async function get(id) {
|
|
42
39
|
const {
|
|
43
40
|
newsroom
|
|
44
|
-
} = await
|
|
41
|
+
} = await api.get(`${routing.newsroomsUrl}/${id}`);
|
|
45
42
|
return newsroom;
|
|
46
43
|
}
|
|
47
|
-
async create(payload) {
|
|
44
|
+
async function create(payload) {
|
|
48
45
|
const {
|
|
49
46
|
newsroom
|
|
50
|
-
} = await
|
|
47
|
+
} = await api.post(routing.newsroomsUrl, {
|
|
51
48
|
payload
|
|
52
49
|
});
|
|
53
50
|
return newsroom;
|
|
54
51
|
}
|
|
55
|
-
async update(id, payload) {
|
|
52
|
+
async function update(id, payload) {
|
|
56
53
|
const {
|
|
57
54
|
newsroom
|
|
58
|
-
} = await
|
|
55
|
+
} = await api.patch(`${routing.newsroomsUrl}/${id}`, {
|
|
59
56
|
payload
|
|
60
57
|
});
|
|
61
58
|
return newsroom;
|
|
62
59
|
}
|
|
63
|
-
async archive(id) {
|
|
60
|
+
async function archive(id) {
|
|
64
61
|
const {
|
|
65
62
|
newsroom
|
|
66
|
-
} = await
|
|
63
|
+
} = await api.post(`${routing.newsroomsUrl}/${id}/archive`);
|
|
67
64
|
return newsroom;
|
|
68
65
|
}
|
|
69
|
-
async unarchive(id) {
|
|
66
|
+
async function unarchive(id) {
|
|
70
67
|
const {
|
|
71
68
|
newsroom
|
|
72
|
-
} = await
|
|
69
|
+
} = await api.post(`${routing.newsroomsUrl}/${id}/unarchive`);
|
|
73
70
|
return newsroom;
|
|
74
71
|
}
|
|
75
|
-
async
|
|
76
|
-
return
|
|
72
|
+
async function doDelete(id) {
|
|
73
|
+
return api.delete(`${routing.newsroomsUrl}/${id}`);
|
|
77
74
|
}
|
|
78
|
-
async takeOffline(id) {
|
|
75
|
+
async function takeOffline(id) {
|
|
79
76
|
const {
|
|
80
77
|
newsroom
|
|
81
|
-
} = await
|
|
78
|
+
} = await api.post(`${routing.newsroomsUrl}/${id}/offline`);
|
|
82
79
|
return newsroom;
|
|
83
80
|
}
|
|
84
|
-
async takeOnline(id) {
|
|
81
|
+
async function takeOnline(id) {
|
|
85
82
|
const {
|
|
86
83
|
newsroom
|
|
87
|
-
} = await
|
|
84
|
+
} = await api.post(`${routing.newsroomsUrl}/${id}/online`);
|
|
88
85
|
return newsroom;
|
|
89
86
|
}
|
|
87
|
+
return {
|
|
88
|
+
list,
|
|
89
|
+
search,
|
|
90
|
+
get,
|
|
91
|
+
create,
|
|
92
|
+
update,
|
|
93
|
+
archive,
|
|
94
|
+
unarchive,
|
|
95
|
+
delete: doDelete,
|
|
96
|
+
takeOnline,
|
|
97
|
+
takeOffline
|
|
98
|
+
};
|
|
90
99
|
}
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createClient = createClient;
|
|
7
7
|
var _routing = require("../../routing.cjs");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.apiClient = apiClient;
|
|
11
|
-
}
|
|
12
|
-
async list() {
|
|
8
|
+
function createClient(api) {
|
|
9
|
+
async function list() {
|
|
13
10
|
const url = _routing.routing.notificationSubscriptionsUrl;
|
|
14
11
|
const {
|
|
15
12
|
subscriptions
|
|
16
|
-
} = await
|
|
13
|
+
} = await api.get(url);
|
|
17
14
|
return subscriptions;
|
|
18
15
|
}
|
|
19
|
-
async update(payload) {
|
|
16
|
+
async function update(payload) {
|
|
20
17
|
const url = _routing.routing.notificationSubscriptionsUrl;
|
|
21
18
|
const {
|
|
22
19
|
subscriptions
|
|
23
|
-
} = await
|
|
20
|
+
} = await api.patch(url, {
|
|
24
21
|
payload
|
|
25
22
|
});
|
|
26
23
|
return subscriptions;
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
return {
|
|
26
|
+
list,
|
|
27
|
+
update
|
|
28
|
+
};
|
|
29
|
+
}
|