-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(diregapic)(LRO): Add minimum wrapper for mitigate future full-implementation diregapic LRO change #967
Conversation
…mentation diregapic LRO change
typescript/src/schema/proto.ts
Outdated
method.options?.['.google.api.http'].get || | ||
(method.name === 'Wait' && method.options?.['.google.api.http'].post) | ||
) | ||
? true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there is no need to write booleanValue ? true : false
, just booleanValue
is enough. So you can just remove lines 180 and 181.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed line 180 and 181, but update isDiregapic
with the type boolean | '' | null | undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, let's just get rid of any
:)
@@ -372,14 +377,22 @@ export class AddressesClient { | |||
'project': request.project || '', | |||
}); | |||
this.initialize(); | |||
return this.innerApiCalls.delete(request, options, callback); | |||
return this.innerApiCalls.delete(request, options, callback) | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need to disable no-explicit-any
now :)
Wrap an unary operations, that made it return a response compatible with the eventual LRO operation. In another word, utilize duck typing to return the similar structure, but no ".promise" field.
Sample code test on generated client library:
The output:
insert address operation.id:: {
latestResponse: {
warnings: [],
id: '3894509470566436984',
_id: 'id',
startTime: '2021-08-29T22:37:27.644-07:00',
_startTime: 'startTime',
targetLink: 'https://www.googleapis.com/compute/v1/projects/gapic-images/regions/us-central1/addresses/operation-insert-address-test-188',
_targetLink: 'targetLink',
progress: 0,
_progress: 'progress',
region: 'https://www.googleapis.com/compute/v1/projects/gapic-images/regions/us-central1',
_region: 'region',
operationType: 'insert',
_operationType: 'operationType',
status: 'RUNNING',
_status: 'status',
...
},
done: false,
name: '3894509470566436984',
metadata: null,
result: {}
}