# @gcgov/apiservice

> Extendable class that provides default rest API methods built upon Axios

Latest version **2.5.0** (published 2026-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gcgov/apiservice
pnpm add @gcgov/apiservice
yarn add @gcgov/apiservice
bun add @gcgov/apiservice
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 2.5.0 |
| Published | 2026-11-30 |
| First published | 2023-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 113.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | Andrew Sauder |
| Maintainers | asauder |

## Links

- npm: https://www.npmjs.com/package/@gcgov/apiservice
- Repository: https://github.com/gcgov/apiservice
- Homepage: https://github.com/gcgov/apiservice#readme
- Issues: https://github.com/gcgov/apiservice/issues
- npm.io page: https://npm.io/package/@gcgov/apiservice

## Dependencies (4)

- [vue](https://npm.io/package/vue.md) ^3.5.13
- [dexie](https://npm.io/package/dexie.md) ^4.0.10
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@types/web](https://npm.io/package/@types/web.md) ^0.0.367

## Recent versions

- 2.5.0 (latest) — 2026-11-30
- 2.3.8 — 2025-01-31
- 2.3.7 — 2025-01-02
- 2.3.6 — 2025-01-02
- 2.3.5 — 2025-01-02
- 2.3.3 — 2024-12-02
- 2.3.2 — 2024-11-25
- 2.3.0 — 2024-11-21
- 2.2.0 — 2024-11-12
- 2.1.0 — 2024-10-10
- 2.0.3 — 2024-08-27
- 2.0.2 — 2024-08-27
- 2.0.1 — 2024-08-27
- 2.0.0 — 2024-07-24
- 1.2.5 — 2024-02-12
- … 10 more at https://npm.io/package/@gcgov/apiservice/versions

## README

# Api Service

## Installation
`npm install @gcgov/apiservice`

## Example Usage
```js
//MyApiService.js
import {ApiService,ApiConfig} from "@gcgov/apiservice"

const config = new ApiConfig(
	'https://www.myapi.com/',      //base url for the api
	'XDEBUG_SESSION=PHPSTORM',     //url parameters to be added to every request
	true,                          //api requires authentication
	async () => {                  //method to get and auto refresh the api access token
		return await yourGetAccessTokenFn();
	}
)

class MyApiService extends ApiService {

	//add custom methods here, if required
    
}

export default new MyApiService( config )
```

## Development
This project builds with Node.js 26 LTS and npm 11. The `.nvmrc` file selects the Node.js version, and CI uses the same file.

```bash
nvm use
npm ci
npm run build
npm run lint
```

---
_Source: https://npm.io/package/@gcgov/apiservice · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
