# @redhat-cloud-services/javascript-clients-shared

> If you want to use [RedHatInsights/shared](https://github.com/RedHatInsights/shared) you shouldn't use get requests directly, but rather use this client to integrate with this service.

Latest version **2.0.16** (published 2026-09-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @redhat-cloud-services/javascript-clients-shared
pnpm add @redhat-cloud-services/javascript-clients-shared
yarn add @redhat-cloud-services/javascript-clients-shared
bun add @redhat-cloud-services/javascript-clients-shared
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.16 |
| Published | 2026-09-04 |
| First published | 2024-05-15 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 116.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7 |
| Maintainers | karelhala, hyperkid, florkbr, chmulder |

## Links

- npm: https://www.npmjs.com/package/@redhat-cloud-services/javascript-clients-shared
- Repository: https://github.com/RedHatInsights/javascript-clients
- Homepage: https://github.com/RedHatInsights/javascript-clients#readme
- Issues: https://github.com/RedHatInsights/javascript-clients/issues
- npm.io page: https://npm.io/package/@redhat-cloud-services/javascript-clients-shared

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.20.0
- [tslib](https://npm.io/package/tslib.md) ^2.6.2

## Recent versions

- 2.0.16 (latest) — 2026-09-04
- 2.0.15 — 2026-08-14
- 2.0.14 — 2026-07-28
- 2.0.13 — 2026-07-21
- 2.0.12 — 2026-07-10
- 2.0.7 — 2026-05-29
- 2.0.6 — 2026-04-29
- 2.0.5 — 2025-10-21
- 2.0.4 — 2025-10-03
- 2.0.3 — 2025-09-26
- 2.0.2 — 2025-09-25
- 2.0.1 — 2025-09-24
- 2.0.0 — 2025-01-28
- 1.2.7 — 2024-12-09
- 1.2.6 — 2024-11-18
- … 4 more at https://npm.io/package/@redhat-cloud-services/javascript-clients-shared/versions

## README

# Javascript client for the shared API
If you want to use [RedHatInsights/shared](https://github.com/RedHatInsights/shared) you shouldn't use get requests directly, but rather use this client to integrate with this service.

## Install
NPM
```bash
npm install --save @redhat-cloud-services/shared-client
```

Or Yarn
```bash
yarn add @redhat-cloud-services/shared-client
```

### Usage
This client is using typescript and axios. Types are distributed with this package, so no need to define or install them separately.

This package comes with a client in its `api.ts` already defined with every call available. 
```JS
`import sharedClient from '@redhat-cloud-services/javascript-clients-shared/utils';

sharedClient.someEndpoint();
```

To bootstrap this API manually, you should create your own client via the `APIFactory` defined in the `@redhat-cloud-services/javascript-clients-shared` package. See below for an example:
```JS
import APIFactory from '@redhat-cloud-services/javascript-clients-shared/utils'; 
import exampleEndpoint from '@redhat-cloud-services/shared-client/ExampleEndpoint';

// BASE_PATH should be set in your constants file
const sharedApi = APIFactory(BASE_PATH, undefined, { exampleEndpoint });
export sharedApi;
```

If you want to add some interceptors you can use axios build in interceptors
```JS
import axios from 'axios';
import APIFactory from '@redhat-cloud-services/javascript-clients-shared/utils';
import exampleEndpoint from '@redhat-cloud-services/shared-client/ExampleEndpoint';

const instance = axios.create();

// Request interceptor
instance.interceptors.request.use((request) => {
    // some logic to do with request
});

// Response interceptor
instance.interceptors.response.use((response) => {
    // some logic to do with request
});

// Error interceptor
instance.interceptors.response.use(null, (error) => {
    // some logic to do with error
});

// BASE_PATH should be set in your constants file
const sharedApi = APIFactory(BASE_PATH, instance, { exampleEndpoint });
export sharedApi;
```
## Generating

Ensure you have the javascript-clients generator built first with `npm run build:generator`. Then, run `nx run @redhat-cloud-services/shared-client:generate` to generate the package.

## Building

Run `nx run @redhat-cloud-services/shared-client:build` to build the package. This creates the `dist` for publishing.

## Running unit tests

Run `nx run @redhat-cloud-services/shared-client:test` to execute the unit tests via [Jest](https://jestjs.io).

## API documentation

* [README](doc/README.md)

---
_Source: https://npm.io/package/@redhat-cloud-services/javascript-clients-shared · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
