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 ofplayers
. - Live stream API is now called
liveStreams
instead oflives
.
Before:
await client.videos.search({ currentPage: 1, pageSize: 50 });
After:
await client.videos.list({ currentPage: 1, pageSize: 50 });
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.
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.
Before:
await client.captions.upload('test/data/en.vtt', { videoId, language: 'en' });
After:
await client.captions.upload(videoId, 'en', 'test/data/en.vtt');
Before:
await client.captions.updateDefault(videoId, 'en', true);
After:
await client.captions.update(videoId, 'en', { _default: true })
Before:
await client.chapters.upload('test/data/en.vtt', { videoId, language: 'en' });
After:
await client.chapters.upload(videoId, 'en', 'test/data/en.vtt');
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.
Before:
await client.players.create();
After:
await client.playerThemes.create();
Before:
await client.players.get(playerId);
After:
await client.playerThemes.get(playerThemeId);
Before:
await client.players.search({ currentPage: 1, pageSize: 50 });
After:
await client.playerThemes.list({ currentPage: 1, pageSize: 50 });
Before:
client.players.update(playerId, properties);
After:
client.playerThemes.update(playerId, properties);
Before:
client.players.uploadLogo('test/data/test.jpg', playerId, 'https://api.video');
After:
client.playerThemes.uploadLogo(playerId,'test/data/test.jpg', 'https://api.video');
Before:
client.lives.create(name);
After:
client.liveStreams.create({ name });
Before:
await client.lives.uploadThumbnail('test/data/test.jpg', liveStreamId);
After:
client.liveStreams.uploadThumbnail(liveStreamId, 'test/data/test.jpg');
Before:
await client.lives.delete(liveStreamId)
After:
client.liveStreams.delete(liveStreamId)
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 });
await client.tokens.generate()
After:
await client.uploadTokens.createToken()