From 02e9ec6f4cc7049db5af8bd020cccb9cf2ecb353 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Fri, 15 Jul 2022 16:46:00 -0700 Subject: [PATCH] docs: update list calls to Async (#186) --- media/transcoder/listJobTemplates.js | 6 +++--- media/transcoder/listJobs.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/media/transcoder/listJobTemplates.js b/media/transcoder/listJobTemplates.js index f2862b7e00..cb3e32861a 100644 --- a/media/transcoder/listJobTemplates.js +++ b/media/transcoder/listJobTemplates.js @@ -31,12 +31,12 @@ function main(projectId, location) { const transcoderServiceClient = new TranscoderServiceClient(); async function listJobTemplates() { - const [jobTemplates] = await transcoderServiceClient.listJobTemplates({ + const iterable = await transcoderServiceClient.listJobTemplatesAsync({ parent: transcoderServiceClient.locationPath(projectId, location), }); console.info('Job templates:'); - for (const jobTemplate of jobTemplates) { - console.info(jobTemplate.name); + for await (const response of iterable) { + console.log(response.name); } } diff --git a/media/transcoder/listJobs.js b/media/transcoder/listJobs.js index a5d69c0f22..8c24c0b23c 100644 --- a/media/transcoder/listJobs.js +++ b/media/transcoder/listJobs.js @@ -31,12 +31,12 @@ function main(projectId, location) { const transcoderServiceClient = new TranscoderServiceClient(); async function listJobs() { - const [jobs] = await transcoderServiceClient.listJobs({ + const iterable = await transcoderServiceClient.listJobsAsync({ parent: transcoderServiceClient.locationPath(projectId, location), }); console.info('Jobs:'); - for (const job of jobs) { - console.info(job.name); + for await (const response of iterable) { + console.log(response.name); } }