UNPKG

tuix-timesheets-api

Version:

This package facilitates the client request to tuix timesheets api

49 lines (39 loc) 1.11 kB
# Tuix timesheets api ## Description Api Client for tuix timesheets api project ## Installation ``` npm i tuix-timesheets-api ``` If you need to use the stagging api client, then use the command ``` npm i tuix-timesheets-api@staging ``` Check the available versions in the following link: https://www.npmjs.com/package/tuix-timesheets-api?activeTab=versions ## Developing the app Tested on ``` node 18 npm 9.6.7 ``` Make an example request : ```javascript import { Configuration, ResponseError, TuixTimesheetsClientApi } from 'tuix-timesheets-api'; const configuration = new Configuration({ basePath: "https://staging-api-timesheets.tuix.ch", apiKey: "Bearer <JWT>" }); const timesheetAPIClient = new TuixTimesheetsClientApi(configuration); (async () => { try { const companies = await timesheetAPIClient.companiesGet() console.log({ companies }); } catch (error) { if(error instanceof ResponseError){ console.log(error.response.status, error.response.statusText); const data = await error.response.json() console.log(data); } } })() ```