@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
package/dist/Client.cjs
CHANGED
|
@@ -17,38 +17,38 @@ function createClient({
|
|
|
17
17
|
const http = (0, _index3.createHttpClient)({
|
|
18
18
|
fetch
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const api = (0, _index.createDeferredJobsApiClient)(http, (0, _index.createApiClient)(http, {
|
|
21
21
|
accessToken,
|
|
22
22
|
baseUrl,
|
|
23
23
|
headers
|
|
24
24
|
}));
|
|
25
25
|
return {
|
|
26
|
-
api
|
|
27
|
-
accounts:
|
|
28
|
-
billing:
|
|
29
|
-
campaigns:
|
|
30
|
-
campaignRecipients:
|
|
31
|
-
contacts:
|
|
32
|
-
contactsExports:
|
|
33
|
-
coverage:
|
|
34
|
-
jobs:
|
|
35
|
-
licenses:
|
|
36
|
-
newsrooms:
|
|
37
|
-
newsroomCategories:
|
|
38
|
-
newsroomContacts:
|
|
39
|
-
newsroomLanguages:
|
|
40
|
-
newsroomThemes:
|
|
41
|
-
newsroomWebhooks:
|
|
42
|
-
newsroomPrivacyRequests:
|
|
43
|
-
newsroomDomains:
|
|
44
|
-
newsroomGalleries:
|
|
45
|
-
newsroomHub:
|
|
46
|
-
newsroomSubscriptions:
|
|
47
|
-
pricingTables:
|
|
48
|
-
senderAddresses:
|
|
49
|
-
stories:
|
|
50
|
-
snippets:
|
|
51
|
-
subscriptions:
|
|
52
|
-
notificationSubscriptions:
|
|
26
|
+
api,
|
|
27
|
+
accounts: _index2.Accounts.createClient(api),
|
|
28
|
+
billing: _index2.Billing.createClient(api),
|
|
29
|
+
campaigns: _index2.Campaigns.createClient(api),
|
|
30
|
+
campaignRecipients: _index2.CampaignRecipients.createClient(api),
|
|
31
|
+
contacts: _index2.Contacts.createClient(api),
|
|
32
|
+
contactsExports: _index2.ContactsExports.createClient(api),
|
|
33
|
+
coverage: _index2.Coverage.createClient(api),
|
|
34
|
+
jobs: _index2.Jobs.createClient(api),
|
|
35
|
+
licenses: _index2.Licenses.createClient(api),
|
|
36
|
+
newsrooms: _index2.Newsrooms.createClient(api),
|
|
37
|
+
newsroomCategories: _index2.NewsroomCategories.createClient(api),
|
|
38
|
+
newsroomContacts: _index2.NewsroomContacts.createClient(api),
|
|
39
|
+
newsroomLanguages: _index2.NewsroomLanguages.createClient(api),
|
|
40
|
+
newsroomThemes: _index2.NewsroomThemes.createClient(api),
|
|
41
|
+
newsroomWebhooks: _index2.NewsroomWebhooks.createClient(api),
|
|
42
|
+
newsroomPrivacyRequests: _index2.NewsroomPrivacyRequests.createClient(api),
|
|
43
|
+
newsroomDomains: _index2.NewsroomDomains.createClient(api),
|
|
44
|
+
newsroomGalleries: _index2.NewsroomGalleries.createClient(api),
|
|
45
|
+
newsroomHub: _index2.NewsroomHub.createClient(api),
|
|
46
|
+
newsroomSubscriptions: _index2.NewsroomSubscriptions.createClient(api),
|
|
47
|
+
pricingTables: _index2.PricingTables.createClient(api),
|
|
48
|
+
senderAddresses: _index2.SenderAddresses.createClient(api),
|
|
49
|
+
stories: _index2.Stories.createClient(api),
|
|
50
|
+
snippets: _index2.Snippets.createClient(api),
|
|
51
|
+
subscriptions: _index2.Subscriptions.createClient(api),
|
|
52
|
+
notificationSubscriptions: _index2.NotificationSubscriptions.createClient(api)
|
|
53
53
|
};
|
|
54
54
|
}
|
package/dist/Client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DeferredJobsApiClient
|
|
1
|
+
import type { DeferredJobsApiClient } from './api';
|
|
2
|
+
import { type Fetch } from './api';
|
|
2
3
|
import { Contacts } from './endpoints';
|
|
3
4
|
import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from './endpoints';
|
|
4
5
|
import type { HeadersMap } from './http';
|
package/dist/Client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createApiClient, createDeferredJobsApiClient } from "./api/index.js";
|
|
2
2
|
import { Contacts } from "./endpoints/index.js";
|
|
3
3
|
import { Accounts, Billing, NewsroomSubscriptions, Campaigns, CampaignRecipients, ContactsExports, Coverage, Jobs, Licenses, Newsrooms, NewsroomCategories, NewsroomContacts, NewsroomLanguages, NewsroomThemes, NewsroomWebhooks, NewsroomPrivacyRequests, NewsroomDomains, NewsroomGalleries, NewsroomHub, PricingTables, SenderAddresses, Stories, Snippets, Subscriptions, NotificationSubscriptions } from "./endpoints/index.js";
|
|
4
4
|
import { createHttpClient } from "./http/index.js";
|
|
@@ -12,38 +12,38 @@ export function createClient({
|
|
|
12
12
|
const http = createHttpClient({
|
|
13
13
|
fetch
|
|
14
14
|
});
|
|
15
|
-
const
|
|
15
|
+
const api = createDeferredJobsApiClient(http, createApiClient(http, {
|
|
16
16
|
accessToken,
|
|
17
17
|
baseUrl,
|
|
18
18
|
headers
|
|
19
19
|
}));
|
|
20
20
|
return {
|
|
21
|
-
api
|
|
22
|
-
accounts:
|
|
23
|
-
billing:
|
|
24
|
-
campaigns:
|
|
25
|
-
campaignRecipients:
|
|
26
|
-
contacts:
|
|
27
|
-
contactsExports:
|
|
28
|
-
coverage:
|
|
29
|
-
jobs:
|
|
30
|
-
licenses:
|
|
31
|
-
newsrooms:
|
|
32
|
-
newsroomCategories:
|
|
33
|
-
newsroomContacts:
|
|
34
|
-
newsroomLanguages:
|
|
35
|
-
newsroomThemes:
|
|
36
|
-
newsroomWebhooks:
|
|
37
|
-
newsroomPrivacyRequests:
|
|
38
|
-
newsroomDomains:
|
|
39
|
-
newsroomGalleries:
|
|
40
|
-
newsroomHub:
|
|
41
|
-
newsroomSubscriptions:
|
|
42
|
-
pricingTables:
|
|
43
|
-
senderAddresses:
|
|
44
|
-
stories:
|
|
45
|
-
snippets:
|
|
46
|
-
subscriptions:
|
|
47
|
-
notificationSubscriptions:
|
|
21
|
+
api,
|
|
22
|
+
accounts: Accounts.createClient(api),
|
|
23
|
+
billing: Billing.createClient(api),
|
|
24
|
+
campaigns: Campaigns.createClient(api),
|
|
25
|
+
campaignRecipients: CampaignRecipients.createClient(api),
|
|
26
|
+
contacts: Contacts.createClient(api),
|
|
27
|
+
contactsExports: ContactsExports.createClient(api),
|
|
28
|
+
coverage: Coverage.createClient(api),
|
|
29
|
+
jobs: Jobs.createClient(api),
|
|
30
|
+
licenses: Licenses.createClient(api),
|
|
31
|
+
newsrooms: Newsrooms.createClient(api),
|
|
32
|
+
newsroomCategories: NewsroomCategories.createClient(api),
|
|
33
|
+
newsroomContacts: NewsroomContacts.createClient(api),
|
|
34
|
+
newsroomLanguages: NewsroomLanguages.createClient(api),
|
|
35
|
+
newsroomThemes: NewsroomThemes.createClient(api),
|
|
36
|
+
newsroomWebhooks: NewsroomWebhooks.createClient(api),
|
|
37
|
+
newsroomPrivacyRequests: NewsroomPrivacyRequests.createClient(api),
|
|
38
|
+
newsroomDomains: NewsroomDomains.createClient(api),
|
|
39
|
+
newsroomGalleries: NewsroomGalleries.createClient(api),
|
|
40
|
+
newsroomHub: NewsroomHub.createClient(api),
|
|
41
|
+
newsroomSubscriptions: NewsroomSubscriptions.createClient(api),
|
|
42
|
+
pricingTables: PricingTables.createClient(api),
|
|
43
|
+
senderAddresses: SenderAddresses.createClient(api),
|
|
44
|
+
stories: Stories.createClient(api),
|
|
45
|
+
snippets: Snippets.createClient(api),
|
|
46
|
+
subscriptions: Subscriptions.createClient(api),
|
|
47
|
+
notificationSubscriptions: NotificationSubscriptions.createClient(api)
|
|
48
48
|
};
|
|
49
49
|
}
|
package/dist/api/ApiClient.cjs
CHANGED
|
@@ -3,93 +3,95 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createApiClient = createApiClient;
|
|
7
7
|
var _utils = require("../utils.cjs");
|
|
8
8
|
var _constants = require("./constants.cjs");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
9
|
+
function createApiClient(http, {
|
|
10
|
+
accessToken,
|
|
11
|
+
baseUrl,
|
|
12
|
+
headers
|
|
13
|
+
}) {
|
|
14
|
+
const defaultHeaders = {
|
|
15
|
+
authorization: `Bearer ${accessToken}`,
|
|
16
|
+
'User-Agent': _constants.DEFAULT_USER_AGENT,
|
|
17
|
+
...headers
|
|
18
|
+
};
|
|
19
|
+
function buildEndpointUrl(endpointUri) {
|
|
20
|
+
return `${(0, _utils.stripSlashes)(baseUrl)}/${(0, _utils.stripSlashes)(endpointUri)}`;
|
|
22
21
|
}
|
|
23
|
-
get(endpointUri, {
|
|
22
|
+
function get(endpointUri, {
|
|
24
23
|
headers,
|
|
25
24
|
query
|
|
26
25
|
} = {}) {
|
|
27
|
-
return
|
|
26
|
+
return http.get(buildEndpointUrl(endpointUri), {
|
|
28
27
|
headers: {
|
|
29
|
-
...
|
|
28
|
+
...defaultHeaders,
|
|
30
29
|
...headers
|
|
31
30
|
},
|
|
32
31
|
query
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
|
-
post(endpointUri, {
|
|
34
|
+
function post(endpointUri, {
|
|
36
35
|
headers,
|
|
37
36
|
payload,
|
|
38
37
|
query
|
|
39
38
|
} = {}) {
|
|
40
|
-
return
|
|
39
|
+
return http.post(buildEndpointUrl(endpointUri), {
|
|
41
40
|
headers: {
|
|
42
|
-
...
|
|
41
|
+
...defaultHeaders,
|
|
43
42
|
...headers
|
|
44
43
|
},
|
|
45
44
|
payload,
|
|
46
45
|
query
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
|
-
put(endpointUri, {
|
|
48
|
+
function put(endpointUri, {
|
|
50
49
|
headers,
|
|
51
50
|
payload,
|
|
52
51
|
query
|
|
53
52
|
} = {}) {
|
|
54
|
-
return
|
|
53
|
+
return http.put(buildEndpointUrl(endpointUri), {
|
|
55
54
|
headers: {
|
|
56
|
-
...
|
|
55
|
+
...defaultHeaders,
|
|
57
56
|
...headers
|
|
58
57
|
},
|
|
59
58
|
payload,
|
|
60
59
|
query
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
|
-
patch(endpointUri, {
|
|
62
|
+
function patch(endpointUri, {
|
|
64
63
|
headers,
|
|
65
64
|
payload,
|
|
66
65
|
query
|
|
67
66
|
} = {}) {
|
|
68
|
-
return
|
|
67
|
+
return http.patch(buildEndpointUrl(endpointUri), {
|
|
69
68
|
headers: {
|
|
70
|
-
...
|
|
69
|
+
...defaultHeaders,
|
|
71
70
|
...headers
|
|
72
71
|
},
|
|
73
72
|
payload,
|
|
74
73
|
query
|
|
75
74
|
});
|
|
76
75
|
}
|
|
77
|
-
|
|
76
|
+
function doDelete(endpointUri, {
|
|
78
77
|
headers,
|
|
79
78
|
payload,
|
|
80
79
|
query
|
|
81
80
|
} = {}) {
|
|
82
|
-
return
|
|
81
|
+
return http.delete(buildEndpointUrl(endpointUri), {
|
|
83
82
|
headers: {
|
|
84
|
-
...
|
|
83
|
+
...defaultHeaders,
|
|
85
84
|
...headers
|
|
86
85
|
},
|
|
87
86
|
payload,
|
|
88
87
|
query
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
return {
|
|
91
|
+
get,
|
|
92
|
+
post,
|
|
93
|
+
put,
|
|
94
|
+
patch,
|
|
95
|
+
delete: doDelete
|
|
96
|
+
};
|
|
97
|
+
}
|
package/dist/api/ApiClient.d.ts
CHANGED
|
@@ -4,15 +4,11 @@ export interface Options {
|
|
|
4
4
|
baseUrl: string;
|
|
5
5
|
headers: HeadersMap;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
patch<V = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload): Promise<ApiResponse<V>>;
|
|
16
|
-
delete<V = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload): Promise<ApiResponse<V>>;
|
|
17
|
-
private buildEndpointUrl;
|
|
18
|
-
}
|
|
7
|
+
export type ApiClient = ReturnType<typeof createApiClient>;
|
|
8
|
+
export declare function createApiClient(http: HttpClient, { accessToken, baseUrl, headers }: Options): {
|
|
9
|
+
get: <V = any>(endpointUri: string, { headers, query }?: Params) => Promise<ApiResponse<V>>;
|
|
10
|
+
post: <V_1 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => Promise<ApiResponse<V_1>>;
|
|
11
|
+
put: <V_2 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => Promise<ApiResponse<V_2>>;
|
|
12
|
+
patch: <V_3 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => Promise<ApiResponse<V_3>>;
|
|
13
|
+
delete: <V_4 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => Promise<ApiResponse<V_4>>;
|
|
14
|
+
};
|
package/dist/api/ApiClient.js
CHANGED
|
@@ -1,88 +1,91 @@
|
|
|
1
1
|
import { stripSlashes } from "../utils.js";
|
|
2
2
|
import { DEFAULT_USER_AGENT } from "./constants.js";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
3
|
+
export function createApiClient(http, {
|
|
4
|
+
accessToken,
|
|
5
|
+
baseUrl,
|
|
6
|
+
headers
|
|
7
|
+
}) {
|
|
8
|
+
const defaultHeaders = {
|
|
9
|
+
authorization: `Bearer ${accessToken}`,
|
|
10
|
+
'User-Agent': DEFAULT_USER_AGENT,
|
|
11
|
+
...headers
|
|
12
|
+
};
|
|
13
|
+
function buildEndpointUrl(endpointUri) {
|
|
14
|
+
return `${stripSlashes(baseUrl)}/${stripSlashes(endpointUri)}`;
|
|
16
15
|
}
|
|
17
|
-
get(endpointUri, {
|
|
16
|
+
function get(endpointUri, {
|
|
18
17
|
headers,
|
|
19
18
|
query
|
|
20
19
|
} = {}) {
|
|
21
|
-
return
|
|
20
|
+
return http.get(buildEndpointUrl(endpointUri), {
|
|
22
21
|
headers: {
|
|
23
|
-
...
|
|
22
|
+
...defaultHeaders,
|
|
24
23
|
...headers
|
|
25
24
|
},
|
|
26
25
|
query
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
|
-
post(endpointUri, {
|
|
28
|
+
function post(endpointUri, {
|
|
30
29
|
headers,
|
|
31
30
|
payload,
|
|
32
31
|
query
|
|
33
32
|
} = {}) {
|
|
34
|
-
return
|
|
33
|
+
return http.post(buildEndpointUrl(endpointUri), {
|
|
35
34
|
headers: {
|
|
36
|
-
...
|
|
35
|
+
...defaultHeaders,
|
|
37
36
|
...headers
|
|
38
37
|
},
|
|
39
38
|
payload,
|
|
40
39
|
query
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
put(endpointUri, {
|
|
42
|
+
function put(endpointUri, {
|
|
44
43
|
headers,
|
|
45
44
|
payload,
|
|
46
45
|
query
|
|
47
46
|
} = {}) {
|
|
48
|
-
return
|
|
47
|
+
return http.put(buildEndpointUrl(endpointUri), {
|
|
49
48
|
headers: {
|
|
50
|
-
...
|
|
49
|
+
...defaultHeaders,
|
|
51
50
|
...headers
|
|
52
51
|
},
|
|
53
52
|
payload,
|
|
54
53
|
query
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
patch(endpointUri, {
|
|
56
|
+
function patch(endpointUri, {
|
|
58
57
|
headers,
|
|
59
58
|
payload,
|
|
60
59
|
query
|
|
61
60
|
} = {}) {
|
|
62
|
-
return
|
|
61
|
+
return http.patch(buildEndpointUrl(endpointUri), {
|
|
63
62
|
headers: {
|
|
64
|
-
...
|
|
63
|
+
...defaultHeaders,
|
|
65
64
|
...headers
|
|
66
65
|
},
|
|
67
66
|
payload,
|
|
68
67
|
query
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
function doDelete(endpointUri, {
|
|
72
71
|
headers,
|
|
73
72
|
payload,
|
|
74
73
|
query
|
|
75
74
|
} = {}) {
|
|
76
|
-
return
|
|
75
|
+
return http.delete(buildEndpointUrl(endpointUri), {
|
|
77
76
|
headers: {
|
|
78
|
-
...
|
|
77
|
+
...defaultHeaders,
|
|
79
78
|
...headers
|
|
80
79
|
},
|
|
81
80
|
payload,
|
|
82
81
|
query
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
return {
|
|
85
|
+
get,
|
|
86
|
+
post,
|
|
87
|
+
put,
|
|
88
|
+
patch,
|
|
89
|
+
delete: doDelete
|
|
90
|
+
};
|
|
88
91
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createDeferredJobsApiClient = createDeferredJobsApiClient;
|
|
7
7
|
var _progressPromise = require("@prezly/progress-promise");
|
|
8
8
|
var _index = require("../http/index.cjs");
|
|
9
9
|
var _routing = require("../routing.cjs");
|
|
@@ -39,63 +39,65 @@ async function handleDeferredJob(http, request) {
|
|
|
39
39
|
}
|
|
40
40
|
return _progressPromise.ProgressPromise.resolve(response.payload);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.http = httpClient;
|
|
45
|
-
this.api = apiClient;
|
|
46
|
-
}
|
|
47
|
-
get(endpointUri, {
|
|
42
|
+
function createDeferredJobsApiClient(http, api) {
|
|
43
|
+
function get(endpointUri, {
|
|
48
44
|
headers,
|
|
49
45
|
query
|
|
50
46
|
} = {}) {
|
|
51
|
-
return handleDeferredJob(
|
|
47
|
+
return handleDeferredJob(http, api.get(endpointUri, {
|
|
52
48
|
headers,
|
|
53
49
|
query
|
|
54
50
|
}));
|
|
55
51
|
}
|
|
56
|
-
post(endpointUri, {
|
|
52
|
+
function post(endpointUri, {
|
|
57
53
|
headers,
|
|
58
54
|
payload,
|
|
59
55
|
query
|
|
60
56
|
} = {}) {
|
|
61
|
-
return handleDeferredJob(
|
|
57
|
+
return handleDeferredJob(http, api.post(endpointUri, {
|
|
62
58
|
headers,
|
|
63
59
|
payload,
|
|
64
60
|
query
|
|
65
61
|
}));
|
|
66
62
|
}
|
|
67
|
-
put(endpointUri, {
|
|
63
|
+
function put(endpointUri, {
|
|
68
64
|
headers,
|
|
69
65
|
payload,
|
|
70
66
|
query
|
|
71
67
|
} = {}) {
|
|
72
|
-
return handleDeferredJob(
|
|
68
|
+
return handleDeferredJob(http, api.put(endpointUri, {
|
|
73
69
|
headers,
|
|
74
70
|
payload,
|
|
75
71
|
query
|
|
76
72
|
}));
|
|
77
73
|
}
|
|
78
|
-
patch(endpointUri, {
|
|
74
|
+
function patch(endpointUri, {
|
|
79
75
|
headers,
|
|
80
76
|
payload,
|
|
81
77
|
query
|
|
82
78
|
} = {}) {
|
|
83
|
-
return handleDeferredJob(
|
|
79
|
+
return handleDeferredJob(http, api.patch(endpointUri, {
|
|
84
80
|
headers,
|
|
85
81
|
payload,
|
|
86
82
|
query
|
|
87
83
|
}));
|
|
88
84
|
}
|
|
89
|
-
|
|
85
|
+
function doDelete(endpointUri, {
|
|
90
86
|
headers,
|
|
91
87
|
payload,
|
|
92
88
|
query
|
|
93
89
|
} = {}) {
|
|
94
|
-
return handleDeferredJob(
|
|
90
|
+
return handleDeferredJob(http, api.delete(endpointUri, {
|
|
95
91
|
headers,
|
|
96
92
|
payload,
|
|
97
93
|
query
|
|
98
94
|
}));
|
|
99
95
|
}
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
return {
|
|
97
|
+
get,
|
|
98
|
+
post,
|
|
99
|
+
put,
|
|
100
|
+
patch,
|
|
101
|
+
delete: doDelete
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { ProgressPromise } from '@prezly/progress-promise';
|
|
2
2
|
import type { HttpClient, Params, ParamsWithPayload } from '../http';
|
|
3
3
|
import type { ApiClient } from './ApiClient';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
delete<V = any, P = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload): ProgressPromise<V, P>;
|
|
13
|
-
}
|
|
4
|
+
export type DeferredJobsApiClient = ReturnType<typeof createDeferredJobsApiClient>;
|
|
5
|
+
export declare function createDeferredJobsApiClient(http: HttpClient, api: ApiClient): {
|
|
6
|
+
get: <V = any, P = any>(endpointUri: string, { headers, query }?: Params) => ProgressPromise<V, P>;
|
|
7
|
+
post: <V_1 = any, P_1 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => ProgressPromise<V_1, P_1>;
|
|
8
|
+
put: <V_2 = any, P_2 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => ProgressPromise<V_2, P_2>;
|
|
9
|
+
patch: <V_3 = any, P_3 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => ProgressPromise<V_3, P_3>;
|
|
10
|
+
delete: <V_4 = any, P_4 = any>(endpointUri: string, { headers, payload, query }?: ParamsWithPayload) => ProgressPromise<V_4, P_4>;
|
|
11
|
+
};
|
|
@@ -33,62 +33,65 @@ async function handleDeferredJob(http, request) {
|
|
|
33
33
|
}
|
|
34
34
|
return ProgressPromise.resolve(response.payload);
|
|
35
35
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
this.http = httpClient;
|
|
39
|
-
this.api = apiClient;
|
|
40
|
-
}
|
|
41
|
-
get(endpointUri, {
|
|
36
|
+
export function createDeferredJobsApiClient(http, api) {
|
|
37
|
+
function get(endpointUri, {
|
|
42
38
|
headers,
|
|
43
39
|
query
|
|
44
40
|
} = {}) {
|
|
45
|
-
return handleDeferredJob(
|
|
41
|
+
return handleDeferredJob(http, api.get(endpointUri, {
|
|
46
42
|
headers,
|
|
47
43
|
query
|
|
48
44
|
}));
|
|
49
45
|
}
|
|
50
|
-
post(endpointUri, {
|
|
46
|
+
function post(endpointUri, {
|
|
51
47
|
headers,
|
|
52
48
|
payload,
|
|
53
49
|
query
|
|
54
50
|
} = {}) {
|
|
55
|
-
return handleDeferredJob(
|
|
51
|
+
return handleDeferredJob(http, api.post(endpointUri, {
|
|
56
52
|
headers,
|
|
57
53
|
payload,
|
|
58
54
|
query
|
|
59
55
|
}));
|
|
60
56
|
}
|
|
61
|
-
put(endpointUri, {
|
|
57
|
+
function put(endpointUri, {
|
|
62
58
|
headers,
|
|
63
59
|
payload,
|
|
64
60
|
query
|
|
65
61
|
} = {}) {
|
|
66
|
-
return handleDeferredJob(
|
|
62
|
+
return handleDeferredJob(http, api.put(endpointUri, {
|
|
67
63
|
headers,
|
|
68
64
|
payload,
|
|
69
65
|
query
|
|
70
66
|
}));
|
|
71
67
|
}
|
|
72
|
-
patch(endpointUri, {
|
|
68
|
+
function patch(endpointUri, {
|
|
73
69
|
headers,
|
|
74
70
|
payload,
|
|
75
71
|
query
|
|
76
72
|
} = {}) {
|
|
77
|
-
return handleDeferredJob(
|
|
73
|
+
return handleDeferredJob(http, api.patch(endpointUri, {
|
|
78
74
|
headers,
|
|
79
75
|
payload,
|
|
80
76
|
query
|
|
81
77
|
}));
|
|
82
78
|
}
|
|
83
|
-
|
|
79
|
+
function doDelete(endpointUri, {
|
|
84
80
|
headers,
|
|
85
81
|
payload,
|
|
86
82
|
query
|
|
87
83
|
} = {}) {
|
|
88
|
-
return handleDeferredJob(
|
|
84
|
+
return handleDeferredJob(http, api.delete(endpointUri, {
|
|
89
85
|
headers,
|
|
90
86
|
payload,
|
|
91
87
|
query
|
|
92
88
|
}));
|
|
93
89
|
}
|
|
90
|
+
return {
|
|
91
|
+
get,
|
|
92
|
+
post,
|
|
93
|
+
put,
|
|
94
|
+
patch,
|
|
95
|
+
delete: doDelete
|
|
96
|
+
};
|
|
94
97
|
}
|
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 = "19.
|
|
7
|
+
const VERSION = "19.10.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