0.0.4 • Published 1 year ago
amhawy-sdk v0.0.4
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))
}
}