1.0.0 • Published 6 months ago

retablejs v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

ℹ️ Introduction

Official Node client for Retable API v1.

Note
For the API documentation, please visit API Document.

🚧Development Guide

To clone and run this application, you'll need Git and Node.js (which comes with npm) installed on your computer.

For building the package, from your command line:

# Clone this repository
$ git clone https://github.com/retable-io/retablejs
# Go into the repository
$ cd retablejs
# Install dependencies
$ npm install
# Build the package
$ npm run build

For testing, from your command line:

# Go into the repository
$ cd retablejs
# Run the test script
$ npm run test

💾Installation

npm install retablejs

⚡Client Usage

#### **Get a Workspace**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/workspace/{workspace_id}

```javascript
client.getWorkspace(workspace_id: string).then(res => {
    res.data // workspace data object
});
```

#### **Get All Workspaces**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/workspace

```javascript
client.getAllWorkspaces().then(res => {
  res.data // workspace data object
});
```

#### **Create a Workspace**
> ![POST](https://img.shields.io/badge/-POST-blue)  https://api.retable.io/v1/public/workspace

```javascript
client.createWorkspace(
  {
    name: 'string',
    description: 'string'
  }).then(res => {
  res.data // workspace data object
});
```
#### **Delete a Workspace**
> ![DELETE](https://img.shields.io/badge/-DELETE-red)  https://api.retable.io/v1/public/workspace/{workspace_id}

```javascript
client.deleteWorkspace(workspace_id: string).then(res => {
  res.data // workspace data object
});
```

#### **Get Workspace's Projects**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/workspace/{workspace_id}/project

```javascript
client.getWorkspaceProjects(workspace_id: string).then(res => {
 res.data // workspace data object
});
```

#### **Create a Project**
> ![POST](https://img.shields.io/badge/-POST-blue)  https://api.retable.io/v1/public/workspace/{workspace_id}/project

```javascript
client.createProject(workspace_id: string,  {
    name: 'string',
    description: 'string',
    color: 'string';
  }).then(res => {
  res.data // project data object
});
```

#### **Get a Project**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/project/{project_id}

```javascript
client.getProject(project_id: string).then(res => {
  res.data // project data object
});
```
 #### **Delete a Project**
> ![DELETE](https://img.shields.io/badge/-DELETE-red)  https://api.retable.io/v1/project/{project_id}

```javascript
client.deleteProject(project_id: string).then(res => {
  res.data //project data object
});
```

#### **Get Project's Tables**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/project/{project_id}/retable

```javascript
client.getProjectTables(project_id: string).then(res => {
  res.data // project data object
});
```

#### **Create a Table**
> ![POST](https://img.shields.io/badge/-POST-blue)  https://api.retable.io/v1/public/project/{project_id}/retable

```javascript
client.createTable(project_id: string).then(res => {
   res.data // retable data object
});
```

#### **Get a Table**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/retable/{retable_id}

```javascript
client.getTable(retable_id: string).then(res => {
  res.data // retable data object
});
```

#### **Delete Column**
> ![DELETE](https://img.shields.io/badge/-DELETE-red)  https://api.retable.io/v1/public/retable/{retable_id}/column

```javascript
client.deleteColumn(retable_id: string,{
    column_ids: [
        "<column_id>",
        "<column_id>"
    ]
}).then(res => {
  res.data // column data array
});
```

#### **Add Column**
> ![POST](https://img.shields.io/badge/-POST-blue)  https://api.retable.io/v1/public/retable/{retable_id}/column

```javascript
client.addColumn(retable_id: string,{
    columns: [
        {
            title: "hello",
            type: "text"
        }
    ]
}).then(res => {
  res.data // column data array
});
```

#### **Get Row**
> ![GET](https://img.shields.io/badge/-GET-green)  https://api.retable.io/v1/public/retable/{retable_id}/data

```javascript
client.getRow(retable_id: string).then(res => {
   res.data // row data object
});
```

#### **Insert Row**
> ![POST](https://img.shields.io/badge/-POST-blue)  https://api.retable.io/v1/public/retable/{retable_id}/data

```javascript
client.insertRow(retable_id: string,{
    data: [
        {
            columns: [
                {
                    column_id: "Bvt1FQhTyAPjmDx",
                    cell_value: "Isengard"
                }
            ]
        },
        {
            columns: [
                { 
                    column_id: "Bvt1FQhTyAPjmDx",
                    cell_value: "Rivendell"
                }
            ]
        }
    ]
}).then(res => {
  res.data // row data object
});
```

#### **Update Row**
> ![PUT](https://img.shields.io/badge/-PUT-orange)  https://api.retable.io/v1/public/retable/{retable_id}/data

```javascript
client.updateRow(retable_id: string,{
    rows: [
        {
            row_id: 2,
            columns: [
                {
                    column_id: "Bvt1FtQhTyAPjmDx",
                    update_cell_value: "Mordor"
                }
            ]
        },
    ]
}).then(res => {
  res.data // row data array
});
```

#### **Delete Row**
> ![DELETE](https://img.shields.io/badge/-DELETE-red)  https://api.retable.io/v1/public/retable/{retable_id}/data

```javascript
client.deleteRow(retable_id: string,{
    row_ids: [
        1
    ]
}).then(res => {
  res.data // row data object
});
```
1.0.0

6 months ago