Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs for compliance and config-manager-client #317

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions packages/compliance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ This client is using typescript and axios. Types are distributed with this packa
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).
```JS
// api.js
import axios from 'axios';
import { Configuration } from '@redhat-cloud-services/compliance-client';
const instance = axios.create();
import APIFactory from '@redhat-cloud-services/compliance-client/utils';
import createEndpoint from '@redhat-cloud-services/compliance-client/AssignRule';

// BASE_PATH should be set in your constants file
const configApi = new Configuration(undefined, BASE_PATH, instance);
export configApi;
const complianceApi = APIFactory(BASE_PATH, undefined, { AssignRule });
export complianceApi;
```

If you want to add some interceptors you can use axios build in interceptors
```JS
// api.js
import axios from 'axios';
import { Configuration } from '@redhat-cloud-services/compliance-client';
import { complianceApi } from '@redhat-cloud-services/compliance-client';
const instance = axios.create();

// Request interceptor
Expand All @@ -50,8 +49,8 @@ instance.interceptors.response.use(null, (error) => {
});

// BASE_PATH should be set in your constants file
const configApi = new Configuration(undefined, BASE_PATH, instance);
export configApi;
const complianceApi = APIFactory(BASE_PATH, instance, { AssignRule });
export complianceApi;
```

## Building
Expand Down
15 changes: 7 additions & 8 deletions packages/config-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ This client is using typescript and axios. Types are distributed with this packa
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).
```JS
// api.js
import axios from 'axios';
import { Configuration } from '@redhat-cloud-services/config-manager-client';
const instance = axios.create();
import APIFactory from '@redhat-cloud-services/config-manager-client/utils';
import createEndpoint from '@redhat-cloud-services/config-manager-client/CreateProfile';

// BASE_PATH should be set in your constants file
const configApi = new Configuration(undefined, BASE_PATH, instance);
export configApi;
const configManagerApi = APIFactory(BASE_PATH, undefined, { CreateProfile });
export configManagerApi;
```

If you want to add some interceptors you can use axios build in interceptors
```JS
// api.js
import axios from 'axios';
import { Configuration } from '@redhat-cloud-services/host-inventory-client';
import { configManagerApi } from '@redhat-cloud-services/config-manager-client';
const instance = axios.create();

// Request interceptor
Expand All @@ -50,8 +49,8 @@ instance.interceptors.response.use(null, (error) => {
});

// BASE_PATH should be set in your constants file
const configApi = new Configuration(undefined, BASE_PATH, instance);
export configApi;
const configManagerApi = APIFactory(BASE_PATH, instance, { CreateProfile });
export configManagerApi;
```

## Building
Expand Down