diff --git a/packages/google-cloud-tasks/README.md b/packages/google-cloud-tasks/README.md index dd9c27942d8..12cf1545ec8 100644 --- a/packages/google-cloud-tasks/README.md +++ b/packages/google-cloud-tasks/README.md @@ -64,44 +64,46 @@ const {CloudTasksClient} = require('@google-cloud/tasks'); // Instantiates a client. const client = new CloudTasksClient(); -// TODO(developer): Uncomment these lines and replace with your values. -// const project = 'my-project-id'; -// const queue = 'my-appengine-queue'; -// const location = 'us-central1'; -// const payload = 'hello'; - -// Construct the fully qualified queue name. -const parent = client.queuePath(project, location, queue); - -const task = { - appEngineHttpRequest: { - httpMethod: 'POST', - relativeUri: '/log_payload', - }, -}; - -if (payload) { - task.appEngineHttpRequest.body = Buffer.from(payload).toString('base64'); -} - -if (inSeconds) { - task.scheduleTime = { - seconds: inSeconds + Date.now() / 1000, +async function quickstart() { + // TODO(developer): Uncomment these lines and replace with your values. + // const project = 'my-project-id'; + // const queue = 'my-appengine-queue'; + // const location = 'us-central1'; + // const payload = 'hello'; + + // Construct the fully qualified queue name. + const parent = client.queuePath(project, location, queue); + + const task = { + appEngineHttpRequest: { + httpMethod: 'POST', + relativeUri: '/log_payload', + }, }; -} -const request = { - parent: parent, - task: task, -}; + if (payload) { + task.appEngineHttpRequest.body = Buffer.from(payload).toString('base64'); + } -console.log('Sending task:'); -console.log(task); -// Send create task request. -const [response] = await client.createTask(request); -const name = response.name; -console.log(`Created task ${name}`); + if (inSeconds) { + task.scheduleTime = { + seconds: inSeconds + Date.now() / 1000, + }; + } + const request = { + parent: parent, + task: task, + }; + + console.log('Sending task:'); + console.log(task); + // Send create task request. + const [response] = await client.createTask(request); + const name = response.name; + console.log(`Created task ${name}`); +} +quickstart(); ``` diff --git a/packages/google-cloud-tasks/synth.metadata b/packages/google-cloud-tasks/synth.metadata index 9462024eaf2..7ef7855828d 100644 --- a/packages/google-cloud-tasks/synth.metadata +++ b/packages/google-cloud-tasks/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/nodejs-tasks.git", - "sha": "d0ecb6f6a9faf56c6e20145650bf35a545781f0b" + "sha": "a6b037d55fe90eb24424cd5a68390161d74cffe0" } }, {