From 6c0ea18bec3b627e307013014b00b50801e312fa Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Sat, 2 Feb 2019 10:34:21 -0800 Subject: [PATCH] refactor: improve generated code style. (#270) --- .../src/v2/agents_client.js | 48 ++++----------- .../src/v2/contexts_client.js | 4 +- .../src/v2/entity_types_client.js | 59 ++++--------------- .../src/v2/intents_client.js | 26 ++------ .../src/v2/session_entity_types_client.js | 4 +- .../src/v2beta1/agents_client.js | 48 ++++----------- .../src/v2beta1/contexts_client.js | 4 +- .../src/v2beta1/documents_client.js | 26 ++------ .../src/v2beta1/entity_types_client.js | 59 ++++--------------- .../src/v2beta1/intents_client.js | 26 ++------ .../src/v2beta1/knowledge_bases_client.js | 4 +- .../v2beta1/session_entity_types_client.js | 4 +- .../google-cloud-dialogflow/synth.metadata | 10 ++-- 13 files changed, 77 insertions(+), 245 deletions(-) diff --git a/packages/google-cloud-dialogflow/src/v2/agents_client.js b/packages/google-cloud-dialogflow/src/v2/agents_client.js index 9cab379e0b5..c7d9c7bccdd 100644 --- a/packages/google-cloud-dialogflow/src/v2/agents_client.js +++ b/packages/google-cloud-dialogflow/src/v2/agents_client.js @@ -379,7 +379,7 @@ class AgentsClient { * client.searchAgents({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -399,7 +399,7 @@ class AgentsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -514,20 +514,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.trainAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -539,8 +533,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.trainAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -612,20 +605,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.exportAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -637,8 +624,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.exportAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -728,20 +714,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.importAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -753,8 +733,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.importAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -843,20 +822,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.restoreAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -868,8 +841,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.restoreAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2/contexts_client.js b/packages/google-cloud-dialogflow/src/v2/contexts_client.js index e303ae72f87..01c7ee34584 100644 --- a/packages/google-cloud-dialogflow/src/v2/contexts_client.js +++ b/packages/google-cloud-dialogflow/src/v2/contexts_client.js @@ -266,7 +266,7 @@ class ContextsClient { * client.listContexts({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -286,7 +286,7 @@ class ContextsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { diff --git a/packages/google-cloud-dialogflow/src/v2/entity_types_client.js b/packages/google-cloud-dialogflow/src/v2/entity_types_client.js index e3e1ffc8276..e2b5b5def2c 100644 --- a/packages/google-cloud-dialogflow/src/v2/entity_types_client.js +++ b/packages/google-cloud-dialogflow/src/v2/entity_types_client.js @@ -374,7 +374,7 @@ class EntityTypesClient { * client.listEntityTypes({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -394,7 +394,7 @@ class EntityTypesClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -747,20 +747,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchUpdateEntityTypes({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -772,8 +766,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateEntityTypes({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -853,20 +846,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchDeleteEntityTypes(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -883,8 +870,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteEntityTypes(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -971,20 +957,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchCreateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1001,8 +981,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchCreateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -1090,20 +1069,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchUpdateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1120,8 +1093,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -1204,20 +1176,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchDeleteEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1234,8 +1200,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2/intents_client.js b/packages/google-cloud-dialogflow/src/v2/intents_client.js index 4d5c4faac06..3a5a04bf6d9 100644 --- a/packages/google-cloud-dialogflow/src/v2/intents_client.js +++ b/packages/google-cloud-dialogflow/src/v2/intents_client.js @@ -341,7 +341,7 @@ class IntentsClient { * client.listIntents({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -361,7 +361,7 @@ class IntentsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -742,20 +742,14 @@ class IntentsClient { * // Handle the operation using the promise pattern. * client.batchUpdateIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -772,8 +766,7 @@ class IntentsClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -850,20 +843,14 @@ class IntentsClient { * // Handle the operation using the promise pattern. * client.batchDeleteIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -880,8 +867,7 @@ class IntentsClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.js b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.js index f3fd7302606..9515d2a75b7 100644 --- a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.js +++ b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.js @@ -260,7 +260,7 @@ class SessionEntityTypesClient { * client.listSessionEntityTypes({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -280,7 +280,7 @@ class SessionEntityTypesClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.js b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.js index 8bf74603e94..ffc56ce61d1 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.js @@ -380,7 +380,7 @@ class AgentsClient { * client.searchAgents({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -400,7 +400,7 @@ class AgentsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -516,20 +516,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.trainAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -541,8 +535,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.trainAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -617,20 +610,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.exportAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -642,8 +629,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.exportAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -734,20 +720,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.importAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -759,8 +739,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.importAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -850,20 +829,14 @@ class AgentsClient { * // Handle the operation using the promise pattern. * client.restoreAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -875,8 +848,7 @@ class AgentsClient { * // Handle the operation using the event emitter pattern. * client.restoreAgent({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.js b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.js index ae1c2b775de..66b14bb26bc 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.js @@ -276,7 +276,7 @@ class ContextsClient { * client.listContexts({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -296,7 +296,7 @@ class ContextsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.js b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.js index 7d6307fc8d3..f83705117e6 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.js @@ -295,7 +295,7 @@ class DocumentsClient { * client.listDocuments({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -315,7 +315,7 @@ class DocumentsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -487,20 +487,14 @@ class DocumentsClient { * // Handle the operation using the promise pattern. * client.createDocument(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -517,8 +511,7 @@ class DocumentsClient { * // Handle the operation using the event emitter pattern. * client.createDocument(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -587,20 +580,14 @@ class DocumentsClient { * // Handle the operation using the promise pattern. * client.deleteDocument({name: formattedName}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -612,8 +599,7 @@ class DocumentsClient { * // Handle the operation using the event emitter pattern. * client.deleteDocument({name: formattedName}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.js b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.js index bbe138cc10d..cf9ea9c6fc0 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.js @@ -374,7 +374,7 @@ class EntityTypesClient { * client.listEntityTypes({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -394,7 +394,7 @@ class EntityTypesClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -747,20 +747,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchUpdateEntityTypes({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -772,8 +766,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateEntityTypes({parent: formattedParent}) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -853,20 +846,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchDeleteEntityTypes(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -883,8 +870,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteEntityTypes(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -971,20 +957,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchCreateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1001,8 +981,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchCreateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -1090,20 +1069,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchUpdateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1120,8 +1093,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -1204,20 +1176,14 @@ class EntityTypesClient { * // Handle the operation using the promise pattern. * client.batchDeleteEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -1234,8 +1200,7 @@ class EntityTypesClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteEntities(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.js b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.js index 246ddd2a712..785a1dc4055 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.js @@ -338,7 +338,7 @@ class IntentsClient { * client.listIntents({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -358,7 +358,7 @@ class IntentsClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { @@ -739,20 +739,14 @@ class IntentsClient { * // Handle the operation using the promise pattern. * client.batchUpdateIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -769,8 +763,7 @@ class IntentsClient { * // Handle the operation using the event emitter pattern. * client.batchUpdateIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. @@ -847,20 +840,14 @@ class IntentsClient { * // Handle the operation using the promise pattern. * client.batchDeleteIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Operation#promise starts polling for the completion of the LRO. * return operation.promise(); * }) * .then(responses => { - * // The final result of the operation. * const result = responses[0]; - * - * // The metadata value of the completed operation. * const metadata = responses[1]; - * - * // The response of the api call returning the complete operation. * const finalApiResponse = responses[2]; * }) * .catch(err => { @@ -877,8 +864,7 @@ class IntentsClient { * // Handle the operation using the event emitter pattern. * client.batchDeleteIntents(request) * .then(responses => { - * const operation = responses[0]; - * const initialApiResponse = responses[1]; + * const [operation, initialApiResponse] = responses; * * // Adding a listener for the "complete" event starts polling for the * // completion of the operation. diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.js b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.js index d79fbcdcdc5..0b0c1e7a95c 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.js @@ -248,7 +248,7 @@ class KnowledgeBasesClient { * client.listKnowledgeBases({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -268,7 +268,7 @@ class KnowledgeBasesClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.js b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.js index fc3b4bebf95..9e680b5167e 100644 --- a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.js +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.js @@ -270,7 +270,7 @@ class SessionEntityTypesClient { * client.listSessionEntityTypes({parent: formattedParent}) * .then(responses => { * const resources = responses[0]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]) * } * }) @@ -290,7 +290,7 @@ class SessionEntityTypesClient { * const nextRequest = responses[1]; * // The actual response object, if necessary. * // const rawResponse = responses[2]; - * for (let i = 0; i < resources.length; i += 1) { + * for (const resource of resources) { * // doThingsWith(resources[i]); * } * if (nextRequest) { diff --git a/packages/google-cloud-dialogflow/synth.metadata b/packages/google-cloud-dialogflow/synth.metadata index 09a4b77b695..c200a090d96 100644 --- a/packages/google-cloud-dialogflow/synth.metadata +++ b/packages/google-cloud-dialogflow/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-01-28T18:41:31.978491Z", + "updateTime": "2019-02-02T12:13:04.450007Z", "sources": [ { "generator": { "name": "artman", - "version": "0.16.7", - "dockerImage": "googleapis/artman@sha256:d6c8ced606eb49973ca95d2af7c55a681acc042db0f87d135968349e7bf6dd80" + "version": "0.16.8", + "dockerImage": "googleapis/artman@sha256:75bc07ef34a1de9895c18af54dc503ed3b3f3b52e85062e3360a979d2a0741e7" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "3cdb7227019524e7963071cf80a9624bf055b284", - "internalRef": "231246006" + "sha": "bce093dab3e65c40eb9a37efbdc960f34df6037a", + "internalRef": "231974277" } }, {