Skip to content

Commit 6c0ea18

Browse files
yoshi-automationJustinBeckwith
authored andcommitted
refactor: improve generated code style. (#270)
1 parent 0af16dd commit 6c0ea18

13 files changed

+77
-245
lines changed

packages/google-cloud-dialogflow/src/v2/agents_client.js

+10-38
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class AgentsClient {
379379
* client.searchAgents({parent: formattedParent})
380380
* .then(responses => {
381381
* const resources = responses[0];
382-
* for (let i = 0; i < resources.length; i += 1) {
382+
* for (const resource of resources) {
383383
* // doThingsWith(resources[i])
384384
* }
385385
* })
@@ -399,7 +399,7 @@ class AgentsClient {
399399
* const nextRequest = responses[1];
400400
* // The actual response object, if necessary.
401401
* // const rawResponse = responses[2];
402-
* for (let i = 0; i < resources.length; i += 1) {
402+
* for (const resource of resources) {
403403
* // doThingsWith(resources[i]);
404404
* }
405405
* if (nextRequest) {
@@ -514,20 +514,14 @@ class AgentsClient {
514514
* // Handle the operation using the promise pattern.
515515
* client.trainAgent({parent: formattedParent})
516516
* .then(responses => {
517-
* const operation = responses[0];
518-
* const initialApiResponse = responses[1];
517+
* const [operation, initialApiResponse] = responses;
519518
*
520519
* // Operation#promise starts polling for the completion of the LRO.
521520
* return operation.promise();
522521
* })
523522
* .then(responses => {
524-
* // The final result of the operation.
525523
* const result = responses[0];
526-
*
527-
* // The metadata value of the completed operation.
528524
* const metadata = responses[1];
529-
*
530-
* // The response of the api call returning the complete operation.
531525
* const finalApiResponse = responses[2];
532526
* })
533527
* .catch(err => {
@@ -539,8 +533,7 @@ class AgentsClient {
539533
* // Handle the operation using the event emitter pattern.
540534
* client.trainAgent({parent: formattedParent})
541535
* .then(responses => {
542-
* const operation = responses[0];
543-
* const initialApiResponse = responses[1];
536+
* const [operation, initialApiResponse] = responses;
544537
*
545538
* // Adding a listener for the "complete" event starts polling for the
546539
* // completion of the operation.
@@ -612,20 +605,14 @@ class AgentsClient {
612605
* // Handle the operation using the promise pattern.
613606
* client.exportAgent({parent: formattedParent})
614607
* .then(responses => {
615-
* const operation = responses[0];
616-
* const initialApiResponse = responses[1];
608+
* const [operation, initialApiResponse] = responses;
617609
*
618610
* // Operation#promise starts polling for the completion of the LRO.
619611
* return operation.promise();
620612
* })
621613
* .then(responses => {
622-
* // The final result of the operation.
623614
* const result = responses[0];
624-
*
625-
* // The metadata value of the completed operation.
626615
* const metadata = responses[1];
627-
*
628-
* // The response of the api call returning the complete operation.
629616
* const finalApiResponse = responses[2];
630617
* })
631618
* .catch(err => {
@@ -637,8 +624,7 @@ class AgentsClient {
637624
* // Handle the operation using the event emitter pattern.
638625
* client.exportAgent({parent: formattedParent})
639626
* .then(responses => {
640-
* const operation = responses[0];
641-
* const initialApiResponse = responses[1];
627+
* const [operation, initialApiResponse] = responses;
642628
*
643629
* // Adding a listener for the "complete" event starts polling for the
644630
* // completion of the operation.
@@ -728,20 +714,14 @@ class AgentsClient {
728714
* // Handle the operation using the promise pattern.
729715
* client.importAgent({parent: formattedParent})
730716
* .then(responses => {
731-
* const operation = responses[0];
732-
* const initialApiResponse = responses[1];
717+
* const [operation, initialApiResponse] = responses;
733718
*
734719
* // Operation#promise starts polling for the completion of the LRO.
735720
* return operation.promise();
736721
* })
737722
* .then(responses => {
738-
* // The final result of the operation.
739723
* const result = responses[0];
740-
*
741-
* // The metadata value of the completed operation.
742724
* const metadata = responses[1];
743-
*
744-
* // The response of the api call returning the complete operation.
745725
* const finalApiResponse = responses[2];
746726
* })
747727
* .catch(err => {
@@ -753,8 +733,7 @@ class AgentsClient {
753733
* // Handle the operation using the event emitter pattern.
754734
* client.importAgent({parent: formattedParent})
755735
* .then(responses => {
756-
* const operation = responses[0];
757-
* const initialApiResponse = responses[1];
736+
* const [operation, initialApiResponse] = responses;
758737
*
759738
* // Adding a listener for the "complete" event starts polling for the
760739
* // completion of the operation.
@@ -843,20 +822,14 @@ class AgentsClient {
843822
* // Handle the operation using the promise pattern.
844823
* client.restoreAgent({parent: formattedParent})
845824
* .then(responses => {
846-
* const operation = responses[0];
847-
* const initialApiResponse = responses[1];
825+
* const [operation, initialApiResponse] = responses;
848826
*
849827
* // Operation#promise starts polling for the completion of the LRO.
850828
* return operation.promise();
851829
* })
852830
* .then(responses => {
853-
* // The final result of the operation.
854831
* const result = responses[0];
855-
*
856-
* // The metadata value of the completed operation.
857832
* const metadata = responses[1];
858-
*
859-
* // The response of the api call returning the complete operation.
860833
* const finalApiResponse = responses[2];
861834
* })
862835
* .catch(err => {
@@ -868,8 +841,7 @@ class AgentsClient {
868841
* // Handle the operation using the event emitter pattern.
869842
* client.restoreAgent({parent: formattedParent})
870843
* .then(responses => {
871-
* const operation = responses[0];
872-
* const initialApiResponse = responses[1];
844+
* const [operation, initialApiResponse] = responses;
873845
*
874846
* // Adding a listener for the "complete" event starts polling for the
875847
* // completion of the operation.

packages/google-cloud-dialogflow/src/v2/contexts_client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ class ContextsClient {
266266
* client.listContexts({parent: formattedParent})
267267
* .then(responses => {
268268
* const resources = responses[0];
269-
* for (let i = 0; i < resources.length; i += 1) {
269+
* for (const resource of resources) {
270270
* // doThingsWith(resources[i])
271271
* }
272272
* })
@@ -286,7 +286,7 @@ class ContextsClient {
286286
* const nextRequest = responses[1];
287287
* // The actual response object, if necessary.
288288
* // const rawResponse = responses[2];
289-
* for (let i = 0; i < resources.length; i += 1) {
289+
* for (const resource of resources) {
290290
* // doThingsWith(resources[i]);
291291
* }
292292
* if (nextRequest) {

packages/google-cloud-dialogflow/src/v2/entity_types_client.js

+12-47
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ class EntityTypesClient {
374374
* client.listEntityTypes({parent: formattedParent})
375375
* .then(responses => {
376376
* const resources = responses[0];
377-
* for (let i = 0; i < resources.length; i += 1) {
377+
* for (const resource of resources) {
378378
* // doThingsWith(resources[i])
379379
* }
380380
* })
@@ -394,7 +394,7 @@ class EntityTypesClient {
394394
* const nextRequest = responses[1];
395395
* // The actual response object, if necessary.
396396
* // const rawResponse = responses[2];
397-
* for (let i = 0; i < resources.length; i += 1) {
397+
* for (const resource of resources) {
398398
* // doThingsWith(resources[i]);
399399
* }
400400
* if (nextRequest) {
@@ -747,20 +747,14 @@ class EntityTypesClient {
747747
* // Handle the operation using the promise pattern.
748748
* client.batchUpdateEntityTypes({parent: formattedParent})
749749
* .then(responses => {
750-
* const operation = responses[0];
751-
* const initialApiResponse = responses[1];
750+
* const [operation, initialApiResponse] = responses;
752751
*
753752
* // Operation#promise starts polling for the completion of the LRO.
754753
* return operation.promise();
755754
* })
756755
* .then(responses => {
757-
* // The final result of the operation.
758756
* const result = responses[0];
759-
*
760-
* // The metadata value of the completed operation.
761757
* const metadata = responses[1];
762-
*
763-
* // The response of the api call returning the complete operation.
764758
* const finalApiResponse = responses[2];
765759
* })
766760
* .catch(err => {
@@ -772,8 +766,7 @@ class EntityTypesClient {
772766
* // Handle the operation using the event emitter pattern.
773767
* client.batchUpdateEntityTypes({parent: formattedParent})
774768
* .then(responses => {
775-
* const operation = responses[0];
776-
* const initialApiResponse = responses[1];
769+
* const [operation, initialApiResponse] = responses;
777770
*
778771
* // Adding a listener for the "complete" event starts polling for the
779772
* // completion of the operation.
@@ -853,20 +846,14 @@ class EntityTypesClient {
853846
* // Handle the operation using the promise pattern.
854847
* client.batchDeleteEntityTypes(request)
855848
* .then(responses => {
856-
* const operation = responses[0];
857-
* const initialApiResponse = responses[1];
849+
* const [operation, initialApiResponse] = responses;
858850
*
859851
* // Operation#promise starts polling for the completion of the LRO.
860852
* return operation.promise();
861853
* })
862854
* .then(responses => {
863-
* // The final result of the operation.
864855
* const result = responses[0];
865-
*
866-
* // The metadata value of the completed operation.
867856
* const metadata = responses[1];
868-
*
869-
* // The response of the api call returning the complete operation.
870857
* const finalApiResponse = responses[2];
871858
* })
872859
* .catch(err => {
@@ -883,8 +870,7 @@ class EntityTypesClient {
883870
* // Handle the operation using the event emitter pattern.
884871
* client.batchDeleteEntityTypes(request)
885872
* .then(responses => {
886-
* const operation = responses[0];
887-
* const initialApiResponse = responses[1];
873+
* const [operation, initialApiResponse] = responses;
888874
*
889875
* // Adding a listener for the "complete" event starts polling for the
890876
* // completion of the operation.
@@ -971,20 +957,14 @@ class EntityTypesClient {
971957
* // Handle the operation using the promise pattern.
972958
* client.batchCreateEntities(request)
973959
* .then(responses => {
974-
* const operation = responses[0];
975-
* const initialApiResponse = responses[1];
960+
* const [operation, initialApiResponse] = responses;
976961
*
977962
* // Operation#promise starts polling for the completion of the LRO.
978963
* return operation.promise();
979964
* })
980965
* .then(responses => {
981-
* // The final result of the operation.
982966
* const result = responses[0];
983-
*
984-
* // The metadata value of the completed operation.
985967
* const metadata = responses[1];
986-
*
987-
* // The response of the api call returning the complete operation.
988968
* const finalApiResponse = responses[2];
989969
* })
990970
* .catch(err => {
@@ -1001,8 +981,7 @@ class EntityTypesClient {
1001981
* // Handle the operation using the event emitter pattern.
1002982
* client.batchCreateEntities(request)
1003983
* .then(responses => {
1004-
* const operation = responses[0];
1005-
* const initialApiResponse = responses[1];
984+
* const [operation, initialApiResponse] = responses;
1006985
*
1007986
* // Adding a listener for the "complete" event starts polling for the
1008987
* // completion of the operation.
@@ -1090,20 +1069,14 @@ class EntityTypesClient {
10901069
* // Handle the operation using the promise pattern.
10911070
* client.batchUpdateEntities(request)
10921071
* .then(responses => {
1093-
* const operation = responses[0];
1094-
* const initialApiResponse = responses[1];
1072+
* const [operation, initialApiResponse] = responses;
10951073
*
10961074
* // Operation#promise starts polling for the completion of the LRO.
10971075
* return operation.promise();
10981076
* })
10991077
* .then(responses => {
1100-
* // The final result of the operation.
11011078
* const result = responses[0];
1102-
*
1103-
* // The metadata value of the completed operation.
11041079
* const metadata = responses[1];
1105-
*
1106-
* // The response of the api call returning the complete operation.
11071080
* const finalApiResponse = responses[2];
11081081
* })
11091082
* .catch(err => {
@@ -1120,8 +1093,7 @@ class EntityTypesClient {
11201093
* // Handle the operation using the event emitter pattern.
11211094
* client.batchUpdateEntities(request)
11221095
* .then(responses => {
1123-
* const operation = responses[0];
1124-
* const initialApiResponse = responses[1];
1096+
* const [operation, initialApiResponse] = responses;
11251097
*
11261098
* // Adding a listener for the "complete" event starts polling for the
11271099
* // completion of the operation.
@@ -1204,20 +1176,14 @@ class EntityTypesClient {
12041176
* // Handle the operation using the promise pattern.
12051177
* client.batchDeleteEntities(request)
12061178
* .then(responses => {
1207-
* const operation = responses[0];
1208-
* const initialApiResponse = responses[1];
1179+
* const [operation, initialApiResponse] = responses;
12091180
*
12101181
* // Operation#promise starts polling for the completion of the LRO.
12111182
* return operation.promise();
12121183
* })
12131184
* .then(responses => {
1214-
* // The final result of the operation.
12151185
* const result = responses[0];
1216-
*
1217-
* // The metadata value of the completed operation.
12181186
* const metadata = responses[1];
1219-
*
1220-
* // The response of the api call returning the complete operation.
12211187
* const finalApiResponse = responses[2];
12221188
* })
12231189
* .catch(err => {
@@ -1234,8 +1200,7 @@ class EntityTypesClient {
12341200
* // Handle the operation using the event emitter pattern.
12351201
* client.batchDeleteEntities(request)
12361202
* .then(responses => {
1237-
* const operation = responses[0];
1238-
* const initialApiResponse = responses[1];
1203+
* const [operation, initialApiResponse] = responses;
12391204
*
12401205
* // Adding a listener for the "complete" event starts polling for the
12411206
* // completion of the operation.

0 commit comments

Comments
 (0)