@redhat-cloud-services/compliance-client
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -5,2 +5,7 @@ # Changelog | ||
## [2.0.2](https://github.com/RedHatInsights/javascript-clients/compare/@redhat-cloud-services/compliance-client-2.0.1...@redhat-cloud-services/compliance-client-2.0.2) (2024-12-09) | ||
### Dependency Updates | ||
* `@redhat-cloud-services/javascript-clients-shared` updated to version `1.2.7` | ||
## [2.0.1](https://github.com/RedHatInsights/javascript-clients/compare/@redhat-cloud-services/compliance-client-2.0.0...@redhat-cloud-services/compliance-client-2.0.1) (2024-11-22) | ||
@@ -7,0 +12,0 @@ |
{ | ||
"name": "@redhat-cloud-services/compliance-client", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -18,10 +18,16 @@ # Javascript client for the compliance API | ||
To correctly bootstrap this API you should use this config (no need to define it multiple times, just one config and reimport it anywhere you want to use it). | ||
This package comes with a client in its `api.ts` already defined with every call available. | ||
```JS | ||
// api.js | ||
import APIFactory from '@redhat-cloud-services/compliance-client/utils'; | ||
import createEndpoint from '@redhat-cloud-services/compliance-client/AssignRule'; | ||
`import ComplianceClient from '@redhat-cloud-services/javascript-clients-shared/utils'; | ||
ComplianceClient.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/compliance-client/ExampleEndpoint'; | ||
// BASE_PATH should be set in your constants file | ||
const complianceApi = APIFactory(BASE_PATH, undefined, { AssignRule }); | ||
const complianceApi = APIFactory(BASE_PATH, undefined, { exampleEndpoint }); | ||
export complianceApi; | ||
@@ -32,5 +38,6 @@ ``` | ||
```JS | ||
// api.js | ||
import axios from 'axios'; | ||
import { complianceApi } from '@redhat-cloud-services/compliance-client'; | ||
import APIFactory from '@redhat-cloud-services/javascript-clients-shared/utils'; | ||
import exampleEndpoint from '@redhat-cloud-services/compliance-client/ExampleEndpoint'; | ||
const instance = axios.create(); | ||
@@ -54,13 +61,16 @@ | ||
// BASE_PATH should be set in your constants file | ||
const complianceApi = APIFactory(BASE_PATH, instance, { AssignRule }); | ||
const complianceApi = APIFactory(BASE_PATH, instance, { exampleEndpoint }); | ||
export complianceApi; | ||
``` | ||
## Generating | ||
Ensure you have the javascript-clients generator built first with `npm run build:generator`. Then, run `nx run @redhat-cloud-services/compliance-client:generate` to generate the package. | ||
## Building | ||
Run `nx build @redhat-cloud-services/compliance-client` to build the library. | ||
Run `nx run @redhat-cloud-services/compliance-client:build` to build the package. This creates the `dist` for publishing. | ||
## Running unit tests | ||
Run `nx test @redhat-cloud-services/compliance-client` to execute the unit tests via [Jest](https://jestjs.io). | ||
Run `nx run @redhat-cloud-services/compliance-client:test` to execute the unit tests via [Jest](https://jestjs.io). | ||
@@ -67,0 +77,0 @@ ## API documentation |
538352
77