Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cloudways-js-client

code-gio83MIT0.0.47TypeScript support: included

A client library to power your applications with Cloudways API

Cloudways, API, server management, web apps, integration, automation

readme

Cloudways JS Client

npm version License TypeScript Ready

Description

Cloudways JS Client is a TypeScript-based client library that allows you to power your applications with the Cloudways API. It provides a convenient and strongly-typed way to interact with the Cloudways API, enabling you to manage servers, perform automation, and integrate Cloudways functionality into your web applications.

🚧 Under Development 🚧

Please note that this library is still under development. Although it's functional and can be used, some features might be incomplete or subject to changes.

Features

  • Easy-to-use client library for the Cloudways API.
  • Simplifies server management and web app integration.
  • Built with TypeScript for improved type safety and development experience.
  • Comprehensive documentation and code examples, including JSDoc comments.

Installation

You can install the package via npm:

npm install cloudways-js-client

Usage

The Cloudways JS Client library makes it easy to interact with the Cloudways API for various operations. Below are some examples to help you get started.

Initializing the API

Before performing any operations, initialize the API with your Cloudways account credentials:

import { initializeCloudwaysApi } from 'cloudways-js-client';

const email = 'your_email@example.com'; // Replace with your Cloudways account email
const apiKey = 'your_api_key'; // Replace with your Cloudways API key

initializeCloudwaysApi(email, apiKey);

Deleting a Server

To delete a server, use the deleteServer function. Ensure you have the correct server ID:

import { deleteServer } from "cloudways-js-client";

async function deleteServerA() {
  const serverId = 12345; // Replace with the server ID you want to delete
  await deleteServer(serverId);
  console.log("Server deleted successfully.");
}

Getting the List of Servers

You can retrieve the list of servers associated with your account using the getServersList function:

import { getServersList } from "cloudways-js-client";

async function listServers() {
  try {
    const servers = await getServersList();
    console.log("Servers List:", servers);
  } catch (error) {
    console.error("Error fetching servers list:", error);
  }
}

listServers();

Combining Operations

You can combine these functions to perform multiple operations. For example, to delete a server and then get the updated list of servers:

async function deleteServerAndGetList() {
  const serverId = 12345; // Replace with the server ID to delete
  await deleteServer(serverId);
  console.log("Server deleted successfully.");
  console.log("Updated Servers List:", await getServersList());
}

deleteServerAndGetList();

Issues

If you find any issues or have any feature requests, please open an issue on GitHub.

License

This project is open source and available under the MIT License.

changelog

cloudways-js-client

0.0.47

Patch Changes

  • af965ae: create a way to get operation Id status with data

0.0.46

Patch Changes

  • f2ea5b5: added handler for operation Id

0.0.45

Patch Changes

  • 1e37ffe: added all the services

0.0.44

Patch Changes

  • e982687: updated typescript

0.0.43

Patch Changes

  • fa5c6b9: updated get app list to be an array

0.0.42

Patch Changes

  • 1de492c: added monitor analytics

0.0.41

Patch Changes

  • 751eb08: updated readme file

0.0.40

Patch Changes

  • 8f2c4e3: updated read me file

0.0.39

Patch Changes

  • 59abf1c: updated read me file
  • 44a3faa: added ssh key services

0.0.38

Patch Changes

  • 5720337: added server and applications services

0.0.37

Patch Changes

  • 974252a: fixed all the list functions

0.0.36

Patch Changes

  • 76e5f0f: added operation api service

0.0.35

Patch Changes

  • fc9a9cb: updated the jsdoc documentation

0.0.34

Patch Changes

  • 0912c44: change build process
  • 14b6a27: Updated the build process to import cloudways services

0.0.33

Patch Changes

  • 5df8550: added build in github

0.0.32

Patch Changes

  • dc0d646: change changeset config to public

0.0.31

Patch Changes

  • 9ca78dc: Added the projects services

0.0.30

Patch Changes

  • cf97587: added the core and list services to the package
  • d732667: updating library to be modular and better documented