0.0.2 • Published 3 months ago

tea-oss-asmarasepikoe v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

@indoxcapital/tea-oss-asmarasepikoe

Introduction

Library ini digunakan untuk mempermudah terhubung dengan API medan pedia Perkenalan Fitur yang tersedia disini sesuai Web:

  • getProfile: profile / cek balance
  • getServices: Service list (mendapatkan list service)
  • getOrder: memesan pada layanan service
  • getStatus: mendapatkan status pesanan
  • refill: refill adalah mengulang pesanan / order ulang di target yg sama
  • refillStatus: refill status digunakan untuk mengecek apakah refill berhasil atau tidak

Beberapa fungsi pendukung/setter di lib ini

  • setUrl: Digunakan untuk set url / base url
  • setMethod: Digunakan untuk set method (Sekarang untuk di medan pedia hanya diperbolehkan method POST)

Installation

Untuk menggunakan LIB ini, perlu menginstall nya terlebih dahulu kedalan project node js anda:

yarn add @indoxcapital/tea-oss-asmarasepikoe

npm install @indoxcapital/tea-oss-asmarasepikoe

Calling class

// ESM
import MedanPedia from '@indoxcapital/tea-oss-asmarasepikoe'
// or
import {MedanPedia} from '@indoxcapital/tea-oss-asmarasepikoe'
// commonjs
const MedanPedia = require('@indoxcapital/tea-oss-asmarasepikoe')
// or
const {MedanPedia} = require('@indoxcapital/tea-oss-asmarasepikoe')

Example

Penggunaan pertama:

const ID = '12345'
const Apikey = 'example-d6d7j-ejeiei-ejeie'
const mp = new MedanPedia(ID, Apikey)

untuk mengeset url / method:

mp.setUrl('https://api.medanpedia.co.id')
mp.setMethod('POST')

setter diatas bersifat opsional, karena didalam lib ini seharus nya sudah ditambahkan url dan method nya

example getProfile

const result = await mp.getProfile()
console.log(result)

example getServices

const isFav = false
const result = await mp.getServices(isFav)
console.log(result)

example getOrder

const serviceId = 1234 
const target = 'bolaxd'
const quantity = 1000 
// optional 
const customComments = 'example comment'
const customLink = 'https://blabla'

const result = await mp.getOrder(serviceId, target, quantity, customComments, customLink)
console.log(result)

example getStatus

const orderId = 1234566
const result = await mp.getStatus(orderId)
console.log(result)

example refill

const orderId = 1234566
const result = await mp.refill(orderId)
console.log(result)

example refillStatus

const refillId = 123
const result = await mp.refillStatus(refillId)
console.log(result)

License

This library is provided under the MIT License