Skip to content
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

Add File and Folder API #501

Merged
merged 1 commit into from Oct 2, 2022
Merged

Add File and Folder API #501

merged 1 commit into from Oct 2, 2022

Conversation

skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv commented Sep 30, 2022

new File({
	source: 'https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg',
	id: 1234,
	owner: 'emma',
	mime: 'image/jpeg',
	crtime: new Date(),
	mtime: new Date(),
	size: 28942873,
	permissions: Permission.ALL,
	attributes: {
		hasPreview: true,
	},
})

image

@skjnldsv skjnldsv self-assigned this Sep 30, 2022
@skjnldsv skjnldsv added the enhancement New feature or request label Sep 30, 2022
@codecov
Copy link

codecov bot commented Sep 30, 2022

Codecov Report

Base: 97.18% // Head: 98.68% // Increases project coverage by +1.50% 🎉

Coverage data is based on head (e025fd7) compared to base (0aa39fd).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #501      +/-   ##
==========================================
+ Coverage   97.18%   98.68%   +1.50%     
==========================================
  Files           4       10       +6     
  Lines          71      152      +81     
  Branches       18       37      +19     
==========================================
+ Hits           69      150      +81     
  Misses          2        2              
Impacted Files Coverage Δ
lib/files/file.ts 100.00% <100.00%> (ø)
lib/files/fileType.ts 100.00% <100.00%> (ø)
lib/files/folder.ts 100.00% <100.00%> (ø)
lib/files/node.ts 100.00% <100.00%> (ø)
lib/files/nodeData.ts 100.00% <100.00%> (ø)
lib/index.ts 100.00% <100.00%> (ø)
lib/permissions.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@skjnldsv skjnldsv force-pushed the feat/file-folder-api branch 4 times, most recently from cac806a to a2f62ec Compare October 1, 2022 10:06
Copy link
Contributor

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

🐕

lib/files/folder.ts Outdated Show resolved Hide resolved
lib/files/node.ts Outdated Show resolved Hide resolved
*/
get source(): string {
// strip any ending slash
return this._data.source.replace(/\/$/i, '')
Copy link
Contributor

Choose a reason for hiding this comment

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

does this imply that invalid data was passed to data.source?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's just to help standardizing the source format a tiny bit. Would you prefer a more restrictive approach and throwing?
I wasn't sure about leaving the ending slash or not. :)

Copy link

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

🐘

@juliushaertl
Copy link
Contributor

attributes would be usable for any webdav attributes not being part of the typed classes I guess?

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Oct 1, 2022

attributes would be usable for any webdav attributes not being part of the typed classes I guess?

Yes, whatever we want that is not some kind of 'official' for a file or folder representation :)

Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

Few comments, and as I said, I would go for prefixing the class names, NcFile, NcFolder, ... to prevent confusion with default browser APIs.

lib/files/node.ts Outdated Show resolved Hide resolved
lib/files/node.ts Outdated Show resolved Hide resolved
lib/files/node.ts Outdated Show resolved Hide resolved
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv merged commit 4dfd5c4 into master Oct 2, 2022
@skjnldsv skjnldsv deleted the feat/file-folder-api branch October 2, 2022 10:07
@skjnldsv skjnldsv mentioned this pull request Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants