@redhat-cloud-services/compliance-client 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +20 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [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)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@redhat-cloud-services/javascript-clients-shared` updated to version `1.2.7`
|
|
5
10
|
## [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)
|
|
6
11
|
|
|
7
12
|
## [1.1.2](https://github.com/RedHatInsights/javascript-clients/compare/@redhat-cloud-services/compliance-client-1.1.1...@redhat-cloud-services/compliance-client-1.1.2) (2024-11-18)
|
package/README.md
CHANGED
|
@@ -15,22 +15,29 @@ yarn add @redhat-cloud-services/compliance-client
|
|
|
15
15
|
### Usage
|
|
16
16
|
This client is using typescript and axios. Types are distributed with this package, so no need to define or install them separately.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
This package comes with a client in its `api.ts` already defined with every call available.
|
|
19
19
|
```JS
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
`import ComplianceClient from '@redhat-cloud-services/javascript-clients-shared/utils';
|
|
21
|
+
|
|
22
|
+
ComplianceClient.someEndpoint();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
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:
|
|
26
|
+
```JS
|
|
27
|
+
import APIFactory from '@redhat-cloud-services/javascript-clients-shared/utils';
|
|
28
|
+
import exampleEndpoint from '@redhat-cloud-services/compliance-client/ExampleEndpoint';
|
|
23
29
|
|
|
24
30
|
// BASE_PATH should be set in your constants file
|
|
25
|
-
const complianceApi = APIFactory(BASE_PATH, undefined, {
|
|
31
|
+
const complianceApi = APIFactory(BASE_PATH, undefined, { exampleEndpoint });
|
|
26
32
|
export complianceApi;
|
|
27
33
|
```
|
|
28
34
|
|
|
29
35
|
If you want to add some interceptors you can use axios build in interceptors
|
|
30
36
|
```JS
|
|
31
|
-
// api.js
|
|
32
37
|
import axios from 'axios';
|
|
33
|
-
import
|
|
38
|
+
import APIFactory from '@redhat-cloud-services/javascript-clients-shared/utils';
|
|
39
|
+
import exampleEndpoint from '@redhat-cloud-services/compliance-client/ExampleEndpoint';
|
|
40
|
+
|
|
34
41
|
const instance = axios.create();
|
|
35
42
|
|
|
36
43
|
// Request interceptor
|
|
@@ -49,17 +56,20 @@ instance.interceptors.response.use(null, (error) => {
|
|
|
49
56
|
});
|
|
50
57
|
|
|
51
58
|
// BASE_PATH should be set in your constants file
|
|
52
|
-
const complianceApi = APIFactory(BASE_PATH, instance, {
|
|
59
|
+
const complianceApi = APIFactory(BASE_PATH, instance, { exampleEndpoint });
|
|
53
60
|
export complianceApi;
|
|
54
61
|
```
|
|
62
|
+
## Generating
|
|
63
|
+
|
|
64
|
+
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.
|
|
55
65
|
|
|
56
66
|
## Building
|
|
57
67
|
|
|
58
|
-
Run `nx
|
|
68
|
+
Run `nx run @redhat-cloud-services/compliance-client:build` to build the package. This creates the `dist` for publishing.
|
|
59
69
|
|
|
60
70
|
## Running unit tests
|
|
61
71
|
|
|
62
|
-
Run `nx
|
|
72
|
+
Run `nx run @redhat-cloud-services/compliance-client:test` to execute the unit tests via [Jest](https://jestjs.io).
|
|
63
73
|
|
|
64
74
|
## API documentation
|
|
65
75
|
|