FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix: improve GetFilesResponse interface by olishevskii · Pull Request #2466 · googleapis/nodejs-storage · GitHub

This repository was archived by the owner on Mar 3, 2026. It is now read-only.
/ nodejs-storage Public archive

Fix: improve GetFilesResponse interface - #2466

Merged
ddelgrosso1 merged 5 commits into
googleapis:mainfrom
olishevskii:dev
May 14, 2024
Merged

Fix: improve GetFilesResponse interface#2466
ddelgrosso1 merged 5 commits into
googleapis:mainfrom
olishevskii:dev

Conversation

olishevskii commented May 12, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2464 🦕

olishevskii requested review from a team May 12, 2024 20:04
product-auto-label Bot added size: xs Pull request size is extra small. api: storage Issues related to the googleapis/nodejs-storage API. labels May 12, 2024
ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 13, 2024
gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 13, 2024
ddelgrosso1 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 13, 2024
yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 13, 2024

Copy link
Copy Markdown
Contributor

Hi @olishevskii thank you for opening a PR and trying to clean this up.

If you take a look at

nextQuery = Object.assign({}, query, {
you will see that what is actually being returned is a cross between GetFilesOptions & {pageToken?: string}. This PR omits the GetFilesOptions portion.

I'm also not sure we want to define a new interface that will need to be exported just to hold the page token portion.

olishevskii commented May 13, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Hi @ddelgrosso1.

I see your point of view regarding defining a new interface NextPageFilesOptions. I've rewritten my solution using TypeScript utilities. Additionally, I noticed that a query can be not only like GetFilesOptions but also like GetFilesCallback.

nodejs-storage/src/bucket.ts

Lines 2798 to 2802 in b4dbd73

getFiles(
queryOrCallback?: GetFilesOptions | GetFilesCallback,
callback?: GetFilesCallback
): void | Promise<GetFilesResponse> {
let query = typeof queryOrCallback === 'object' ? queryOrCallback : {};

Comment thread src/bucket.ts Outdated
}

export type GetFilesResponse = [File[], {}, unknown];
export type GetFilesResponse = [File[], (GetFilesOptions | GetFilesCallback) & Partial<Pick<GetFilesOptions, 'pageToken'>>, unknown];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You can omit GetFilesCallback, query can only be GetFilesOptions or an empty object. It will never get assigned the callback.

olishevskii May 14, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I have fixed it.

ddelgrosso1 added the owlbot:run Add this label to trigger the Owlbot post processor. label May 14, 2024
gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 14, 2024
ddelgrosso1 added kokoro:force-run Add this label to force Kokoro to re-run the tests. labels May 14, 2024
yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing interface's property

3 participants


Back | FazBrowse Home | New Git URL