Skip to content
master
Switch branches/tags
Go to file
Code

Files

Permalink
Failed to load latest commit information.

Build Status codecov docs

Use this light-weight JS library with a promise-based interface for seamless communication with your ownCloud instance.
Supports only browser JS but requires JavaScript techniques like webpack to compile it properly.
For Node.js please have a look at this tag.

Install

$ npm install owncloud-sdk

Usage

const owncloud = require('owncloud-sdk');
let oc = new owncloud({
      baseUrl: config.owncloudURL,
      auth: {
        basic: {
          username: config.username,
          password: config.password
        }
      }
});

// Login
oc.login().then(status => {
    // STUFF
}).catch(error => {
    // HANDLE ERROR
});

// Share File With Link
oc.shares.shareFileWithLink('linkToYourFile').then(shareInfo => {
    console.log("Link is : " + shareInfo.getLink());
}).catch(error => {
    // HANDLE ERROR
});

// List all files
oc.files.list('/path/to/file/folder').then(files => {
    console.log(files);
}).catch(error => {
    console.log(error);
});

Example Projects

ownCloud web

ownCloud web will be the next generation web frontend for ownCloud. It uses owncloud-sdk.

All Methods Available

Full API documentation is available at docs

Building the Documentation

JSDocs

To build the jsdocs, type this command and follow the instructions on the terminal:

$ yarn build:docs

Unit/Integration tests

owncloud-sdk uses pactjs with jest for unit and integration test. Before running tests you need to create config.json file.

$ cp tests/config/config.sample.json tests/config/config.json

consumer tests

The pact consumer tests checks owncloud sdk against the pact mock server. In order to run these tests, use this comand

$ yarn test-consumer

If you have pacts from old test run in tests/pacts your tests will fail. Make sure to delete that before you run the tests again.

Provider tests

The pact provider tests tests the pacts generated from the consumer tests against the real owncloud bakcend server. For this you will need a actual owncloud server running. Then you can run the pact tests with this command.

$ PROVIDER_BASE_URL=<owncloud-backend-url> yarn test-provider

Team


Noveen Sachdeva

Vincent Petry

Thomas Müller

GSoC'17