Skip to content

Commit 2cc643a

Browse files
committed
DraftAPI.getRevisions, DraftAPI.getRevision added
1 parent d7445a9 commit 2cc643a

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 4.38.0
4+
5+
### Minor Changes
6+
7+
- DraftAPI.getRevisions, DraftAPI.getRevision added
8+
39
## 4.37.0
410

511
### Minor Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "4.37.0",
3+
"version": "4.38.0",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
55
"type": "commonjs",
66
"main": "./dist/index.js",

src/api/draft/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
DocumentRedirect,
99
ExternalRedirect,
1010
Revision,
11+
Revisions,
1112
UpdateDraftRevisionPayload,
1213
} from './types';
1314

@@ -51,6 +52,16 @@ export class ArcDraft extends ArcAbstractAPI {
5152
return data;
5253
}
5354

55+
async getRevisions(id: string, type = 'story', after?: string) {
56+
const { data } = await this.client.get<Revisions>(`/${type}/${id}/revision`, { params: { after } });
57+
return data;
58+
}
59+
60+
async getRevision(id: string, revisionId: string, type = 'story') {
61+
const { data } = await this.client.get<Revision>(`/${type}/${id}/revision/${revisionId}`);
62+
return data;
63+
}
64+
5465
async createRedirect<
5566
P extends CreateRedirectPayload,
5667
R = P extends CreateExternalRedirectPayload

src/api/draft/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ export type Circulations = {
5959
circulations: CirculationReference[];
6060
last?: string;
6161
};
62+
63+
export type Revisions = {
64+
revisions: Revision[];
65+
last?: string;
66+
};

vite.config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ export default defineConfig({
1010
},
1111
coverage: {
1212
reporter: ['text', 'json', 'html'],
13-
provider: 'v8', // or 'v8'
13+
provider: 'v8',
1414
},
15-
/* for example, use global to avoid globals imports (describe, test, expect): */
16-
// globals: true,
1715
},
1816
});

0 commit comments

Comments
 (0)