Skip to content

[PB-6608] feat/add favorites support for files and folders - #418

Merged
victor-ferro merged 5 commits into
masterfrom
PB-6608-add-favorites
Jul 27, 2026
Merged

[PB-6608] feat/add favorites support for files and folders#418
victor-ferro merged 5 commits into
masterfrom
PB-6608-add-favorites

Conversation

@victor-ferro

Copy link
Copy Markdown
Contributor

Description

Adds SDK support for the new Favorites feature in the Drive API (drive-server-wip).

New methods in the Storage class:

Endpoint Method
PUT /files/{uuid}/favorite markFileAsFavorite(uuid)
DELETE /files/{uuid}/favorite unmarkFileAsFavorite(uuid)
GET /files/favorites getFavoriteFiles(payload) (cancellable)
PUT /folders/{uuid}/favorite markFolderAsFavorite(uuid)
DELETE /folders/{uuid}/favorite unmarkFolderAsFavorite(uuid)
GET /folders/favorites getFavoriteFolders(payload) (cancellable)

New types in drive/storage/types.ts: FavoriteStatusResponse, FavoriteFileDto,
FavoriteFolderDto, GetFavoriteFilesPayload, GetFavoriteFoldersPayload. The
paginated folder-content types and the hand-written item interfaces now expose an
optional isFavorite?: boolean returned by the backend.

Includes unit tests for all six methods following the existing request-shape pattern.

Notes

The backend PR adding isFavorite to the API is not deployed to production yet, so the
generated src/schema.ts does not include the field. This PR bridges that gap with
manual & { isFavorite?: boolean } intersections on the schema-derived types — safe to
ship before and after the backend deploy.

Once the backend is live in production, I have a follow-up PR already prepared that runs
yarn swagger (the production spec will then document isFavorite and the favorites
endpoints) and reverts those intersections to plain schema-derived aliases. Already
verified locally against the updated backend: types compile and tests pass without the
intersections.

@victor-ferro
victor-ferro requested a review from terrerox July 20, 2026 09:15
@victor-ferro victor-ferro self-assigned this Jul 24, 2026
Comment thread src/drive/storage/types.ts
Comment thread src/drive/storage/types.ts Outdated
export type FetchPaginatedFile =
paths['/folders/content/{uuid}/files']['get']['responses']['200']['content']['application/json']['files'][0];
paths['/folders/content/{uuid}/files']['get']['responses']['200']['content']['application/json']['files'][0] & {
isFavorite?: boolean;

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.

for me its better to wait the backend to return this params instead of overwriting it here

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.

Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections

Comment thread src/drive/storage/types.ts Outdated
paths['/folders/content/{uuid}/folders']['get']['responses']['200']['content']['application/json'],
'folders'
> & {
folders: FetchPaginatedFolder[];

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.

for example this omit 'folders' and adding folders again seems a bit tricky 🤔

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.

Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections

Comment thread src/drive/storage/types.ts Outdated

export type FavoriteItemType = 'file' | 'folder';

export type FavoriteFileDto = components['schemas']['FileDto'] & { isFavorite?: boolean };

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.

same here, maybe its better to wait the backend to return this params instead of creating a new dto. As this types could be removed once it is merged right? 🤔

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.

Done — regenerated the schema against master (favorites is merged but not deployed; the production spec URL 404s, so I ran the backend locally) and removed all the manual intersections

@victor-ferro
victor-ferro requested a review from larryrider July 27, 2026 09:13
@larryrider

larryrider commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

if you are going to publish a new sdk release, remember to bump the package.json version

@victor-ferro
victor-ferro merged commit b26ca6b into master Jul 27, 2026
1 check passed
@victor-ferro
victor-ferro deleted the PB-6608-add-favorites branch July 27, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants