@webitel/api-services 0.0.111 → 0.0.112
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/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/api-services",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.112",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"make-all": "npm run gen:api && npm version patch && (npm run build:types || true) && (npm run format:all || true) && npm run publish-lib",
|
|
7
7
|
"gen:api": "npm run gen:api:convert-openapi && npm run gen:api:format-openapi && orval && npm run gen:api:typedoc && npm run gen:api:cleanup",
|
|
8
|
-
"publish-lib": "npm publish --access public",
|
|
8
|
+
"publish-lib": "npm publish --access public --tag latest",
|
|
9
9
|
"gen:api:convert-openapi": "npx api-spec-converter --from=swagger_2 --to=openapi_3 --syntax=yaml https://raw.githubusercontent.com/webitel/protos/main/swagger/api.json > swagger.yaml",
|
|
10
10
|
"gen:api:format-openapi": "npx openapi-format swagger.yaml -o formatted-openapi.yaml",
|
|
11
11
|
"gen:api:typedoc": "npx typedoc",
|
package/src/api/clients/index.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UserSettingsApiFactory } from 'webitel-sdk';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getDefaultInstance,
|
|
5
|
+
getDefaultOpenAPIConfig,
|
|
6
|
+
} from '../../defaults';
|
|
7
|
+
import {
|
|
8
|
+
applyTransform,
|
|
9
|
+
notify,
|
|
10
|
+
} from '../../transformers';
|
|
11
|
+
|
|
12
|
+
const instance = getDefaultInstance();
|
|
13
|
+
const configuration = getDefaultOpenAPIConfig();
|
|
14
|
+
|
|
15
|
+
const service = UserSettingsApiFactory(configuration, '', instance);
|
|
16
|
+
|
|
17
|
+
const getUserSettings = async ({ key }) => {
|
|
18
|
+
try {
|
|
19
|
+
const response = await service.getUserSettings(key);
|
|
20
|
+
return response.data
|
|
21
|
+
} catch (err) {
|
|
22
|
+
throw applyTransform(err, [notify]);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const setUserSettings = async ({ key, value }) => {
|
|
27
|
+
try {
|
|
28
|
+
const response = await service.setUserSettings(key, value);
|
|
29
|
+
return response.data
|
|
30
|
+
} catch (err) {
|
|
31
|
+
throw applyTransform(err, [notify]);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const UserSettingsAPI = {
|
|
36
|
+
get: getUserSettings,
|
|
37
|
+
set: setUserSettings,
|
|
38
|
+
};
|