@webitel/api-services 0.0.29 → 0.0.30
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/Readme.md +100 -6
- package/package.json +2 -1
- package/src/api/clients/caseSources/caseSources.ts +1 -1
- package/src/api/clients/quickReplies/quickReplies.ts +2 -0
- package/src/gen/_docs/html/assets/navigation.js +1 -1
- package/src/gen/_docs/html/assets/search.js +1 -1
- package/src/gen/_docs/html/index.html +1 -1
- package/src/gen/_docs/html/interfaces/_models_webitelCasesCaseQueryTarget.WebitelCasesCaseQueryTarget.html +10 -0
- package/src/gen/_docs/html/modules/_models.html +1 -1
- package/src/gen/_docs/html/modules/_models_webitelCasesCaseQueryTarget.html +1 -0
- package/src/gen/_docs/html/modules/index.html +1 -1
- package/src/gen/_docs/html/modules/sources_sources.zod.gen.html +6 -6
- package/src/gen/_docs/html/types/_models_listSourcesParams.ListSourcesParams.html +11 -7
- package/src/gen/_docs/html/types/_models_publishCommentParams.PublishCommentParams.html +5 -3
- package/src/gen/_docs/html/types/_models_searchCases2Params.SearchCases2Params.html +13 -3
- package/src/gen/_docs/html/types/_models_searchCasesParams.SearchCasesParams.html +13 -3
- package/src/gen/_docs/html/types/_models_updateComment2Params.UpdateComment2Params.html +4 -2
- package/src/gen/_docs/html/types/_models_updateCommentParams.UpdateCommentParams.html +4 -2
- package/src/gen/_docs/html/variables/case-comments_case-comments.zod.gen.publishCommentQueryParams.html +1 -1
- package/src/gen/_docs/html/variables/case-comments_case-comments.zod.gen.updateComment2QueryParams.html +1 -1
- package/src/gen/_docs/html/variables/case-comments_case-comments.zod.gen.updateCommentQueryParams.html +1 -1
- package/src/gen/_docs/html/variables/cases_cases.zod.gen.searchCases2QueryParams.html +1 -1
- package/src/gen/_docs/html/variables/cases_cases.zod.gen.searchCasesQueryParams.html +1 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.createSourceBody.html +1 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.listSourcesQueryPageDefault.html +1 -0
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.listSourcesQueryParams.html +1 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.listSourcesQuerySizeDefault.html +1 -0
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.listSourcesQuerySortDefault.html +1 -0
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.updateSource2Body.html +1 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.updateSourceBody.html +1 -1
- package/src/gen/_models/index.ts +1 -0
- package/src/gen/_models/listSourcesParams.ts +15 -11
- package/src/gen/_models/publishCommentParams.ts +4 -0
- package/src/gen/_models/searchCases2Params.ts +21 -1
- package/src/gen/_models/searchCasesParams.ts +21 -1
- package/src/gen/_models/updateComment2Params.ts +4 -0
- package/src/gen/_models/updateCommentParams.ts +4 -0
- package/src/gen/_models/webitelCasesCaseQueryTarget.ts +20 -0
- package/src/gen/case-comments/case-comments.zod.gen.ts +18 -0
- package/src/gen/cases/cases.zod.gen.ts +36 -2
- package/src/gen/sources/sources.zod.gen.ts +19 -14
- package/types/gen/_models/webitelCasesCaseQueryTarget.d.ts +19 -0
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.createSourceBodyDescriptionDefault.html +0 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.updateSource2BodyDescriptionDefault.html +0 -1
- package/src/gen/_docs/html/variables/sources_sources.zod.gen.updateSourceBodyDescriptionDefault.html +0 -1
package/Readme.md
CHANGED
|
@@ -1,13 +1,107 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@webitel/api-services`
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Contents:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
### Generated API services.
|
|
6
|
+
|
|
7
|
+
_Source: webitel [swagger file](https://swagger.webitel.com/)._
|
|
8
|
+
|
|
9
|
+
### API clients.
|
|
10
|
+
|
|
11
|
+
API clients – self-written api wrappers on top of gen services.
|
|
12
|
+
|
|
13
|
+
### Utils, tools and helpers, related to API communication.
|
|
7
14
|
|
|
8
15
|
## Exports:
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
### `@webitel/api-services/gen`
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// zod, services, msw
|
|
21
|
+
import {
|
|
22
|
+
createSourceBody, // zod
|
|
23
|
+
getSources, // api service
|
|
24
|
+
getListSourcesResponseMock, // mock
|
|
25
|
+
} from '@webitel/api-services/gen';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### `@webitel/api-services/gen/models`
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
// enums, types and interfaces
|
|
33
|
+
} from '@webitel/api-services/gen/models';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `@webitel/api-services/gen/utils`
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import {
|
|
40
|
+
// get list of top-level field keys. useful to sanitize fieldsToSend
|
|
41
|
+
getShallowFieldsToSendFromZodSchema,
|
|
42
|
+
// DONT USE. same, but for nested fields
|
|
43
|
+
getFieldsToSendFromZodSchema,
|
|
44
|
+
// pass zod schema, pass empty object, get object with default values
|
|
45
|
+
getDefaultsFromZodSchema,
|
|
46
|
+
} from '@webitel/api-services/gen/utils';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### `@webitel/api-services/api`
|
|
50
|
+
|
|
51
|
+
See ["contents" section](#api-clients).
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { ContactsAPI } from '@webitel/api-services/api';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### `@webitel/api-services/api/transformers`
|
|
58
|
+
|
|
59
|
+
API transformers, used to transform data before sending it to the server or after receiving it from the server.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { applyTransform } from '@webitel/api-services/api';
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### `@webitel/api-services/api/defaults`
|
|
66
|
+
|
|
67
|
+
API defaults: default axios instance, default getList response, etc
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { getDefaultInstance } from '@webitel/api-services/api/defaults';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
### API Mocks
|
|
76
|
+
|
|
77
|
+
Useful for parallel development, testing, and debugging.
|
|
78
|
+
Calling a mock returns fake generated data, without sending a request to the server.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { getSources } from '@webitel/api-services/gen';
|
|
82
|
+
|
|
83
|
+
const searchSources = getSources().listSources();
|
|
84
|
+
```
|
|
85
|
+
->
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { getListSourcesResponseMock } from '@webitel/api-services/gen';
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## FAQ
|
|
92
|
+
|
|
93
|
+
### Q: How to generate API?
|
|
94
|
+
|
|
95
|
+
A: Run [this](https://github.com/webitel/webitel-ui-sdk/actions/workflows/api-services.publish.yml)
|
|
96
|
+
**manual** workflow.
|
|
97
|
+
|
|
98
|
+
### Q: generating source?
|
|
99
|
+
A: `https://raw.githubusercontent.com/webitel/protos/main/swagger/api.json`
|
|
100
|
+
|
|
101
|
+
### Q: Versioning?
|
|
102
|
+
A: Automated version patching on each action run.
|
|
103
|
+
minor/major version bump is manual, if needed.
|
|
12
104
|
|
|
105
|
+
## Related links:
|
|
13
106
|
|
|
107
|
+
* backend proto annotations [guideline](https://github.com/webitel/protos/blob/docs(proto-annotation-guidelines)/docs/proto_annotation_guidelines.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/api-services",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
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",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"src/*",
|
|
22
22
|
"types/*",
|
|
23
|
+
"Readme.md",
|
|
23
24
|
"CHANGELOG.md"
|
|
24
25
|
],
|
|
25
26
|
"peerDependencies": {
|
|
@@ -75,8 +75,8 @@ const addSource = async ({ itemInstance }) => {
|
|
|
75
75
|
|
|
76
76
|
const updateSource = async ({ itemInstance, itemId: id }) => {
|
|
77
77
|
const item = applyTransform(itemInstance, [
|
|
78
|
-
camelToSnake(),
|
|
79
78
|
sanitize(getShallowFieldsToSendFromZodSchema(updateSourceBody)),
|
|
79
|
+
camelToSnake(),
|
|
80
80
|
]);
|
|
81
81
|
|
|
82
82
|
try {
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
notify,
|
|
9
9
|
sanitize,
|
|
10
10
|
snakeToCamel,
|
|
11
|
+
starToSearch,
|
|
11
12
|
} from '../../transformers';
|
|
12
13
|
|
|
13
14
|
const fieldsToSend = ['name', 'queues', 'article', 'teams', 'text'];
|
|
@@ -19,6 +20,7 @@ const getQuickRepliesList = async (params) => {
|
|
|
19
20
|
merge(getDefaultGetParams()),
|
|
20
21
|
(params) => ({ ...params, q: params.search }),
|
|
21
22
|
sanitize(fieldsToSend),
|
|
23
|
+
starToSearch('q'),
|
|
22
24
|
camelToSnake(),
|
|
23
25
|
]);
|
|
24
26
|
|