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