amhawy-sdk
v0.0.4
Published
An SDK for Mahaseel Amhawy APIs
Downloads
1
Readme
amhawy-sdk
This is an SDK package for Mahaseel Amhawy API.
To get started simply install it:
npm install amhawy-sdk
Then import the Client
or Auth
to begin.
Example:
import { Client, isHttpError, getHttpErrorInfo } from 'amhawy-sdk'
async function test() {
const client = new Client('accessToken')
try {
const data = await client.Crops.getCrops()
data.data.name_ar // Outputs crop name
client.setAccessToken('newToken') // set new token.
client.addHeader('Header Name', 'Header Value') // add header.
} catch (error) {
if (isHttpError(e)) console.log(getHttpErrorInfo(e))
}
}