MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

media/livestream/listChannels.js:18–44  ·  view source on GitHub ↗
(projectId, location)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location) {
19 // [START livestream_list_channels]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25
26 // Imports the Livestream library
27 const {LivestreamServiceClient} = require('@google-cloud/livestream').v1;
28
29 // Instantiates a client
30 const livestreamServiceClient = new LivestreamServiceClient();
31
32 async function listChannels() {
33 const iterable = await livestreamServiceClient.listChannelsAsync({
34 parent: livestreamServiceClient.locationPath(projectId, location),
35 });
36 console.info('Channels:');
37 for await (const response of iterable) {
38 console.log(response.name);
39 }
40 }
41
42 listChannels();
43 // [END livestream_list_channels]
44}
45
46// node listChannels.js <projectId> <location>
47process.on('unhandledRejection', err => {

Callers 1

listChannels.jsFile · 0.70

Calls 1

listChannelsFunction · 0.85

Tested by

no test coverage detected