The Cocoon Cloud SDK is the easiest way to integrate the Cocoon.io cloud compiler in any service or app. With this simple API, anyone can authenticate with their Cocoon.io account and create, update and compile HTML5 projects in the cloud programmatically.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
First things first. In order to access the Cocoon.io API you will need a ClientID credential (a ClientSecret too if your code runs in a server). You can contact us at firstname.lastname@example.org to request it.
Other than that, you only need to have NodeJS and NPM installed in your system.
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -sudo apt install -y nodejs
Clone the repository.
git clone https://github.com/CocoonIO/cocoon-cloud-sdk.git
And install its dependencies
The transpiled code should be in the out folder.
The tests are found in spec/tests.
To inspect the code style of the source code:
npm run inspect-src
To inspect the code style of the tests:
npm run inspect-spec
To use this repo as a NPM module in your project follow these instructions.
As mentioned previously: to access the Cocoon.io API you will need a ClientID credential (a ClientSecret too if your code runs in a server). You can contact us at email@example.com to request it.
Install NodeJS and NPM in your system.
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -sudo apt install -y nodejs
Install the module from NPM.
npm install cocoon-cloud-sdk --save
You must use a module bundler like Webpack to use it in a browser. Make sure the node definitions are included if you use typescript
And import it in your NodeJS or Web project.
You can read the documentation at CocoonIO.github.io/cocoon-cloud-sdk.
You can see an example of the usage in sample.
Log In into Cocoon.
const oAuth = grantTypePassword CLIENT_ID CLIENT_SECRET;oAuth;
Some API Examples. The SDK mimics the Cocoon.io REST API.
The Project API:
//List all projectscocoonSDKProjectAPI;//Create a new project by uploading a zip filecocoonSDKProjectAPI;//Create a new project from a urlcocoonSDKProjectAPI;//Create a new project from a repositorycocoonSDKProjectAPI;
For Signing Keys:
//List all signing keyscocoonSDKSigningKeyAPI;//Create a new Android signing keycocoonSDKSigningKeyAPI;
The objects returned by the API have their own methods to ease commonly performed tasks.
//Working with a Project objectcocoonSDKProjectAPI;//Working with a Signing Key objectcocoonSDKSigningKeyAPI;
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details