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

Function main

media/livestream/getChannelEvent.js:18–50  ·  view source on GitHub ↗
(projectId, location, channelId, eventId)

Source from the content-addressed store, hash-verified

16'use strict';
17
18function main(projectId, location, channelId, eventId) {
19 // [START livestream_get_channel_event]
20 /**
21 * TODO(developer): Uncomment these variables before running the sample.
22 */
23 // projectId = 'my-project-id';
24 // location = 'us-central1';
25 // channelId = 'my-channel';
26 // eventId = 'my-channel-event';
27
28 // Imports the Livestream library
29 const {LivestreamServiceClient} = require('@google-cloud/livestream').v1;
30
31 // Instantiates a client
32 const livestreamServiceClient = new LivestreamServiceClient();
33
34 async function getChannelEvent() {
35 // Construct request
36 const request = {
37 name: livestreamServiceClient.eventPath(
38 projectId,
39 location,
40 channelId,
41 eventId
42 ),
43 };
44 const [event] = await livestreamServiceClient.getEvent(request);
45 console.log(`Channel event: ${event.name}`);
46 }
47
48 getChannelEvent();
49 // [END livestream_get_channel_event]
50}
51
52// node getChannelEvent.js <projectId> <location> <channelId> <eventId>
53process.on('unhandledRejection', err => {

Callers 1

getChannelEvent.jsFile · 0.70

Calls 1

getChannelEventFunction · 0.85

Tested by

no test coverage detected