Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
fix: preserve default values in x-goog-request-params header (#928)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 474338479

Source-Link: googleapis/googleapis@d5d35e0

Source-Link: https://github.com/googleapis/googleapis-gen/commit/efcd3f93962a103f68f003e2a1eecde6fa216a27
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Sep 14, 2022
1 parent 86fc9e2 commit ea654b5
Show file tree
Hide file tree
Showing 6 changed files with 1,142 additions and 1,096 deletions.
28 changes: 14 additions & 14 deletions src/v1/adaptation_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',

This comment has been minimized.

Copy link
@Romick2005

Romick2005 Sep 27, 2022

Is there any benefit of using it if provided value type and default value type has to be strings?
Would be better to create simple helper nullish function, that will cover that case for you. Because I can see there are a lot of request.name ?? '' usage and having nullishEmptyString(request.name) might look nicer )

let request = {parent: false};
console.log(request.parent || '', " VS ", request.parent ?? '')
});
this.initialize();
return this.innerApiCalls.createPhraseSet(request, options, callback);
Expand Down Expand Up @@ -537,7 +537,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getPhraseSet(request, options, callback);
Expand Down Expand Up @@ -635,7 +635,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'phrase_set.name': request.phraseSet!.name || '',
'phrase_set.name': request.phraseSet!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updatePhraseSet(request, options, callback);
Expand Down Expand Up @@ -722,7 +722,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deletePhraseSet(request, options, callback);
Expand Down Expand Up @@ -829,7 +829,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createCustomClass(request, options, callback);
Expand Down Expand Up @@ -916,7 +916,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getCustomClass(request, options, callback);
Expand Down Expand Up @@ -1020,7 +1020,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'custom_class.name': request.customClass!.name || '',
'custom_class.name': request.customClass!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updateCustomClass(request, options, callback);
Expand Down Expand Up @@ -1119,7 +1119,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteCustomClass(request, options, callback);
Expand Down Expand Up @@ -1227,7 +1227,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listPhraseSet(request, options, callback);
Expand Down Expand Up @@ -1280,7 +1280,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listPhraseSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1342,7 +1342,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listPhraseSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1461,7 +1461,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listCustomClasses(request, options, callback);
Expand Down Expand Up @@ -1514,7 +1514,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listCustomClasses'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1576,7 +1576,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listCustomClasses'];
const callSettings = defaultCallSettings.merge(options);
Expand Down
28 changes: 14 additions & 14 deletions src/v1p1beta1/adaptation_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createPhraseSet(request, options, callback);
Expand Down Expand Up @@ -551,7 +551,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getPhraseSet(request, options, callback);
Expand Down Expand Up @@ -655,7 +655,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'phrase_set.name': request.phraseSet!.name || '',
'phrase_set.name': request.phraseSet!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updatePhraseSet(request, options, callback);
Expand Down Expand Up @@ -748,7 +748,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deletePhraseSet(request, options, callback);
Expand Down Expand Up @@ -861,7 +861,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createCustomClass(request, options, callback);
Expand Down Expand Up @@ -954,7 +954,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getCustomClass(request, options, callback);
Expand Down Expand Up @@ -1064,7 +1064,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'custom_class.name': request.customClass!.name || '',
'custom_class.name': request.customClass!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updateCustomClass(request, options, callback);
Expand Down Expand Up @@ -1169,7 +1169,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteCustomClass(request, options, callback);
Expand Down Expand Up @@ -1283,7 +1283,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listPhraseSet(request, options, callback);
Expand Down Expand Up @@ -1336,7 +1336,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listPhraseSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1398,7 +1398,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listPhraseSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1517,7 +1517,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listCustomClasses(request, options, callback);
Expand Down Expand Up @@ -1570,7 +1570,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listCustomClasses'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -1632,7 +1632,7 @@ export class AdaptationClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listCustomClasses'];
const callSettings = defaultCallSettings.merge(options);
Expand Down
Loading

0 comments on commit ea654b5

Please sign in to comment.