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.2.1
  • 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",
  app_id: "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",
  app_id: "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/?link_id=3c7d6e9ecb0a4ac9ab9aedfa0035232d";
const { data } = await boxClient.listObjectsFromLink({
  fullLink: link,
});

The supported parameters are fullLink, linkId, page and limit

FAQs

Package last updated on 01 Feb 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