npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

linshare-api-client

v0.0.21

Published

JS library for Linshare APIs

Downloads

102

Readme

linshare-api-client

JS library for Linshare APIs

Installation

NPM:

npm install linagora/linshare-api-client

Bower:

bower install linshare-api-client

Usage

const { Client } = require('linshare-api-client');

const client = new Client({
  baseUrl: 'https://files.linshare.local/linshare/webservice/rest',
  auth: {
    type: 'basic',
    username: '<username>',
    password: '<password>'
    // OR by JWT
    // type: 'jwt',
    // token: '<token>'
  }
});

client.user.workgroup.list()
  .then(data => console.log(data))
  .catch(err => console.error(err));

On browser:

const Client = window.LinshareApiClient.Client;

...

APIs

User API

Authentication

Get authorized user

client.user.authentication.authorized().then(...)

Workgroup

Create document in a node of work group from URL

client.user.workgroup.createDocumentFromUrl('work-group-uuid', documentInfo, options)
  .then(...)
  • documentInfo: an object contains
    • url (required): file url
    • fileName (optional): file name
    • size (optional): file size
  • options (optional): { parent: 'parentNodeUuid', async: true/false, strict: true/false }

Delete a node in workgroup

client.user.workgroup.deleteNode('work-group-uuid', 'node-uuid')
  .then(...)

List workgroups

client.user.workgroup.list().then(...)

List nodes in a workgroup

client.user.workgroup.listNodes(workgroupUuid, options).then(...)
  • options (optional): { parent: 'parentNodeUuid', type: 'FOLDER | DOCUMENT' }

Update a node in workgroup

client.user.workgroup.updateNode('work-group-uuid', 'node-uuid', modified)
  .then(...)

Documents

Get a document

client.user.documents.get('documentUuid').then(...)

List documents

client.user.documents.list().then(...)

Create a document

Upload a file to My space

var options = {
  async: false,
  onUploadProgress: function(progressEvent) {
    var processedPercent = Math.round((progressEvent.loaded * 100) / progressEvent.total);
    console.log('Uploading...', processedPercent);
  }
};
var formData = new FormData();

formData.append('file', file);
formData.append('filesize', fileSize);

client.user.documents.create(formData, options).then(...)

Share

Share documents

client.user.shares.shareDocuments({
  documents: ['documentUuid1', 'documentUuid2'],
  recipients: [{
    mail: '[email protected]'
  }, {
    mail: '[email protected]'
  }]
}).then(...)

Download document

Accept different response type with default value being blob. You are advised to use different response types based on running environment:

  • blob is for browser
  • arrayBuffer is for nodejs environment
client.user.workgroup.downloadDocument('work-group-uuid', 'node-uuid', { responseType: 'blob' })
  .then(function(blob) {
    const file = new File([blob], 'documentname');
  })

Get a node in workgroup

client.user.workgroup.getNode('work-group-uuid', 'node-uuid')
  .then(...)

Shared space nodes

Get a member of a shared space node

client.user.sharedSpaceNodes.findMemberByAccountUuid('shared-space-node-uuid', 'member-uuid')
  .then(...)

Shared space roles

Get a shared space role by uuid

client.user.sharedSpaceRoles.findAllPermissions('shared-space-role-uuid')
  .then(...)

Release

Assume that you are in master branch and you have write access to the origin remote, type the following command to release a new version:

./scripts/release.sh x.y.z

In case your Git remote is NOT origin:

./scripts/release.sh x.y.z my-remote

Licence

Affero GPL v3