GithubHelp home page GithubHelp logo

codebox-erlang's Introduction

Codebox Erlang library

This is an Erlang library for interacting with the CodeBox REST API.

This library currently supports the following operations:

  • Create a new box
  • List boxes
  • Manage collaborators(for private boxes): List, add, remove collaborators
  • Manage a box: Get Information about a box, remove a box
  • Events: List events for a box
  • Activity: Get box activity

setup

$ git clone https://github.com/mawuli-ypa/codebox-erlang
$ cd codebox-erlang; make; make eunit # to run eunit tests
$ OR rebar get-deps; rebar compile; rebar eunit skip_deps=true #if you use the rebar build tool

Usage

$ erl -pa ebin deps/*/ebin
Erlang R16B (erts-5.10.1) [source] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10.1  (abort with ^G)
1> application:set_env(codebox, api_token, YOUR_CODEBOX_API_TOKEN)

Create a new box

2> Box = #cb_box{name="codebox-erl", type="type1",
              stack="python", description, public=true},
3> Response = codebox:create_box(Box),
4> Response#cb_http_response.success.

List boxes

5> Response = codebox:list_boxes(),
6> Response#cb_http_response.data.

Retrieve activity log of a box

7> Response = codebox:box_activity(YOUR_BOX_ID),
8> Response#cb_http_response.data.

Retrive Codebox events

9> Response = codebox:box_events(YOUR_BOX_ID),
10> Response#cb_http_response.data

Retrieve box info

11> Response = codebox:box_info(YOUR_BOX_ID),
12> Response#cb_http_response.data.

Remove a box

13> Response = codebox:remove_box(YOUR_BOX_ID),
14> Response#cb_http_response.success.

Add collaborator

15> Response = codebox:add_collaborator(BoxId, "[email protected]"),
16> Response#cb_http_response.success.

List collaborators

17> Response = codebox:list_collaborators(YOUR_BOX_ID),
18> Response#cb_http_response.data.

Remove collaborator

19> Response = codebox:remove_box(YOUR_BOX_ID, "[email protected]"),
20> Response#cb_http_response.success.

Note

  • All API calls/actions return an #cb_http_response{} record.
  • Uses lhttpc for the HTTP requests.
  • For more information, please see CodeBox REST API docs

LICENSE

MIT LICENSE(see LICENSE)

Authors

Mawuli Adzaku

codebox-erlang's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.