Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 913ac11

Browse files
fix: preserve default values in x-goog-request-params header (#820)
* chore: use gapic-generator-typescript v2.17.0 PiperOrigin-RevId: 474338479 Source-Link: googleapis/googleapis@d5d35e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: use fully qualified request type name in tests PiperOrigin-RevId: 475685359 Source-Link: googleapis/googleapis@7a12973 Source-Link: https://github.com/googleapis/googleapis-gen/commit/370c729e2ba062a167449c27882ba5f379c5c34d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test: fix translation Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Alexander Fenster <[email protected]>
1 parent 079a099 commit 913ac11

6 files changed

+1154
-1044
lines changed

samples/test/v3/translate_translate_text.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ describe(REGION_TAG, () => {
3232
const output = execSync(
3333
`node v3/${REGION_TAG}.js ${projectId} ${location} ${text}`
3434
);
35-
assert.match(output, /Translation: Zdravo svijete/);
35+
assert.match(output, /Translation: Здраво Свете/);
3636
});
3737
});

samples/test/v3beta1/translate_translate_text_beta.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ describe(REGION_TAG, () => {
3232
const output = execSync(
3333
`node v3beta1/${REGION_TAG}.js ${projectId} ${location} ${text}`
3434
);
35-
assert.match(output, /Translation: Zdravo svijete/);
35+
assert.match(output, /Translation: Здраво Свете/);
3636
});
3737
});

src/v3/translation_service_client.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export class TranslationServiceClient {
591591
options.otherArgs.headers = options.otherArgs.headers || {};
592592
options.otherArgs.headers['x-goog-request-params'] =
593593
this._gaxModule.routingHeader.fromParams({
594-
parent: request.parent || '',
594+
parent: request.parent ?? '',
595595
});
596596
this.initialize();
597597
return this.innerApiCalls.translateText(request, options, callback);
@@ -717,7 +717,7 @@ export class TranslationServiceClient {
717717
options.otherArgs.headers = options.otherArgs.headers || {};
718718
options.otherArgs.headers['x-goog-request-params'] =
719719
this._gaxModule.routingHeader.fromParams({
720-
parent: request.parent || '',
720+
parent: request.parent ?? '',
721721
});
722722
this.initialize();
723723
return this.innerApiCalls.detectLanguage(request, options, callback);
@@ -844,7 +844,7 @@ export class TranslationServiceClient {
844844
options.otherArgs.headers = options.otherArgs.headers || {};
845845
options.otherArgs.headers['x-goog-request-params'] =
846846
this._gaxModule.routingHeader.fromParams({
847-
parent: request.parent || '',
847+
parent: request.parent ?? '',
848848
});
849849
this.initialize();
850850
return this.innerApiCalls.getSupportedLanguages(request, options, callback);
@@ -992,7 +992,7 @@ export class TranslationServiceClient {
992992
options.otherArgs.headers = options.otherArgs.headers || {};
993993
options.otherArgs.headers['x-goog-request-params'] =
994994
this._gaxModule.routingHeader.fromParams({
995-
parent: request.parent || '',
995+
parent: request.parent ?? '',
996996
});
997997
this.initialize();
998998
return this.innerApiCalls.translateDocument(request, options, callback);
@@ -1078,7 +1078,7 @@ export class TranslationServiceClient {
10781078
options.otherArgs.headers = options.otherArgs.headers || {};
10791079
options.otherArgs.headers['x-goog-request-params'] =
10801080
this._gaxModule.routingHeader.fromParams({
1081-
name: request.name || '',
1081+
name: request.name ?? '',
10821082
});
10831083
this.initialize();
10841084
return this.innerApiCalls.getGlossary(request, options, callback);
@@ -1238,7 +1238,7 @@ export class TranslationServiceClient {
12381238
options.otherArgs.headers = options.otherArgs.headers || {};
12391239
options.otherArgs.headers['x-goog-request-params'] =
12401240
this._gaxModule.routingHeader.fromParams({
1241-
parent: request.parent || '',
1241+
parent: request.parent ?? '',
12421242
});
12431243
this.initialize();
12441244
return this.innerApiCalls.batchTranslateText(request, options, callback);
@@ -1435,7 +1435,7 @@ export class TranslationServiceClient {
14351435
options.otherArgs.headers = options.otherArgs.headers || {};
14361436
options.otherArgs.headers['x-goog-request-params'] =
14371437
this._gaxModule.routingHeader.fromParams({
1438-
parent: request.parent || '',
1438+
parent: request.parent ?? '',
14391439
});
14401440
this.initialize();
14411441
return this.innerApiCalls.batchTranslateDocument(
@@ -1580,7 +1580,7 @@ export class TranslationServiceClient {
15801580
options.otherArgs.headers = options.otherArgs.headers || {};
15811581
options.otherArgs.headers['x-goog-request-params'] =
15821582
this._gaxModule.routingHeader.fromParams({
1583-
parent: request.parent || '',
1583+
parent: request.parent ?? '',
15841584
});
15851585
this.initialize();
15861586
return this.innerApiCalls.createGlossary(request, options, callback);
@@ -1720,7 +1720,7 @@ export class TranslationServiceClient {
17201720
options.otherArgs.headers = options.otherArgs.headers || {};
17211721
options.otherArgs.headers['x-goog-request-params'] =
17221722
this._gaxModule.routingHeader.fromParams({
1723-
name: request.name || '',
1723+
name: request.name ?? '',
17241724
});
17251725
this.initialize();
17261726
return this.innerApiCalls.deleteGlossary(request, options, callback);
@@ -1875,7 +1875,7 @@ export class TranslationServiceClient {
18751875
options.otherArgs.headers = options.otherArgs.headers || {};
18761876
options.otherArgs.headers['x-goog-request-params'] =
18771877
this._gaxModule.routingHeader.fromParams({
1878-
parent: request.parent || '',
1878+
parent: request.parent ?? '',
18791879
});
18801880
this.initialize();
18811881
return this.innerApiCalls.listGlossaries(request, options, callback);
@@ -1934,7 +1934,7 @@ export class TranslationServiceClient {
19341934
options.otherArgs.headers = options.otherArgs.headers || {};
19351935
options.otherArgs.headers['x-goog-request-params'] =
19361936
this._gaxModule.routingHeader.fromParams({
1937-
parent: request.parent || '',
1937+
parent: request.parent ?? '',
19381938
});
19391939
const defaultCallSettings = this._defaults['listGlossaries'];
19401940
const callSettings = defaultCallSettings.merge(options);
@@ -2002,7 +2002,7 @@ export class TranslationServiceClient {
20022002
options.otherArgs.headers = options.otherArgs.headers || {};
20032003
options.otherArgs.headers['x-goog-request-params'] =
20042004
this._gaxModule.routingHeader.fromParams({
2005-
parent: request.parent || '',
2005+
parent: request.parent ?? '',
20062006
});
20072007
const defaultCallSettings = this._defaults['listGlossaries'];
20082008
const callSettings = defaultCallSettings.merge(options);

src/v3beta1/translation_service_client.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export class TranslationServiceClient {
591591
options.otherArgs.headers = options.otherArgs.headers || {};
592592
options.otherArgs.headers['x-goog-request-params'] =
593593
this._gaxModule.routingHeader.fromParams({
594-
parent: request.parent || '',
594+
parent: request.parent ?? '',
595595
});
596596
this.initialize();
597597
return this.innerApiCalls.translateText(request, options, callback);
@@ -722,7 +722,7 @@ export class TranslationServiceClient {
722722
options.otherArgs.headers = options.otherArgs.headers || {};
723723
options.otherArgs.headers['x-goog-request-params'] =
724724
this._gaxModule.routingHeader.fromParams({
725-
parent: request.parent || '',
725+
parent: request.parent ?? '',
726726
});
727727
this.initialize();
728728
return this.innerApiCalls.detectLanguage(request, options, callback);
@@ -849,7 +849,7 @@ export class TranslationServiceClient {
849849
options.otherArgs.headers = options.otherArgs.headers || {};
850850
options.otherArgs.headers['x-goog-request-params'] =
851851
this._gaxModule.routingHeader.fromParams({
852-
parent: request.parent || '',
852+
parent: request.parent ?? '',
853853
});
854854
this.initialize();
855855
return this.innerApiCalls.getSupportedLanguages(request, options, callback);
@@ -1002,7 +1002,7 @@ export class TranslationServiceClient {
10021002
options.otherArgs.headers = options.otherArgs.headers || {};
10031003
options.otherArgs.headers['x-goog-request-params'] =
10041004
this._gaxModule.routingHeader.fromParams({
1005-
parent: request.parent || '',
1005+
parent: request.parent ?? '',
10061006
});
10071007
this.initialize();
10081008
return this.innerApiCalls.translateDocument(request, options, callback);
@@ -1094,7 +1094,7 @@ export class TranslationServiceClient {
10941094
options.otherArgs.headers = options.otherArgs.headers || {};
10951095
options.otherArgs.headers['x-goog-request-params'] =
10961096
this._gaxModule.routingHeader.fromParams({
1097-
name: request.name || '',
1097+
name: request.name ?? '',
10981098
});
10991099
this.initialize();
11001100
return this.innerApiCalls.getGlossary(request, options, callback);
@@ -1253,7 +1253,7 @@ export class TranslationServiceClient {
12531253
options.otherArgs.headers = options.otherArgs.headers || {};
12541254
options.otherArgs.headers['x-goog-request-params'] =
12551255
this._gaxModule.routingHeader.fromParams({
1256-
parent: request.parent || '',
1256+
parent: request.parent ?? '',
12571257
});
12581258
this.initialize();
12591259
return this.innerApiCalls.batchTranslateText(request, options, callback);
@@ -1450,7 +1450,7 @@ export class TranslationServiceClient {
14501450
options.otherArgs.headers = options.otherArgs.headers || {};
14511451
options.otherArgs.headers['x-goog-request-params'] =
14521452
this._gaxModule.routingHeader.fromParams({
1453-
parent: request.parent || '',
1453+
parent: request.parent ?? '',
14541454
});
14551455
this.initialize();
14561456
return this.innerApiCalls.batchTranslateDocument(
@@ -1595,7 +1595,7 @@ export class TranslationServiceClient {
15951595
options.otherArgs.headers = options.otherArgs.headers || {};
15961596
options.otherArgs.headers['x-goog-request-params'] =
15971597
this._gaxModule.routingHeader.fromParams({
1598-
parent: request.parent || '',
1598+
parent: request.parent ?? '',
15991599
});
16001600
this.initialize();
16011601
return this.innerApiCalls.createGlossary(request, options, callback);
@@ -1735,7 +1735,7 @@ export class TranslationServiceClient {
17351735
options.otherArgs.headers = options.otherArgs.headers || {};
17361736
options.otherArgs.headers['x-goog-request-params'] =
17371737
this._gaxModule.routingHeader.fromParams({
1738-
name: request.name || '',
1738+
name: request.name ?? '',
17391739
});
17401740
this.initialize();
17411741
return this.innerApiCalls.deleteGlossary(request, options, callback);
@@ -1890,7 +1890,7 @@ export class TranslationServiceClient {
18901890
options.otherArgs.headers = options.otherArgs.headers || {};
18911891
options.otherArgs.headers['x-goog-request-params'] =
18921892
this._gaxModule.routingHeader.fromParams({
1893-
parent: request.parent || '',
1893+
parent: request.parent ?? '',
18941894
});
18951895
this.initialize();
18961896
return this.innerApiCalls.listGlossaries(request, options, callback);
@@ -1949,7 +1949,7 @@ export class TranslationServiceClient {
19491949
options.otherArgs.headers = options.otherArgs.headers || {};
19501950
options.otherArgs.headers['x-goog-request-params'] =
19511951
this._gaxModule.routingHeader.fromParams({
1952-
parent: request.parent || '',
1952+
parent: request.parent ?? '',
19531953
});
19541954
const defaultCallSettings = this._defaults['listGlossaries'];
19551955
const callSettings = defaultCallSettings.merge(options);
@@ -2017,7 +2017,7 @@ export class TranslationServiceClient {
20172017
options.otherArgs.headers = options.otherArgs.headers || {};
20182018
options.otherArgs.headers['x-goog-request-params'] =
20192019
this._gaxModule.routingHeader.fromParams({
2020-
parent: request.parent || '',
2020+
parent: request.parent ?? '',
20212021
});
20222022
const defaultCallSettings = this._defaults['listGlossaries'];
20232023
const callSettings = defaultCallSettings.merge(options);

0 commit comments

Comments
 (0)