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

zoho-workdrive-api

v0.1.5

Published

ZohoWorkDrive module, which makes communication with ZohoWorkDrive API easier

Downloads

3

Readme

zoho-workdrive-api

onix

ZohoWorkDrive module, which makes communication with ZohoWorkDrive API easier.

Install

npm i zoho-workdrive-api

API

Methods

Examples

Require module

const ZWorkDriveApi = require('zoho-workdrive-api');
const zWDApi = new ZWorkDriveApi(token, domain);

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

The following api methods do not require a domain and token if you passed them when creating an instance. But this structure allows you to make requests with other tokens and domains without creating a new instance of API

team

team.all

Return all user`s teams info

Returns: Object[] - User`s teams array of objects

| Param | Type | Description | Required | | ------------------ | ------------------- | ----------------------------- | -------- | | params | Object | | | | params.zuid | String | Zoho user`s account id | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.team
    .all({
        zuid: 'Zoho user`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with info all user`s teams
    });

// If you specified a domain and token when creating an instance and want to use them:

zWDApi.team
    .all({
        zuid: 'Zoho user`s id',
    })
    .then(data => {
        // console.log(data)
        // returns data with info all user`s teams
    });

//This is typical for the following examples too

team.info

Return user`s team by id

Returns: Object - User`s team object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.teamId | String | Id of the desired team | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.team
    .info({
        teamId: 'Zoho team`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with team`s info
    });

team.currentUser

Return current user for team

Returns: Object - current user object

| Param | Type | Description | Required | | ------------------ | ------------------- | ------------------------------------ | -------- | | params | Object | | | | params.teamId | String | Id of the desired team`s user | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.team
    .currentUser({
        teamId: 'Zoho team`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current user info
    });

workspase

ws.all

Return current team`s workspases

Returns: Object[] - current team`s workspases array of objects

| Param | Type | Description | Required | | ------------------ | ------------------- | ---------------------------------- | -------- | | params | Object | | | | params.teamId | String | Id of the desired team`s ws | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws
    .all({
        teamId: 'Zoho team`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current team`s workspases
    });

ws.info

Return current workspase by id

Returns: Object - current workspase object

| Param | Type | Description | Required | | ------------------ | ------------------- | ---------------------------------- | -------- | | params | Object | | | | params.teamId | String | Id of the desired team`s ws | true | | params.wsId | String | Id of the desired ws | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws
    .info({
        teamId: 'Zoho team`s id',
        wsId: 'Zoho ws id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current workspace
    });

ws.create

Create new workspace

Returns: Object - new workspase object

| Param | Type | Description | Required | | ------------------- | -------------------- | ---------------------------------- | -------- | | params | Object | | | | params.teamId | String | Id of the desired team`s ws | true | | params.name | String | Name your new workspace | true | | params.isPublicTeam | Boolean | Is public within team | false | | params.description | String | description for your new workspace | false | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws
    .create({
        teamId: 'Zoho team`s id',
        name: 'myWs',
        isPublicTeam: 'true',
        description: 'new workspace for example',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with new workspace
    });

ws.rename

Rename current workspace

Returns: Object - object with workspase id and new name

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.wsId | String | Id of the desired ws | true | | params.name | String | New name your workspace | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws
    .rename({
        wsId: 'Zoho ws id',
        name: 'renamedWs',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with ws id and new name
    });

ws.delete

Delete current workspace

Returns: Object - object with message about delete workspace

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.wsId | String | Id of the desired ws | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws
    .delete({
        wsId: 'Zoho ws id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with message about removing ws
    });

ws.users

ws.users.all

Return current workspase`s users

Returns: Object[] - current workspase`s users array of objects

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.wsId | String | Id of the desired ws | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws.users
    .all({
        wsId: 'Zoho ws id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current workspase`s users
    });

ws.users.add

Add new user for current workspase

Returns: Object - new workspase`s user object

| Param | Type | Description | Required | | ------------------ | ------------------- | ------------------------------------------------ | -------- | | params | Object | | | | params.wsId | String | Id of the desired ws | true | | params.email | String | New user email | true | | params.role | String | New user role (Admin, Organizer, Editor, Viewer) | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws.users
    .add({
        wsId: 'Zoho ws id',
        email: '[email protected]',
        role: 'Admin',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with new workspase`s user
    });

ws.users.newRole

Change user`s role

Returns: Object - object with user`s id and new role

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------------------------------- | -------- | | params | Object | | | | params.userId | String | Id of the desired user | true | | params.role | String | New role of user (Admin, Organizer, Editor, Viewer) | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws.users
    .newRole({
        userId: 'Zoho ws user`s id',
        role: 'Organizer',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with user`s id and new role
    });

ws.users.delete

Delete user

Returns: Object - object with message about delete user

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.userId | String | Id of the desired user | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ws.users
    .delete({
        userId: 'Zoho ws user`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with message about delete user
    });

privatespace

ps.info

Return user`s privatespaces

Returns: Object[] - current user`s privatespaces array of objects

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------------- | -------- | | params | Object | | | | params.userId | String | Id user that desired privatespace | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ps
    .info({
        userId: 'Zoho team`s current user`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current user`s privatespaces
    });

ps.files

Return current privatespace`s files by id

Returns: Object[] - current privatespace`s files array of objects

| Param | Type | Description | Required | | ------------------ | ------------------- | ------------------------------ | -------- | | params | Object | | | | params.psId | String | Id of the desired privatespace | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.ps
    .files({
        psId: 'Zoho ps id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current privatespace`s files
    });

folder

folder.info

Return info about any folder by id

Returns: Object - current folder object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.folderId | String | Id of the desired folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.folder
    .info({
        folderId: 'Zoho folder`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current folder
    });

folder.create

Return info about new folder

Returns: Object - new folder object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.parentId | String | Id of parent folder for new | true | | params.name | String | Name of new folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.folder
    .create({
        parentId: 'Zoho folder`s id',
        name: 'myNewFolder',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with new folder
    });

folder.rename

Rename current folder by id

Returns: Object - object with folder`s id and new name

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.folderId | String | Id of the desired folder | true | | params.name | String | New name your folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.folder
    .rename({
        folderId: 'Zoho folder`s id',
        name: 'renamedFolder',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with folder`s id and new name
    });

folder.copy

Copy current folder by id to folder with current id

Returns: Object - сopied folder object

| Param | Type | Description | Required | | ------------------ | ------------------- | -------------------------------------------------- | -------- | | params | Object | | | | params.folderId | String | Id of the desired folder | true | | params.parentId | String | Id of the folder where will be copy current folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.folder
    .copy({
        folderId: 'Zoho folder`s id',
        parentId: 'Zoho folder`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with сopied folder
    });

folder.delete

Delete folder

Returns: Object - object with message about delete folder

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.folderId | String | Id of the desired folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.folder
    .delete({
        folderId: 'Zoho folder`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with message about delete folder
    });

files

files.info

Return info about any file by id

Returns: Object - current file object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.fileId | String | Id of the desired file | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .info({
        fileId: 'Zoho file`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current file
    });

files.create

Create file

Returns: Object - new file object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------------------------------------------------------------------------- | -------- | | params | Object | | | | params.parentId | String | Id of the folder where will be file | true | | params.name | String | Name of your new file | true | | params.zFileType | String | Type of your new file (zw - writer native, zohosheet - sheet native, zohoshow - show native ) | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .create({
        parentId: 'Zoho folder`s id',
        name: 'my_table',
        zFileType: 'zohosheet',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with new file
    });

files.upload

Upload file

Returns: Object - current file object

| Param | Type | Description | Required | | ------------------------ | -------------------- | --------------------------------------- | -------- | | params | Object | | | | params.parentId | String | Id of the folder where will be file | true | | params.name | String | Name of your new file | true | | params.overrideNameExist | Boolean | Override if same file exist in a folder | true | | params.readableStream | file | Readable Stream with file's content | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .upload({
        parentId: 'Zoho folder`s id',
        name: 'myImg',
        overrideNameExist: 'true',
        readableStream: readableStream,
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with current file
    });

files.download

Download file by id

Returns: String - String, that simple transform to buffer

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.fileId | String | Id of the desired file | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .download({
        fileId: 'Zoho file`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with file in string format
    });

files.rename

Rename current file by id

Returns: Object - object with file`s id and new name

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.fileId | String | Id of the desired file | true | | params.name | String | New name your file | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .rename({
        fileId: 'Zoho file`s id',
        name: 'renamedFolder',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with files`s id and new name
    });

files.copy

Copy current files by id (more files) to folder with current id

Returns: Object[] - сopied files array of object

| Param | Type | Description | Required | | ------------------ | --------------------- | ------------------------------------------------- | -------- | | params | Object | | | | params.idArr | String[] | Array with file`s id |true | | params.parentId | String | Id of the folder where will be copy current files | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .copy({
        idArr: ['Zoho file`s id', 'Zoho file`s id', 'Zoho file`s id'],
        parentId: 'Zoho folder`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with сopied files
    });

files.delete

Delete current files by id (more files)

Returns: Object - object with message about delete files

| Param | Type | Description | Required | | ------------------ | --------------------- | --------------------------- | -------- | | params | Object | | | | params.idArr | String[] | Array with file`s id |true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .delete({
        idArr: ['Zoho file`s id', 'Zoho file`s id', 'Zoho file`s id'],
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with message about delete files
    });

files.move

Move current files by id (more files) to folder with current id

Returns: Object[] - movied files array of object

| Param | Type | Description | Required | | ------------------ | --------------------- | -------------------------------------------- | -------- | | params | Object | | | | params.idArr | Object[] | Array with file`s id and new parentId | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .move({
        idArr: [
            { id: 'Zoho file`s id', parentId: 'Zoho folder`s id' },
            { id: 'Zoho file`s id', parentId: 'Zoho folder`s id' },
            { id: 'Zoho file`s id', parentId: 'Zoho folder`s id' },
        ],
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with movied files
    });

files.list

Return info about all files by parent folder id

Returns: Object[] - folder`s files array of object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.folderId | String | Id of the parent folder | true | | params.accessToken | String | Zoho WorkDrive access token | false | | params.domain | String | Zoho api domain | false |

zWDApi.files
    .list({
        folderId: 'Zoho folder`s id',
        accessToken: accessToken,
        domain: domain,
    })
    .then(data => {
        // console.log(data)
        // returns data with folder`s files
    });

url

Return result get operation for current link (Only GET operation)

Returns: Object - result object

| Param | Type | Description | Required | | ------------------ | ------------------- | --------------------------- | -------- | | params | Object | | | | params.link | String | link for request | true | | params.accessToken | String | Zoho WorkDrive access token | false |

zWDApi.files
    .list({
        link: 'https://workdrive.zoho.com/api/v1/files/<id>',
        accessToken: accessToken,
    })
    .then(data => {
        // console.log(data)
        // returns data with result object
    });