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.
Install the package with:
npm i @code.store/arcxp-sdk-ts
- Author
- Draft
- Identity
- IFX
- Redirect
- Migration Center
- Sales
- Site
- Websked
- Retail Events (WebSockets)
- Content
- Signing Service
- PhotoCenter
- Global Settings
- Tags
import { ArcAPI } from '@code.store/arcxp-sdk-ts';
const api = ArcAPI({
credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
maxRPS: 10,
});
const id = await api.Draft.generateId(Date.now().toString());
- text
- header
- image
- quote
- interstitial_link
- raw_html
- gallery
- list
- link_list
- jwPlayer
import { ContentElement } from '@code.store/arcxp-sdk-ts';
const header = ContentElement.header('Header', 4);
const text = ContentElement.text('text');
import { ArcTypes, ArcAPI } from '@code.store/arcxp-sdk-ts';
const api = ArcAPI({
credentials: { organizationName: 'YOUR_ORG_NAME', accessToken: 'YOUR_ACCESS_TOKEN' },
maxRPS: 10,
});
const sourceImageId = 'sourceImageId';
const id = await api.Draft.generateId(sourceImageId);
const ans: ArcTypes.Story.AnImage = {
_id: id,
description: { basic: 'Description' },
caption: 'Caption',
subtitle: 'Subtitle',
alt_text: 'Alt',
type: 'image',
version: '0.10.9',
image_type: 'photograph',
source: {
name: 'codestore-arcxp-sdk-ts',
system: 'codestore-arcxp-sdk-ts',
source_id: sourceImageId,
},
additional_properties: {
originalName: 'originalName',
version: 0,
originalUrl: 'https://picsum.photos/200',
published: true,
},
};
await api.MigrationCenter.postAns(
{
website: 'YOUR_WEBSITE',
groupId: 'images',
priority: 'historical',
},
{
sourceId: sourceImageId,
sourceType: 'image',
ANS: ans,
}
);
npx changeset && npx changeset version