Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@g123jp/ctw-box-sdk

Package Overview
Dependencies
Maintainers
5
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@g123jp/ctw-box-sdk

The following is the NodeJS implementation of the SDK APIs for CTW BOX

  • 0.1.10
  • npm
  • Socket score

Version published
Weekly downloads
90
increased by429.41%
Maintainers
5
Weekly downloads
 
Created
Source

CTW BOX - Core SDK

The following is the NodeJS implementation of the SDK APIs for CTW BOX

Goal

Having a component that can be integrated in other applications to use features from ctw-box like:

  • Searching for object
  • Retrieving objects with permanent links
  • Upoading new objects

Setup

import BoxClient from "@g123jp/box-client";

const boxClient = new BoxClient({
  endpoint: "https://ctwbox.stg.g123.jp", // Change between staging and production
  accessToken: "...", // Bearer token to handle auth and permissions
});

File Upload

The following is an example of usage for uploading a file to CTW BOX with some parameters like

  • Category
  • Project
  • Attributes Other parameters are not necessary and identified by the method, like
  • Owner: already identified by the access token
  • File Size: from file
  • Mime Type: from file
  • File Name: from file if not set
const options = {
  category: "icon",
  project: "auo",
  attributes: {
    style: "round",
    isTemplate: true,
  },
};

const { object_id } = await boxClient.fPutObject(file, metadata);

The search operation would be performed as follows

const options = {
  category: "icon",
  project: "auo",
  text: "image_02",
  searchType: "tag",
};
const { data } = await boxClient.listObjects(options);

With this operation, it is possibile to retrieve all the objects uploaded in a speciffic batch given the permanent URL

const link =
  "https://ctwbox.stg.g123.jp/?owner=lukasz.m&updated_at_range=1672996870_1672996881&page=1";
const { data } = await boxClient.listObjectsFromLink(options);

FAQs

Package last updated on 27 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc