Giter Site home page Giter Site logo

gojek's Introduction

gojek

Un-official Go-jek API Wrapper. API end point known by decompile the android APK.

Documentation

Getting Started

npm i gojek

Include Go-jek module

var gojek = require('gojek');

Use token for every request. See how to get token with login API

Configuration

By default the module set the location, uniqueId and appVersion. This value used to every request to the Go-Jek API. You can set manually if you need.

Set unique id

gojek.setUniqueId('YOUR_UNIQUE_ID');

Set app version

gojek.setAppVersion('YOUR_APP_VERSION');

Set token

By default the token is not set by this module. You can set token after you call a login API

gojek.setToken('YOUR_TOKEN');

Account

Login

Go-Jek support 2 method for login (Email or Phone number login)

gojek.loginWithEmail('[email protected]', function(error ,response, body){
	console.log(body);
});
gojek.loginWithPhone('+628123456789', function(error ,response, body){
	console.log(body);
});

After request that API, the registered phone number will receive an OTP. You must save your login_token to be used in next step :

gojek.generateCustomerToken('1234', 'login_token', function(error ,response, body){
	console.log(body);
});

Save access_token, then call :

gojek.setToken('access_token');

Get customer info

gojek.getCustomerInfo(function (err, res, body) {
    console.log(body);
});

Edit account

  • Param 1: Phone
  • Param 2: Email
  • Param 3: Name
gojek.editAccount('+628123456789','[email protected]','NAME', function (err, res, body) {
    console.log(body);
});

Logout

Go-Pay

Get Go-Pay info

gojek.getGoPayDetail(function (err, res, body) {
    console.log(body);
});

Get Go-Pay transaction history

  • Param 1: Page number (start from 1)
  • Param 2: Limit per page
gojek.getGoPayHistory(1, 30, function (err, res, body) {
    console.log(body);
});

Get Go-Pay id by phone

gojek.getGoPayQrId('+628123456789', function (err, res, body) {
    console.log(body);
});

Transfer Go-Pay money

gojek.transferGoPay('QR_ID', 10000, 'YOUR_DESCRIPTION', function (err, res, body) {
    console.log(body);
});

Go-Mart

Get nearest Go-Mart

  • Param 1: latitude,longitude
gojek.getNearestGoMart('-6.180495,106.824992', function (err, res, body) {
    console.log(body);
});

Go-Food

Get Go-Food Home

gojek.setToken('ACCESS_TOKEN');
gojek.setLocation('-6.180495,106.824992');
gojek.getGoFoodHome(gojek.getLocation(), function (err, res, body) {
    console.log(body);
});

Get nearest Go-Food

  • Param 1: latitude,longitude
  • Param 2: Page (start from 0)
  • Param 3: Limit
gojek.getNearestGoFood(gojek.getLocation(), 0, 10, function (err, res, body) {
    console.log(body);
});

Get restaurant

  • Param 1: Restaurant UUID
gojek.getRestaurant('UUID', function (err, res, body) {
    console.log(body);
});

Get restaurants by category

  • Param 1: Category code (Can be seen on get go-food home)
  • Param 2: Page number (start from 0)
  • Param 3: Limit per page
gojek.setToken('ACCESS_TOKEN');
gojek.setLocation('-6.180495,106.824992');
gojek.getRestaurantsByCategory('HEALTHY_FOOD', '0', '32', function (err, res, body) {
    console.log(body);
});

Booking

Get active booking

gojek.getActiveBooking(function (err, res, body) {
    console.log(body);
});

Get booking history

gojek.getBookingHistory(function (err, res, body) {
    console.log(body);
});

Get booking by order no

gojek.getBookingByOrderNo('123456', function (err, res, body) {
    console.log(body);
});

Cancel booking

Go-Points

Get Go-Points

gojek.getGoPoints(function (err, res, body) {
    console.log(body);
});

Next Go-Points

gojek.nextPointsToken(function (err, res, body) {
    console.log(body);
});

Redeem Go-Points

gojek.redeemGoPointsToken('POINTS_TOKEN_ID',function (err, res, body) {
    console.log(body);
});

gojek's People

Contributors

mychaelgo avatar ridho9 avatar

Watchers

 avatar James Cloos 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.