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 the SquareCloud API

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
606
2.36%
Maintainers
2
Weekly downloads
 
Created
Source

Installation | Instalação

$ npm install @squarecloud/api

Getting your API Key | Adquirindo sua chave da API

The first thing you have to do is to get your API key.

  • Open the SquareCloud Dashboard.
  • Login with your Discord account.
  • Go to My Account.
  • And finally click Regenerate API/CLI Key.

Setting Up | Configurando

Creating an API instance:

import SquareCloudAPI from '@squarecloud/api'; // JavaScript: const SquareCloudAPI = require('@squarecloud/api')

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

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 collection from the user (Only available if you have access to it)
const application = user.applications.get('Application Id');

Second

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

Getting Applications Information | Adquirindo info de aplicações

Status

const application = await api.getApplication('Application Id');

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

Logs

const application = await api.getApplication('Application Id');

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

Managing Applications | Gerenciando aplicações

Start, Stop & Restart

const application = await api.getApplication('Application Id');

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

application.start();

application.stop();

application.restart();

Backup

const application = await api.getApplication('Application Id');

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

Delete

const application = await api.getApplication('Application Id');

// Deletes your whole application
application.delete();

Commit

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

const application = await api.getApplication('Application Id')

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

// You can use Buffers too:
application.commit(<Buffer>, 'index.js')

Keywords

wrapper

FAQs

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