File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,23 @@ npm install @sofie-automation/openapi
3232```
3333
3434``` typescript
35- import { Configuration , PlaylistsApi , ResponseError , API_VERSION } from ' @sofie-automation/openapi'
35+ import { API_VERSION , Configuration , PlaylistsApi , SofieApi } from ' @sofie-automation/openapi'
3636
3737const config = new Configuration ({
3838 basePath: ` http://mysofie:3000/api/${API_VERSION } ` ,
3939})
4040
41+ const sofieApi = new SofieApi (config )
4142const sofieVersion = await sofieApi .index ()
43+
4244if (sofieVersion .status !== 200 ) throw new Error (' Bad initial response code' )
4345// Check Sofie version:
4446console .log (` Talking to Sofie version ${sofieVersion .result .version } ` )
4547
48+ const playlistsApi = new PlaylistsApi (config )
4649const playlists = await playlistsApi .playlists ()
4750
48- const firstPlaylist = playlists .result [0 ]
51+ const firstPlaylist = playlists .result ? playlists . result [0 ] : undefined
4952if (! firstPlaylist ) throw new Error (' No playlists found' )
5053
5154await playlistsApi .activate ({
You can’t perform that action at this time.
0 commit comments