diff --git a/CHANGELOG.md b/CHANGELOG.md index f6de849..1b5b82c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @code.store/arcxp-sdk-ts +## 5.6.0 + +### Minor Changes + +- b1cd942: Add VideoCenter API with importVideo, deleteVideo, and updateVideoUrl methods + ## 5.5.0 ### Minor Changes diff --git a/package.json b/package.json index 7bdb8ed..5d95a2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code.store/arcxp-sdk-ts", - "version": "5.5.0", + "version": "5.6.0", "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.", "type": "module", "main": "./dist/index.js", diff --git a/src/api/index.ts b/src/api/index.ts index da559af..6494ac9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -16,6 +16,7 @@ import { ArcSales, ArcSalesV2 } from './sales/index.js'; import { ArcSigningService } from './signing-service/index.js'; import { ArcSite } from './site/index.js'; import { ArcTags } from './tags/index.js'; +import { ArcVideoCenter } from './video-center/index.js'; import { ArcWebsked } from './websked/index.js'; export const ArcAPI = (options: ArcAPIOptions) => { @@ -38,6 +39,7 @@ export const ArcAPI = (options: ArcAPIOptions) => { ContentOps: new ArcContentOps(options), RetailEvents: new ArcRetailEvents(options), DeveloperRetail: new ArcDeveloperRetail(options), + VideoCenter: new ArcVideoCenter(options), Custom: new Custom(options), }; diff --git a/src/api/video-center/index.ts b/src/api/video-center/index.ts new file mode 100644 index 0000000..6041851 --- /dev/null +++ b/src/api/video-center/index.ts @@ -0,0 +1,20 @@ +import { ArcAbstractAPI, type ArcAPIOptions } from '../abstract-api.js'; +import type { DeleteVideoParams, ImportVideoParams, ImportVideoPayload, UpdateVideoUrlParams } from './types.js'; + +export class ArcVideoCenter extends ArcAbstractAPI { + constructor(options: ArcAPIOptions) { + super({ ...options, apiPath: 'goldfish' }); + } + + async importVideo(payload: ImportVideoPayload, params: ImportVideoParams): Promise { + await this.client.post('/video/v2/import/ans', payload, { params }); + } + + async deleteVideo(params: DeleteVideoParams): Promise { + await this.client.delete('/video/v2/import/ans', { params }); + } + + async updateVideoUrl(params: UpdateVideoUrlParams): Promise { + await this.client.post('/video/v2/url/update', undefined, { params }); + } +} diff --git a/src/api/video-center/types.ts b/src/api/video-center/types.ts new file mode 100644 index 0000000..050240a --- /dev/null +++ b/src/api/video-center/types.ts @@ -0,0 +1,26 @@ +export type ImportVideoParams = { + encode: boolean; + isLive: boolean; + useLastUpdated: boolean; +}; + +export type ImportVideoPayload = { + id?: string; + type?: 'AUTHOR' | 'CLARIFICATION' | 'CORRECTION' | 'IMAGE' | 'REDIRECT' | 'REFERENCE' | 'SECTION' | 'SITE' | 'STORY' | 'VIDEO'; + version?: '_0_5_7' | '_0_5_8' | '_0_5_9' | '_0_6_0' | '_0_6_2' | '_0_8_0'; + canonicalWebsite?: string; + embedHtml?: string; + promoImage?: Record; + promoItems?: { basic?: Record }; + streams?: Record[]; + websites?: Record; +}; + +export type DeleteVideoParams = { + uuid: string; + hardDelete?: boolean; +}; + +export type UpdateVideoUrlParams = { + uuid: string; +}; diff --git a/src/types/index.ts b/src/types/index.ts index 3ea780b..53acd2a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -13,6 +13,7 @@ export * from '../api/sales/types.js'; export * from '../api/signing-service/types.js'; export * from '../api/site/types.js'; export * from '../api/tags/types.js'; +export * from '../api/video-center/types.js'; export * from '../api/websked/types.js'; export * from '../content-elements/types.js'; export * as ANS from './ans-types';