Skip to content

Commit

Permalink
refactor: improve generated code style. (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Feb 2, 2019
1 parent 0af16dd commit 6c0ea18
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 245 deletions.
48 changes: 10 additions & 38 deletions packages/google-cloud-dialogflow/src/v2/agents_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
* }
* })
Expand All @@ -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) {
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions packages/google-cloud-dialogflow/src/v2/contexts_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
* }
* })
Expand All @@ -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) {
Expand Down
59 changes: 12 additions & 47 deletions packages/google-cloud-dialogflow/src/v2/entity_types_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
* }
* })
Expand All @@ -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) {
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down Expand Up @@ -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 => {
Expand All @@ -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.
Expand Down
Loading

0 comments on commit 6c0ea18

Please sign in to comment.