Skip to content
This repository was archived by the owner on Feb 19, 2024. It is now read-only.

computology/packagecloud.js

This branch is 1 commit ahead of main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

126d208 · Feb 18, 2024

History

68 Commits
Feb 18, 2024
May 6, 2019
Jul 22, 2018
May 6, 2019
Nov 7, 2017
Oct 31, 2017
Oct 26, 2017
Jul 20, 2018
May 6, 2019
May 6, 2019
May 6, 2019

Repository files navigation

Build status

packagecloud.js

JavaScript library for communicating with the packagecloud.io API.

Implemented API Endpoints

Installation

npm install packagecloud

or

yarn add packagecloud

Creating a Client

In the browser:

// i.e., Rails with a sprockets manifest
//= require packagecloud/dist/packagecloud.browser.js
...
// main.js
var pc = new packagecloud({token:'your_api_token', baseUrl:'https://packagecloud.io'});

Or in a NodeJS environment:

import PackageCloud from "packagecloud";
const pc = new packagecloud({token:'your_api_token', baseUrl:'https://packagecloud.io'});

Result objects

Every client API method call returns a Promise object, which is "thenable". For example, the following code will fetch a list of distributions and return a promise object that allows us to define what happens on success, or failure.

var success = function(data) {
  console.log("success!", data);
}
var error = function(err) {
  console.log("error!", error);
}
pc.getDistribution().then(success, error)

Copyright

Copyright (c) 2018 Computology, LLC

See LICENSE file for details.