Skip to content

Latest commit

 

History

History
220 lines (194 loc) · 4.63 KB

MIGRATE.md

File metadata and controls

220 lines (194 loc) · 4.63 KB

Migrate from @apvideo/nodejs-sdk

Listing methods are now called list instead of search. They don't fetch all pages by default, this is now left to the user. This also means the return value has changed. Instead of returning the array of data, it now returns the full response body:

{
  "data": [],
  "pagination": {}
}

You must access the data property on the response, to retrieve the array of object.

  • Player theme API is now called playerThemes instead of players.
  • Live stream API is now called liveStreams instead of lives.

Videos

Search videos with paginated results

Before:

await client.videos.search({ currentPage: 1, pageSize: 50 });

After:

await client.videos.list({ currentPage: 1, pageSize: 50 });

Upload a video thumbnail

Before:

await client.videos.uploadThumbnail('test/data/test.jpg', videoId);

After:

await client.videos.uploadThumbnail(videoId, 'test/data/test.jpg');

The identifier is now always the first parameter where possible.

Pick a thumbnail from the given time code

Before:

await client.videos.updateThumbnailWithTimecode(videoId, '00:15:22.05');

After:

await client.videos.pickThumbnail(videoId, { timecode: '00:15:22.05' });

POST value is now always an object.

Upload video caption

Before:

await client.captions.upload('test/data/en.vtt', { videoId, language: 'en' });

After:

await client.captions.upload(videoId, 'en', 'test/data/en.vtt');

Update the default caption language

Before:

await client.captions.updateDefault(videoId, 'en', true);

After:

await client.captions.update(videoId, 'en', { _default: true })

Upload video chapter

Before:

await client.chapters.upload('test/data/en.vtt', { videoId, language: 'en' });

After:

await client.chapters.upload(videoId, 'en', 'test/data/en.vtt');

Get video analytics sessions for the current year

Before:

await client.analyticsVideo.get(videoId, new Date().getFullYear());

After:

await client.rawStatistics.listVideoSessions({ videoId, period: new Date().getFullYear().toString() });

Player theme

The following properties are deprecated and can't be used in the payload anymore :

{
  "shapeMargin": 10,
  "shapeRadius": 3,
  "shapeAspect": "flat",
  "shapeBackgroundTop": "rgba(50, 50, 50, .7)",
  "shapeBackgroundBottom": "rgba(50, 50, 50, .8)",
  "linkActive": "rgba(255, 0, 0, .75)"
}

But they are still available in the API response for now.

Create player theme with default values

Before:

await client.players.create();

After:

await client.playerThemes.create();

Get a player theme

Before:

await client.players.get(playerId);

After:

await client.playerThemes.get(playerThemeId);

Search a player with paginate results

Before:

await client.players.search({ currentPage: 1, pageSize: 50 });

After:

await client.playerThemes.list({ currentPage: 1, pageSize: 50 });

Player themes

Update

Before:

client.players.update(playerId, properties);

After:

client.playerThemes.update(playerId, properties);

Upload a logo

Before:

client.players.uploadLogo('test/data/test.jpg', playerId, 'https://api.video');

After:

client.playerThemes.uploadLogo(playerId,'test/data/test.jpg', 'https://api.video');

Live streams

Create a live

Before:

client.lives.create(name);

After:

client.liveStreams.create({ name });

Update live thumbnail

Before:

await client.lives.uploadThumbnail('test/data/test.jpg', liveStreamId);

After:

client.liveStreams.uploadThumbnail(liveStreamId, 'test/data/test.jpg');

Delete live resource

Before:

await client.lives.delete(liveStreamId)

After:

client.liveStreams.delete(liveStreamId)

Create a private live

Before:

await client.lives.create('This is a private live', { public: false });

After:

await client.liveStreams.create({ name: 'This is a private live', _public: false });

Get live Analytics Data for the current year

Before:

await client.analyticsLive.get(liveStreamId, new Date().getFullYear());

After:

await client.rawStatistics.listLiveStreamSessions({ liveStreamId, period: new Date().getFullYear().toString() });

Tokens

Generate a token for delegated upload

await client.tokens.generate()

After:

await client.uploadTokens.createToken()