@bapp/api-client
Version: 
Client to consume BAPP API, auto-generated using openapi-typescript-codegen
28 lines (21 loc) • 958 B
Markdown
# @bapp/api-client
Client to consume BAPP API, auto-generated using [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen).
## Example Usage
```ts
import { bappAxiosClient, OpenAPI, CoreService, CompanyService } from '@bapp/api-client';
// Authentication
OpenAPI.TOKEN = "<YOUR_TOKEN>";
// OR
OpenAPI.TOKEN = async () => {
  // Custom logic to get API TOKEN, return empty string if token not available
};
// Usage
CoreService.coreCorList({}); // Get first page of COR codes
CoreService.coreCorList({ page: 2 }); // Get 2nd page of COR codes
CompanyService.companyBankAccountsList({ xCompanyId: 1,  }); // Get first page of company bank accounts
CompanyService.companyBankAccountsRetrieve({ xCompanyId: 1, id: 1 }); // Get company bank account with id 1
// Use the axios instance that the api client uses to make requests
bappAxiosClient.interceptors.response.use(undefined, (error) => {
  console.error(error);
});
```