New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@squarecloud/api

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@squarecloud/api

A JavaScript Wrapper for SquareCloud API

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
510
-13.12%
Maintainers
2
Weekly downloads
 
Created
Source

Installation | Instalação

$ npm install @squarecloud/api

Setting Up | Configurando

First create an instance for the API:

const { SquareCloudAPI } = require('@squarecloud/api');

const api = new SquareCloudAPI('Your API Token');

Get your token at My Account in the SquareCloud Dashboard.

Getting user's informations | Adquirindo informações de usuários

// If the ID is not provided it will get your own informations
const user = await api.getUser('User Discord ID');

// To get private properties you have to check if you have access:
if (user.hasAccess()) {
  console.log(user.applications);
}

Using Applications | Usando aplicações

There are two ways for getting applications.

First

const user = await api.getUser();

// Through the array from the user (Only available if you have access to it)
const application = user.applications[0];

Second

// Using the Application ID
const application = await api.getApplication('ID');

Getting Applications Information | Adquirindo info de aplicações

Status

const application = await api.getApplication('ID');

// Returns a bunch of info about the current status of the app
console.log(await application.getStatus());

Logs

const application = await api.getApplication('ID');

// If `true` it will get the full logs url
// If `false` or blank it will get only the recent logs string
console.log(await application.getLogs(true));

Managing Applications | Gerenciando aplicações

Start, Stop & Restart

const application = await api.getApplication('ID');

// Every single method will return `true` if it is successfuly executed

await application.start();

await application.stop();

await application.restart();

Backup

const application = await api.getApplication('ID');

// Generates a backup and returns its download url
console.log(await application.backup());

Delete

const application = await api.getApplication('ID');

// Deletes your whole application
console.log(await application.delete());

Commit

import path from 'path'; // JavaScript: const path = require('path')

const application = await api.getApplication('ID');

// Commits a file change to your application
// You must use the absolute file path with the file extension
console.log(await application.commit(path.join(__dirname, 'index.js')));

Keywords

wrapper

FAQs

Package last updated on 17 Oct 2022

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