Skip to content

Commit 1caa0a4

Browse files
yoshi-automationJustinBeckwith
authored andcommitted
refactor: improve generated code style. (#120)
1 parent 9bfdb04 commit 1caa0a4

File tree

3 files changed

+21
-63
lines changed

3 files changed

+21
-63
lines changed

packages/google-cloud-redis/src/v1/cloud_redis_client.js

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class CloudRedisClient {
329329
* client.listInstances({parent: formattedParent})
330330
* .then(responses => {
331331
* const resources = responses[0];
332-
* for (let i = 0; i < resources.length; i += 1) {
332+
* for (const resource of resources) {
333333
* // doThingsWith(resources[i])
334334
* }
335335
* })
@@ -349,7 +349,7 @@ class CloudRedisClient {
349349
* const nextRequest = responses[1];
350350
* // The actual response object, if necessary.
351351
* // const rawResponse = responses[2];
352-
* for (let i = 0; i < resources.length; i += 1) {
352+
* for (const resource of resources) {
353353
* // doThingsWith(resources[i]);
354354
* }
355355
* if (nextRequest) {
@@ -547,20 +547,14 @@ class CloudRedisClient {
547547
* // Handle the operation using the promise pattern.
548548
* client.createInstance(request)
549549
* .then(responses => {
550-
* const operation = responses[0];
551-
* const initialApiResponse = responses[1];
550+
* const [operation, initialApiResponse] = responses;
552551
*
553552
* // Operation#promise starts polling for the completion of the LRO.
554553
* return operation.promise();
555554
* })
556555
* .then(responses => {
557-
* // The final result of the operation.
558556
* const result = responses[0];
559-
*
560-
* // The metadata value of the completed operation.
561557
* const metadata = responses[1];
562-
*
563-
* // The response of the api call returning the complete operation.
564558
* const finalApiResponse = responses[2];
565559
* })
566560
* .catch(err => {
@@ -584,8 +578,7 @@ class CloudRedisClient {
584578
* // Handle the operation using the event emitter pattern.
585579
* client.createInstance(request)
586580
* .then(responses => {
587-
* const operation = responses[0];
588-
* const initialApiResponse = responses[1];
581+
* const [operation, initialApiResponse] = responses;
589582
*
590583
* // Adding a listener for the "complete" event starts polling for the
591584
* // completion of the operation.
@@ -682,20 +675,14 @@ class CloudRedisClient {
682675
* // Handle the operation using the promise pattern.
683676
* client.updateInstance(request)
684677
* .then(responses => {
685-
* const operation = responses[0];
686-
* const initialApiResponse = responses[1];
678+
* const [operation, initialApiResponse] = responses;
687679
*
688680
* // Operation#promise starts polling for the completion of the LRO.
689681
* return operation.promise();
690682
* })
691683
* .then(responses => {
692-
* // The final result of the operation.
693684
* const result = responses[0];
694-
*
695-
* // The metadata value of the completed operation.
696685
* const metadata = responses[1];
697-
*
698-
* // The response of the api call returning the complete operation.
699686
* const finalApiResponse = responses[2];
700687
* })
701688
* .catch(err => {
@@ -722,8 +709,7 @@ class CloudRedisClient {
722709
* // Handle the operation using the event emitter pattern.
723710
* client.updateInstance(request)
724711
* .then(responses => {
725-
* const operation = responses[0];
726-
* const initialApiResponse = responses[1];
712+
* const [operation, initialApiResponse] = responses;
727713
*
728714
* // Adding a listener for the "complete" event starts polling for the
729715
* // completion of the operation.
@@ -790,20 +776,14 @@ class CloudRedisClient {
790776
* // Handle the operation using the promise pattern.
791777
* client.deleteInstance({name: formattedName})
792778
* .then(responses => {
793-
* const operation = responses[0];
794-
* const initialApiResponse = responses[1];
779+
* const [operation, initialApiResponse] = responses;
795780
*
796781
* // Operation#promise starts polling for the completion of the LRO.
797782
* return operation.promise();
798783
* })
799784
* .then(responses => {
800-
* // The final result of the operation.
801785
* const result = responses[0];
802-
*
803-
* // The metadata value of the completed operation.
804786
* const metadata = responses[1];
805-
*
806-
* // The response of the api call returning the complete operation.
807787
* const finalApiResponse = responses[2];
808788
* })
809789
* .catch(err => {
@@ -815,8 +795,7 @@ class CloudRedisClient {
815795
* // Handle the operation using the event emitter pattern.
816796
* client.deleteInstance({name: formattedName})
817797
* .then(responses => {
818-
* const operation = responses[0];
819-
* const initialApiResponse = responses[1];
798+
* const [operation, initialApiResponse] = responses;
820799
*
821800
* // Adding a listener for the "complete" event starts polling for the
822801
* // completion of the operation.

packages/google-cloud-redis/src/v1beta1/cloud_redis_client.js

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class CloudRedisClient {
323323
* client.listInstances({parent: formattedParent})
324324
* .then(responses => {
325325
* const resources = responses[0];
326-
* for (let i = 0; i < resources.length; i += 1) {
326+
* for (const resource of resources) {
327327
* // doThingsWith(resources[i])
328328
* }
329329
* })
@@ -343,7 +343,7 @@ class CloudRedisClient {
343343
* const nextRequest = responses[1];
344344
* // The actual response object, if necessary.
345345
* // const rawResponse = responses[2];
346-
* for (let i = 0; i < resources.length; i += 1) {
346+
* for (const resource of resources) {
347347
* // doThingsWith(resources[i]);
348348
* }
349349
* if (nextRequest) {
@@ -541,20 +541,14 @@ class CloudRedisClient {
541541
* // Handle the operation using the promise pattern.
542542
* client.createInstance(request)
543543
* .then(responses => {
544-
* const operation = responses[0];
545-
* const initialApiResponse = responses[1];
544+
* const [operation, initialApiResponse] = responses;
546545
*
547546
* // Operation#promise starts polling for the completion of the LRO.
548547
* return operation.promise();
549548
* })
550549
* .then(responses => {
551-
* // The final result of the operation.
552550
* const result = responses[0];
553-
*
554-
* // The metadata value of the completed operation.
555551
* const metadata = responses[1];
556-
*
557-
* // The response of the api call returning the complete operation.
558552
* const finalApiResponse = responses[2];
559553
* })
560554
* .catch(err => {
@@ -578,8 +572,7 @@ class CloudRedisClient {
578572
* // Handle the operation using the event emitter pattern.
579573
* client.createInstance(request)
580574
* .then(responses => {
581-
* const operation = responses[0];
582-
* const initialApiResponse = responses[1];
575+
* const [operation, initialApiResponse] = responses;
583576
*
584577
* // Adding a listener for the "complete" event starts polling for the
585578
* // completion of the operation.
@@ -675,20 +668,14 @@ class CloudRedisClient {
675668
* // Handle the operation using the promise pattern.
676669
* client.updateInstance(request)
677670
* .then(responses => {
678-
* const operation = responses[0];
679-
* const initialApiResponse = responses[1];
671+
* const [operation, initialApiResponse] = responses;
680672
*
681673
* // Operation#promise starts polling for the completion of the LRO.
682674
* return operation.promise();
683675
* })
684676
* .then(responses => {
685-
* // The final result of the operation.
686677
* const result = responses[0];
687-
*
688-
* // The metadata value of the completed operation.
689678
* const metadata = responses[1];
690-
*
691-
* // The response of the api call returning the complete operation.
692679
* const finalApiResponse = responses[2];
693680
* })
694681
* .catch(err => {
@@ -715,8 +702,7 @@ class CloudRedisClient {
715702
* // Handle the operation using the event emitter pattern.
716703
* client.updateInstance(request)
717704
* .then(responses => {
718-
* const operation = responses[0];
719-
* const initialApiResponse = responses[1];
705+
* const [operation, initialApiResponse] = responses;
720706
*
721707
* // Adding a listener for the "complete" event starts polling for the
722708
* // completion of the operation.
@@ -783,20 +769,14 @@ class CloudRedisClient {
783769
* // Handle the operation using the promise pattern.
784770
* client.deleteInstance({name: formattedName})
785771
* .then(responses => {
786-
* const operation = responses[0];
787-
* const initialApiResponse = responses[1];
772+
* const [operation, initialApiResponse] = responses;
788773
*
789774
* // Operation#promise starts polling for the completion of the LRO.
790775
* return operation.promise();
791776
* })
792777
* .then(responses => {
793-
* // The final result of the operation.
794778
* const result = responses[0];
795-
*
796-
* // The metadata value of the completed operation.
797779
* const metadata = responses[1];
798-
*
799-
* // The response of the api call returning the complete operation.
800780
* const finalApiResponse = responses[2];
801781
* })
802782
* .catch(err => {
@@ -808,8 +788,7 @@ class CloudRedisClient {
808788
* // Handle the operation using the event emitter pattern.
809789
* client.deleteInstance({name: formattedName})
810790
* .then(responses => {
811-
* const operation = responses[0];
812-
* const initialApiResponse = responses[1];
791+
* const [operation, initialApiResponse] = responses;
813792
*
814793
* // Adding a listener for the "complete" event starts polling for the
815794
* // completion of the operation.

packages/google-cloud-redis/synth.metadata

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-01-17T12:46:34.891303Z",
2+
"updateTime": "2019-02-02T12:21:24.211866Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.16.6",
8-
"dockerImage": "googleapis/artman@sha256:12722f2ca3fbc3b53cc6aa5f0e569d7d221b46bd876a2136497089dec5e3634e"
7+
"version": "0.16.8",
8+
"dockerImage": "googleapis/artman@sha256:75bc07ef34a1de9895c18af54dc503ed3b3f3b52e85062e3360a979d2a0741e7"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "0ac60e21a1aa86c07c1836865b35308ba8178b05",
16-
"internalRef": "229626798"
15+
"sha": "bce093dab3e65c40eb9a37efbdc960f34df6037a",
16+
"internalRef": "231974277"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)