Code Monkey home page Code Monkey logo

api-sdk-js's Introduction

Particeep API Client for JavaScript

Installation

Using npm

$ npm install https://github.com/Particeep/api-sdk-js.git

Importing directly compiled source present in /dist folder.

<script src="..../api-sdk.min.js"/>

Examples

See complete examples: https://github.com/Particeep/api-sdk-js/tree/master/examples .

Initialize the sdk

const ParticeepClient = require('../lib/api-sdk');

const client = new ParticeepClient({
    baseURL: 'https://api.particeep.com/v1',
    apiKey: 'd6a53e1a-fc8e-4251-9dda-fabbce5f2a2c',
    apiSecret: '9bb3c122-0272-4bed-a632-19d5d52c7b5e'
});

Performing a GET request

client.get('fundraises/search', {fundraise_type: 'FUNDRAISE_LOAN'}).then(result => {
    console.log(result.data);
}).catch(error => {
    console.log(error);
});

Performing a PUT request

client.put(`loan/fundraise`, {
    "name": "Nouvelle fundraise",
    "amount_target": 1000,
    "offer": {
        "term": 1,
        "rate": 0,
        "tax_rate": 0,
        "amount_min": 100,
        "bond_price": 100,
        "method": "Constant",
        "repayment_frequency": 0,
        "repayment_start_date": "2018-01-11T17:22:03Z"
    }
}).then(result => {
    console.log(result.data);
}).catch(error => {
    console.log(error);
});

Performing a POST request

const someFundraiseId = 'efcf18cd-3372-4sda-a54c-b8727d9bccc6';
client.post(`loan/fundraise/${someFundraiseId}`, {amount_target: 1100}).then(result => {
    console.log(result.data);
}).catch(error => {
    console.log(error);
});

Performing a DELETE request

client.delete(`loan/fundraise/${someFundraiseId}`).then(result => {
    console.log(result.data);
}).catch(error => {
    console.log(error);
});

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.