|
| 1 | +// Copyright 2021 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +'use strict'; |
| 16 | + |
| 17 | +function main(parent) { |
| 18 | + // [START livestream_quickstart] |
| 19 | + /** |
| 20 | + * TODO(developer): Uncomment these variables before running the sample. |
| 21 | + */ |
| 22 | + /** |
| 23 | + * Required. The parent location for the resource, in the form of: |
| 24 | + * `projects/{project}/locations/{location}`. |
| 25 | + */ |
| 26 | + // const parent = 'abc123' |
| 27 | + /** |
| 28 | + * The maximum number of items to return. If unspecified, server |
| 29 | + * will pick an appropriate default. Server may return fewer items than |
| 30 | + * requested. A caller should only rely on response's |
| 31 | + * next_page_token google.cloud.video.livestream.v1.ListChannelsResponse.next_page_token to |
| 32 | + * determine if there are more items left to be queried. |
| 33 | + */ |
| 34 | + // const pageSize = 1234 |
| 35 | + /** |
| 36 | + * The next_page_token value returned from a previous List request, if any. |
| 37 | + */ |
| 38 | + // const pageToken = 'abc123' |
| 39 | + /** |
| 40 | + * The filter to apply to list results. |
| 41 | + */ |
| 42 | + // const filter = 'abc123' |
| 43 | + /** |
| 44 | + * Specifies the ordering of results following syntax at |
| 45 | + * https://cloud.google.com/apis/design/design_patterns#sorting_order. |
| 46 | + */ |
| 47 | + // const orderBy = 'abc123' |
| 48 | + |
| 49 | + // Imports the Livestream library |
| 50 | + const {LivestreamServiceClient} = require('@google-cloud/livestream').v1; |
| 51 | + |
| 52 | + // Instantiates a client |
| 53 | + const livestreamClient = new LivestreamServiceClient(); |
| 54 | + |
| 55 | + async function callListChannels() { |
| 56 | + // Construct request |
| 57 | + const request = { |
| 58 | + parent, |
| 59 | + }; |
| 60 | + |
| 61 | + // Run request |
| 62 | + const iterable = await livestreamClient.listChannelsAsync(request); |
| 63 | + for await (const response of iterable) { |
| 64 | + console.log(response); |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + callListChannels(); |
| 69 | + // [END livestream_quickstart] |
| 70 | +} |
| 71 | + |
| 72 | +process.on('unhandledRejection', err => { |
| 73 | + console.error(err.message); |
| 74 | + process.exitCode = 1; |
| 75 | +}); |
| 76 | +main(...process.argv.slice(2)); |
0 commit comments