Comments (9)
Hi fatshotty,
this api has not been wrapped into the library yet.
I would put propose the following api with the most basic share to start with.
share:PublicShare = await file.createPublicShare();
doSomethingWith(share.url );
share:PublicShare = await folder.createPublicShare();
doSomethingWith(share.url );
Share:
url
resource: file | folder
Would that help? When do you need it?
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html
from nextcloud-node-client.
hi, thanks for reply.
I think your example code is very good. However Nextcloud gives the possibility to choose the "shareType": public, user, group. And also the expiration date.
Will it be possible to include those features?
Thanks again
from nextcloud-node-client.
sure it is possible.
However, user and group classes are the prerequisite for that.
This would take a bit longer
from nextcloud-node-client.
thanks.
My need, now, is only public-share. Hope this can help :)
thanks
from nextcloud-node-client.
Hi,
new release 1.1.1 is available
it contains now public shares
const file = await client.getFile("/products/MyFile.txt");
// share the file (works also for folder)
const createShare: ICreateShare = { fileSystemElement: file };
const share: Share = await client.createShare(createShare);
await share.setPassword("some password");
await share.setNote("some note\nnew line");
await share.setExpiration(new Date(2020, 11, 5));
await share.delete();
from nextcloud-node-client.
hi,
many thanks for new feature :)
one question:
const share: Share = await client.createShare(createShare);
Will this line create the 'public share' ? I mean:
with your example code I can create the 'share' resource and I can set password, note and expiration date.
I just need a public link. Should I only use the 'createShare( )' method?
Thanks
from nextcloud-node-client.
Hi,
thanks for the feedback.
I missed to document the most important part - the url.
Use the url of the share object to get the link.
createShare creates a share object. The object contains the url.
const file = await client.getFile("/products/MyFile.txt");
// share the file (works also for folder)
const createShare: ICreateShare = { fileSystemElement: file };
const share: Share = await client.createShare(createShare);
// change share settings
await share.setPassword("some password");
await share.setNote("some note\nnew line");
await share.setExpiration(new Date(2020, 11, 5));
// use the url to access the share
const shareLink:string = share.url;
// delete share, if not required anymore
await share.delete();
from nextcloud-node-client.
good job
thanks ;)
from nextcloud-node-client.
hi,
i'm trying to create a ShareLink as per your example.
It seems to work fine :)
I wonder: is there a way to get an already shared link for the same file?
I mean:
- I can create share link to file
/products/MyFile.txt
and obtain its link -> OK - I need to read the share link (if exists) to file
/products/OtherFile.txt
- in case it doesn't exist -> create a new one
- in case it exists -> get the already existing share link
Thanks
from nextcloud-node-client.
Related Issues (20)
- Issue in deleting folder/file immediately after its creation. HOT 2
- feature
- Getting TypeError: Client is not a constructor HOT 2
- Please document how to set up & build the project
- Support for UserGroup shares
- new feature: searchFilesByTag HOT 8
- file search
- uploadFolderCommand endless loop if folder does not exits
- getSubfolders returns original folder if folder name contains blanks
- getFolder() always return null
- publicUpload does not work HOT 5
- node-fetch types are not exported in fakeServer and http clienent
- Copy Folders with content HOT 3
- client.getQuota() does not return the correct quota
- Is it possible to upload a file on disk to nextcloud?
- Get share information HOT 1
- Javascript examples HOT 4
- Is there any plan to re-open this?
- Incorrect/missing URL encoding HOT 1
- getPercentCompleted returns only 0 and 100
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextcloud-node-client.