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
32
32
```
33
33
34
34
```typescript
35
- import { Configuration, PlaylistsApi, ResponseError, API_VERSION } from '@sofie-automation/openapi'
35
+ import { API_VERSION, Configuration, PlaylistsApi, SofieApi } from '@sofie-automation/openapi'
36
36
37
37
const config = new Configuration({
38
38
basePath: `http://mysofie:3000/api/${API_VERSION}`,
39
39
})
40
40
41
+ const sofieApi = new SofieApi(config)
41
42
const sofieVersion = await sofieApi.index()
43
+
42
44
if (sofieVersion.status !== 200) throw new Error('Bad initial response code')
43
45
// Check Sofie version:
44
46
console.log(`Talking to Sofie version ${sofieVersion.result.version}`)
45
47
48
+ const playlistsApi = new PlaylistsApi(config)
46
49
const playlists = await playlistsApi.playlists()
47
50
48
- const firstPlaylist = playlists.result[0]
51
+ const firstPlaylist = playlists.result ? playlists.result [0] : undefined
49
52
if (!firstPlaylist) throw new Error('No playlists found')
50
53
51
54
await playlistsApi.activate({
You can’t perform that action at this time.
0 commit comments