@financial-times/content-curation-client 5.4.0 → 6.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/README.md +2 -51
- package/dist/_tsup-dts-rollup.d.cts +237 -3211
- package/dist/_tsup-dts-rollup.d.ts +237 -3211
- package/dist/index.cjs +82 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +143 -190
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ TypeScript client library for interacting with the Content Curation API.
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Zod-validated request and response types
|
|
8
|
-
- Promise-based clients for
|
|
8
|
+
- Promise-based clients for page endpoints
|
|
9
9
|
- Typed transport, gateway, and service error handling
|
|
10
10
|
- Support for custom `fetch` implementations
|
|
11
11
|
|
|
@@ -33,15 +33,6 @@ const client = new ApiClient({
|
|
|
33
33
|
});
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
### Get homepage structure
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
const pageId = "123e4567-e89b-12d3-a456-426614174000";
|
|
40
|
-
const homepage = await client.homepage.getStructure(pageId);
|
|
41
|
-
|
|
42
|
-
console.log(homepage.properties.title);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
36
|
### Get page structure
|
|
46
37
|
|
|
47
38
|
```typescript
|
|
@@ -51,35 +42,6 @@ const page = await client.page.getStructure(pageId);
|
|
|
51
42
|
console.log(page.properties.title);
|
|
52
43
|
```
|
|
53
44
|
|
|
54
|
-
### Update homepage structure
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
import { HomepageStructureInput } from "@financial-times/content-curation-client";
|
|
58
|
-
|
|
59
|
-
const pageId = "58de2dc7-980b-4d51-8e45-9798f0c6b6bf";
|
|
60
|
-
|
|
61
|
-
const homepageStructure: Omit<HomepageStructureInput, "type"> = {
|
|
62
|
-
properties: {
|
|
63
|
-
pageId,
|
|
64
|
-
homepageListId: "123e4567-e89b-12d3-a456-426614174000",
|
|
65
|
-
title: "My Updated Homepage",
|
|
66
|
-
publicationId: "homepage-publication-id",
|
|
67
|
-
},
|
|
68
|
-
children: [
|
|
69
|
-
{
|
|
70
|
-
type: "HomepageSlice",
|
|
71
|
-
properties: {
|
|
72
|
-
heading: {
|
|
73
|
-
text: "Featured Section",
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const homepage = await client.homepage.upsertStructure(pageId, homepageStructure);
|
|
81
|
-
```
|
|
82
|
-
|
|
83
45
|
### Update page structure
|
|
84
46
|
|
|
85
47
|
```typescript
|
|
@@ -93,16 +55,7 @@ const pageStructure: Omit<PageStructureInput, "type"> = {
|
|
|
93
55
|
title: "My Updated Page",
|
|
94
56
|
publicationId: "page-publication-id",
|
|
95
57
|
},
|
|
96
|
-
children: [
|
|
97
|
-
{
|
|
98
|
-
type: "HomepageSlice",
|
|
99
|
-
properties: {
|
|
100
|
-
heading: {
|
|
101
|
-
text: "Featured Section",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
],
|
|
58
|
+
children: [],
|
|
106
59
|
};
|
|
107
60
|
|
|
108
61
|
const page = await client.page.upsertStructure(pageId, pageStructure);
|
|
@@ -175,8 +128,6 @@ const client = new ApiClient({
|
|
|
175
128
|
```typescript
|
|
176
129
|
import type {
|
|
177
130
|
ApiErrorPayload,
|
|
178
|
-
HomepageStructureInput,
|
|
179
|
-
HomepageStructureOutput,
|
|
180
131
|
PageDraft,
|
|
181
132
|
PageStructureInput,
|
|
182
133
|
PageStructureOutput,
|