@outseta/react 0.4.31 → 0.4.32
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/dist/index.js
CHANGED
|
@@ -3029,6 +3029,27 @@ function useCaseGetCase(caseUid, options) {
|
|
|
3029
3029
|
query.queryKey = queryOptions.queryKey;
|
|
3030
3030
|
return query;
|
|
3031
3031
|
}
|
|
3032
|
+
var caseUpdateCase = (caseUid, caseUpdateCaseBody, options) => {
|
|
3033
|
+
return customFetch2({
|
|
3034
|
+
url: `/api/v1/support/cases/${caseUid}`,
|
|
3035
|
+
method: "PUT",
|
|
3036
|
+
headers: { "Content-Type": "application/json" },
|
|
3037
|
+
data: caseUpdateCaseBody
|
|
3038
|
+
}, options);
|
|
3039
|
+
};
|
|
3040
|
+
var getCaseUpdateCaseMutationOptions = (options) => {
|
|
3041
|
+
const mutationKey = ["caseUpdateCase"];
|
|
3042
|
+
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : { ...options, mutation: { ...options.mutation, mutationKey } } : { mutation: { mutationKey }, request: undefined };
|
|
3043
|
+
const mutationFn = (props) => {
|
|
3044
|
+
const { caseUid, data } = props ?? {};
|
|
3045
|
+
return caseUpdateCase(caseUid, data, requestOptions);
|
|
3046
|
+
};
|
|
3047
|
+
return { mutationFn, ...mutationOptions };
|
|
3048
|
+
};
|
|
3049
|
+
var useCaseUpdateCase = (options) => {
|
|
3050
|
+
const mutationOptions = getCaseUpdateCaseMutationOptions(options);
|
|
3051
|
+
return useMutation(mutationOptions);
|
|
3052
|
+
};
|
|
3032
3053
|
var caseAddReply = (caseUid, options, signal) => {
|
|
3033
3054
|
return customFetch2({
|
|
3034
3055
|
url: `/api/v1/support/cases/${caseUid}/replies`,
|
|
@@ -3848,6 +3869,7 @@ export {
|
|
|
3848
3869
|
caseAddReply,
|
|
3849
3870
|
caseGetAllCases,
|
|
3850
3871
|
caseGetCase,
|
|
3872
|
+
caseUpdateCase,
|
|
3851
3873
|
categoryGetAllCategories,
|
|
3852
3874
|
createClient,
|
|
3853
3875
|
dealAddDeal,
|
|
@@ -3919,6 +3941,7 @@ export {
|
|
|
3919
3941
|
getCaseGetAllCasesQueryOptions,
|
|
3920
3942
|
getCaseGetCaseQueryKey,
|
|
3921
3943
|
getCaseGetCaseQueryOptions,
|
|
3944
|
+
getCaseUpdateCaseMutationOptions,
|
|
3922
3945
|
getCategoryGetAllCategoriesQueryKey,
|
|
3923
3946
|
getCategoryGetAllCategoriesQueryOptions,
|
|
3924
3947
|
getDealAddDealMutationOptions,
|
|
@@ -4105,6 +4128,7 @@ export {
|
|
|
4105
4128
|
useCaseAddReply,
|
|
4106
4129
|
useCaseGetAllCases,
|
|
4107
4130
|
useCaseGetCase,
|
|
4131
|
+
useCaseUpdateCase,
|
|
4108
4132
|
useCategoryGetAllCategories,
|
|
4109
4133
|
useDealAddDeal,
|
|
4110
4134
|
useDealDeleteDeal,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outseta/react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.32",
|
|
4
4
|
"description": "React hooks and components for the Outseta API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@outseta/api-client": "0.3.
|
|
21
|
+
"@outseta/api-client": "0.3.38"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import {
|
|
3
|
+
useMutation,
|
|
3
4
|
useQuery
|
|
4
5
|
} from '../../query';
|
|
5
6
|
import type {
|
|
7
|
+
MutationFunction,
|
|
6
8
|
QueryFunction,
|
|
7
9
|
QueryKey,
|
|
10
|
+
UseMutationOptions,
|
|
11
|
+
UseMutationResult,
|
|
8
12
|
UseQueryOptions,
|
|
9
13
|
UseQueryResult
|
|
10
14
|
} from '../../query';
|
|
@@ -12,17 +16,398 @@ import type {
|
|
|
12
16
|
import type {
|
|
13
17
|
Definition,
|
|
14
18
|
DefinitionGetAllDefinitions200,
|
|
15
|
-
DefinitionGetAllDefinitionsParams
|
|
19
|
+
DefinitionGetAllDefinitionsParams,
|
|
20
|
+
Tag,
|
|
21
|
+
TagAddTagBody,
|
|
22
|
+
TagGetAllTags200,
|
|
23
|
+
TagGetAllTagsParams,
|
|
24
|
+
TagUpdateTagBody
|
|
16
25
|
} from '../outsetaAPI.schemas';
|
|
17
26
|
|
|
18
27
|
import { customFetch } from '../../mutator';
|
|
19
28
|
|
|
29
|
+
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
|
|
30
|
+
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <
|
|
31
|
+
T,
|
|
32
|
+
>() => T extends Y ? 1 : 2
|
|
33
|
+
? A
|
|
34
|
+
: B;
|
|
35
|
+
|
|
36
|
+
type WritableKeys<T> = {
|
|
37
|
+
[P in keyof T]-?: IfEquals<
|
|
38
|
+
{ [Q in P]: T[P] },
|
|
39
|
+
{ -readonly [Q in P]: T[P] },
|
|
40
|
+
P
|
|
41
|
+
>;
|
|
42
|
+
}[keyof T];
|
|
43
|
+
|
|
44
|
+
type UnionToIntersection<U> =
|
|
45
|
+
(U extends any ? (k: U)=>void : never) extends ((k: infer I)=>void) ? I : never;
|
|
46
|
+
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;
|
|
47
|
+
|
|
48
|
+
type Writable<T> = Pick<T, WritableKeys<T>>;
|
|
49
|
+
type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
|
|
50
|
+
[P in keyof Writable<T>]: T[P] extends object
|
|
51
|
+
? NonReadonly<NonNullable<T[P]>>
|
|
52
|
+
: T[P];
|
|
53
|
+
} : DistributeReadOnlyOverUnions<T>;
|
|
54
|
+
|
|
55
|
+
|
|
20
56
|
|
|
21
57
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
22
58
|
|
|
23
59
|
|
|
24
60
|
|
|
25
61
|
/**
|
|
62
|
+
* Each tag applies to a single entity type. Pass entityType=Case to retrieve the tags
|
|
63
|
+
that can be put on support tickets.
|
|
64
|
+
|
|
65
|
+
How a tag goes onto a record depends on the entity type. A support ticket holds its
|
|
66
|
+
tags in its own CaseTags collection, so you add and remove ticket tags with
|
|
67
|
+
PUT /support/cases/{caseUid}. Other entity types store their tags differently. This
|
|
68
|
+
documentation covers ticket tags only.
|
|
69
|
+
|
|
70
|
+
Name is unique within an entity type. SystemName and SystemDescription identify a
|
|
71
|
+
built-in tag (for example Priority.Urgent) and are set by Outseta.
|
|
72
|
+
* @summary Retrieve all tags.
|
|
73
|
+
*/
|
|
74
|
+
export const tagGetAllTags = (
|
|
75
|
+
params?: TagGetAllTagsParams,
|
|
76
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
77
|
+
) => {
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
return customFetch<TagGetAllTags200>(
|
|
81
|
+
{url: `/api/v1/attribute/tags`, method: 'GET',
|
|
82
|
+
params, signal
|
|
83
|
+
},
|
|
84
|
+
options);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
export const getTagGetAllTagsQueryKey = (params?: TagGetAllTagsParams,) => {
|
|
91
|
+
return [
|
|
92
|
+
`/api/v1/attribute/tags`, ...(params ? [params]: [])
|
|
93
|
+
] as const;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export const getTagGetAllTagsQueryOptions = <TData = Awaited<ReturnType<typeof tagGetAllTags>>, TError = void>(params?: TagGetAllTagsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof tagGetAllTags>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
98
|
+
) => {
|
|
99
|
+
|
|
100
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
101
|
+
|
|
102
|
+
const queryKey = queryOptions?.queryKey ?? getTagGetAllTagsQueryKey(params);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof tagGetAllTags>>> = ({ signal }) => tagGetAllTags(params, requestOptions, signal);
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof tagGetAllTags>>, TError, TData> & { queryKey: QueryKey }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type TagGetAllTagsQueryResult = NonNullable<Awaited<ReturnType<typeof tagGetAllTags>>>
|
|
116
|
+
export type TagGetAllTagsQueryError = void
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @summary Retrieve all tags.
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
export function useTagGetAllTags<TData = Awaited<ReturnType<typeof tagGetAllTags>>, TError = void>(
|
|
124
|
+
params?: TagGetAllTagsParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof tagGetAllTags>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
125
|
+
|
|
126
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
127
|
+
|
|
128
|
+
const queryOptions = getTagGetAllTagsQueryOptions(params,options)
|
|
129
|
+
|
|
130
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
131
|
+
|
|
132
|
+
query.queryKey = queryOptions.queryKey ;
|
|
133
|
+
|
|
134
|
+
return query;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Name and EntityType are required. Use EntityType 4 (Case) for a tag that goes on
|
|
142
|
+
support tickets. TagColor sets the color the tag shows in.
|
|
143
|
+
|
|
144
|
+
Name must be unique within an entity type. If the name already exists for that
|
|
145
|
+
entity type, the existing tag is returned instead of a duplicate, and its color is
|
|
146
|
+
updated when a different TagColor is supplied. SystemName and SystemDescription are
|
|
147
|
+
set by Outseta and are ignored here.
|
|
148
|
+
* @summary Create a tag.
|
|
149
|
+
*/
|
|
150
|
+
export const tagAddTag = (
|
|
151
|
+
tagAddTagBody: NonReadonly<TagAddTagBody>,
|
|
152
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
153
|
+
) => {
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
return customFetch<Tag>(
|
|
157
|
+
{url: `/api/v1/attribute/tags`, method: 'POST',
|
|
158
|
+
headers: {'Content-Type': 'application/json', },
|
|
159
|
+
data: tagAddTagBody, signal
|
|
160
|
+
},
|
|
161
|
+
options);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export const getTagAddTagMutationOptions = <TError = void,
|
|
167
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagAddTag>>, TError,{data: NonReadonly<TagAddTagBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
168
|
+
): UseMutationOptions<Awaited<ReturnType<typeof tagAddTag>>, TError,{data: NonReadonly<TagAddTagBody>}, TContext> => {
|
|
169
|
+
|
|
170
|
+
const mutationKey = ['tagAddTag'];
|
|
171
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
172
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
173
|
+
options
|
|
174
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
175
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof tagAddTag>>, {data: NonReadonly<TagAddTagBody>}> = (props) => {
|
|
181
|
+
const {data} = props ?? {};
|
|
182
|
+
|
|
183
|
+
return tagAddTag(data,requestOptions)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
return { mutationFn, ...mutationOptions }}
|
|
190
|
+
|
|
191
|
+
export type TagAddTagMutationResult = NonNullable<Awaited<ReturnType<typeof tagAddTag>>>
|
|
192
|
+
export type TagAddTagMutationBody = NonReadonly<TagAddTagBody>
|
|
193
|
+
export type TagAddTagMutationError = void
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @summary Create a tag.
|
|
197
|
+
*/
|
|
198
|
+
export const useTagAddTag = <TError = void,
|
|
199
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagAddTag>>, TError,{data: NonReadonly<TagAddTagBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
200
|
+
): UseMutationResult<
|
|
201
|
+
Awaited<ReturnType<typeof tagAddTag>>,
|
|
202
|
+
TError,
|
|
203
|
+
{data: NonReadonly<TagAddTagBody>},
|
|
204
|
+
TContext
|
|
205
|
+
> => {
|
|
206
|
+
|
|
207
|
+
const mutationOptions = getTagAddTagMutationOptions(options);
|
|
208
|
+
|
|
209
|
+
return useMutation(mutationOptions);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @summary Retrieve a tag.
|
|
213
|
+
*/
|
|
214
|
+
export const tagGetTag = (
|
|
215
|
+
tagUid: string | null,
|
|
216
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
217
|
+
) => {
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return customFetch<Tag>(
|
|
221
|
+
{url: `/api/v1/attribute/tags/${tagUid}`, method: 'GET', signal
|
|
222
|
+
},
|
|
223
|
+
options);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
export const getTagGetTagQueryKey = (tagUid?: string | null,) => {
|
|
230
|
+
return [
|
|
231
|
+
`/api/v1/attribute/tags/${tagUid}`
|
|
232
|
+
] as const;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
export const getTagGetTagQueryOptions = <TData = Awaited<ReturnType<typeof tagGetTag>>, TError = void>(tagUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof tagGetTag>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
237
|
+
) => {
|
|
238
|
+
|
|
239
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
240
|
+
|
|
241
|
+
const queryKey = queryOptions?.queryKey ?? getTagGetTagQueryKey(tagUid);
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof tagGetTag>>> = ({ signal }) => tagGetTag(tagUid, requestOptions, signal);
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
return { queryKey, queryFn, enabled: !!(tagUid), ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof tagGetTag>>, TError, TData> & { queryKey: QueryKey }
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type TagGetTagQueryResult = NonNullable<Awaited<ReturnType<typeof tagGetTag>>>
|
|
255
|
+
export type TagGetTagQueryError = void
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @summary Retrieve a tag.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
export function useTagGetTag<TData = Awaited<ReturnType<typeof tagGetTag>>, TError = void>(
|
|
263
|
+
tagUid: string | null, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof tagGetTag>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
264
|
+
|
|
265
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
266
|
+
|
|
267
|
+
const queryOptions = getTagGetTagQueryOptions(tagUid,options)
|
|
268
|
+
|
|
269
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
270
|
+
|
|
271
|
+
query.queryKey = queryOptions.queryKey ;
|
|
272
|
+
|
|
273
|
+
return query;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Use this to rename a tag or to change its color. EntityType cannot be changed after
|
|
281
|
+
the tag is created. Name must stay unique within the entity type. SystemName and
|
|
282
|
+
SystemDescription are set by Outseta and cannot be changed.
|
|
283
|
+
* @summary Update a tag.
|
|
284
|
+
*/
|
|
285
|
+
export const tagUpdateTag = (
|
|
286
|
+
tagUid: string | null,
|
|
287
|
+
tagUpdateTagBody: NonReadonly<TagUpdateTagBody>,
|
|
288
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
return customFetch<Tag>(
|
|
292
|
+
{url: `/api/v1/attribute/tags/${tagUid}`, method: 'PUT',
|
|
293
|
+
headers: {'Content-Type': 'application/json', },
|
|
294
|
+
data: tagUpdateTagBody
|
|
295
|
+
},
|
|
296
|
+
options);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
export const getTagUpdateTagMutationOptions = <TError = void,
|
|
302
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagUpdateTag>>, TError,{tagUid: string | null;data: NonReadonly<TagUpdateTagBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
303
|
+
): UseMutationOptions<Awaited<ReturnType<typeof tagUpdateTag>>, TError,{tagUid: string | null;data: NonReadonly<TagUpdateTagBody>}, TContext> => {
|
|
304
|
+
|
|
305
|
+
const mutationKey = ['tagUpdateTag'];
|
|
306
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
307
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
308
|
+
options
|
|
309
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
310
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof tagUpdateTag>>, {tagUid: string | null;data: NonReadonly<TagUpdateTagBody>}> = (props) => {
|
|
316
|
+
const {tagUid,data} = props ?? {};
|
|
317
|
+
|
|
318
|
+
return tagUpdateTag(tagUid,data,requestOptions)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
return { mutationFn, ...mutationOptions }}
|
|
325
|
+
|
|
326
|
+
export type TagUpdateTagMutationResult = NonNullable<Awaited<ReturnType<typeof tagUpdateTag>>>
|
|
327
|
+
export type TagUpdateTagMutationBody = NonReadonly<TagUpdateTagBody>
|
|
328
|
+
export type TagUpdateTagMutationError = void
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @summary Update a tag.
|
|
332
|
+
*/
|
|
333
|
+
export const useTagUpdateTag = <TError = void,
|
|
334
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagUpdateTag>>, TError,{tagUid: string | null;data: NonReadonly<TagUpdateTagBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
335
|
+
): UseMutationResult<
|
|
336
|
+
Awaited<ReturnType<typeof tagUpdateTag>>,
|
|
337
|
+
TError,
|
|
338
|
+
{tagUid: string | null;data: NonReadonly<TagUpdateTagBody>},
|
|
339
|
+
TContext
|
|
340
|
+
> => {
|
|
341
|
+
|
|
342
|
+
const mutationOptions = getTagUpdateTagMutationOptions(options);
|
|
343
|
+
|
|
344
|
+
return useMutation(mutationOptions);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The tag is also taken off every record that carries it. For a Case tag, it is
|
|
348
|
+
removed from all support tickets that have it.
|
|
349
|
+
* @summary Delete a tag.
|
|
350
|
+
*/
|
|
351
|
+
export const tagDeleteTag = (
|
|
352
|
+
tagUid: string | null,
|
|
353
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
return customFetch<Blob>(
|
|
357
|
+
{url: `/api/v1/attribute/tags/${tagUid}`, method: 'DELETE',
|
|
358
|
+
responseType: 'blob'
|
|
359
|
+
},
|
|
360
|
+
options);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
export const getTagDeleteTagMutationOptions = <TError = void,
|
|
366
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagDeleteTag>>, TError,{tagUid: string | null}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
367
|
+
): UseMutationOptions<Awaited<ReturnType<typeof tagDeleteTag>>, TError,{tagUid: string | null}, TContext> => {
|
|
368
|
+
|
|
369
|
+
const mutationKey = ['tagDeleteTag'];
|
|
370
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
371
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
372
|
+
options
|
|
373
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
374
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof tagDeleteTag>>, {tagUid: string | null}> = (props) => {
|
|
380
|
+
const {tagUid} = props ?? {};
|
|
381
|
+
|
|
382
|
+
return tagDeleteTag(tagUid,requestOptions)
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
return { mutationFn, ...mutationOptions }}
|
|
389
|
+
|
|
390
|
+
export type TagDeleteTagMutationResult = NonNullable<Awaited<ReturnType<typeof tagDeleteTag>>>
|
|
391
|
+
|
|
392
|
+
export type TagDeleteTagMutationError = void
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @summary Delete a tag.
|
|
396
|
+
*/
|
|
397
|
+
export const useTagDeleteTag = <TError = void,
|
|
398
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagDeleteTag>>, TError,{tagUid: string | null}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
399
|
+
): UseMutationResult<
|
|
400
|
+
Awaited<ReturnType<typeof tagDeleteTag>>,
|
|
401
|
+
TError,
|
|
402
|
+
{tagUid: string | null},
|
|
403
|
+
TContext
|
|
404
|
+
> => {
|
|
405
|
+
|
|
406
|
+
const mutationOptions = getTagDeleteTagMutationOptions(options);
|
|
407
|
+
|
|
408
|
+
return useMutation(mutationOptions);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
26
411
|
* entityType is the name of an EntityType enum value, for example: Account, Person,
|
|
27
412
|
Deal. Definitions describe the labels, system names, and control types of
|
|
28
413
|
the custom attributes that have been added to that entity.
|
|
@@ -3173,19 +3173,12 @@ export const SupportCaseHistoryType = {
|
|
|
3173
3173
|
ContactChange: 8,
|
|
3174
3174
|
} as const;
|
|
3175
3175
|
|
|
3176
|
-
/**
|
|
3177
|
-
* @nullable
|
|
3178
|
-
*/
|
|
3179
|
-
export type CaseTagAllOfCase = Case | null;
|
|
3180
|
-
|
|
3181
3176
|
/**
|
|
3182
3177
|
* @nullable
|
|
3183
3178
|
*/
|
|
3184
3179
|
export type CaseTagAllOfTag = Tag | null;
|
|
3185
3180
|
|
|
3186
3181
|
export type CaseTagAllOf = {
|
|
3187
|
-
/** @nullable */
|
|
3188
|
-
Case?: CaseTagAllOfCase;
|
|
3189
3182
|
/** @nullable */
|
|
3190
3183
|
Tag?: CaseTagAllOfTag;
|
|
3191
3184
|
};
|
|
@@ -9206,6 +9199,37 @@ export type LimitParameter = number;
|
|
|
9206
9199
|
*/
|
|
9207
9200
|
export type OffsetParameter = number;
|
|
9208
9201
|
|
|
9202
|
+
export type TagGetAllTagsParams = {
|
|
9203
|
+
/**
|
|
9204
|
+
* The entity type whose tags to retrieve, as the name or the numeric value (for example Case or 4)
|
|
9205
|
+
* @nullable
|
|
9206
|
+
*/
|
|
9207
|
+
entityType?: string | null;
|
|
9208
|
+
/**
|
|
9209
|
+
* Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
|
|
9210
|
+
*/
|
|
9211
|
+
limit?: LimitParameter;
|
|
9212
|
+
/**
|
|
9213
|
+
* Zero-based page number, not a record offset. With limit=50, the second page is offset=1; offset=50 is page index 50 (records 2501-2550).
|
|
9214
|
+
*/
|
|
9215
|
+
offset?: OffsetParameter;
|
|
9216
|
+
};
|
|
9217
|
+
|
|
9218
|
+
export type TagGetAllTags200 = {
|
|
9219
|
+
metadata?: CollectionMetadata;
|
|
9220
|
+
items?: Tag[];
|
|
9221
|
+
};
|
|
9222
|
+
|
|
9223
|
+
/**
|
|
9224
|
+
* @nullable
|
|
9225
|
+
*/
|
|
9226
|
+
export type TagAddTagBody = Tag | null;
|
|
9227
|
+
|
|
9228
|
+
/**
|
|
9229
|
+
* @nullable
|
|
9230
|
+
*/
|
|
9231
|
+
export type TagUpdateTagBody = Tag | null;
|
|
9232
|
+
|
|
9209
9233
|
export type DefinitionGetAllDefinitionsParams = {
|
|
9210
9234
|
/**
|
|
9211
9235
|
* Requested page size. The server caps it at 100, or 25 when requested fields expand child objects or require additional queries; metadata.limit reports the applied value. Use offset=1 for the second page.
|
|
@@ -9329,6 +9353,11 @@ sendautoresponder?: string | null;
|
|
|
9329
9353
|
*/
|
|
9330
9354
|
export type CaseAddCaseBody = Case | null;
|
|
9331
9355
|
|
|
9356
|
+
/**
|
|
9357
|
+
* @nullable
|
|
9358
|
+
*/
|
|
9359
|
+
export type CaseUpdateCaseBody = Case | null;
|
|
9360
|
+
|
|
9332
9361
|
export type ArticleGetAllArticlesParams = {
|
|
9333
9362
|
/**
|
|
9334
9363
|
* Matches on title or body of the article
|
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
CaseGetAllCases200,
|
|
25
25
|
CaseGetAllCasesParams,
|
|
26
26
|
CaseHistory,
|
|
27
|
+
CaseUpdateCaseBody,
|
|
27
28
|
CategoryGetAllCategories200,
|
|
28
29
|
CategoryGetAllCategoriesParams
|
|
29
30
|
} from '../outsetaAPI.schemas';
|
|
@@ -269,6 +270,88 @@ export function useCaseGetCase<TData = Awaited<ReturnType<typeof caseGetCase>>,
|
|
|
269
270
|
|
|
270
271
|
|
|
271
272
|
/**
|
|
273
|
+
* The Uid in the URL identifies the ticket, and a Uid in the request body is ignored.
|
|
274
|
+
Any property that the body does not contain keeps its current value, so a request
|
|
275
|
+
can send only the properties that change.
|
|
276
|
+
|
|
277
|
+
Tags are managed through the CaseTags collection. Send the full set of tags that
|
|
278
|
+
the ticket must end with:
|
|
279
|
+
|
|
280
|
+
- To keep a tag, include its entry with the CaseTag Uid that GET returned.
|
|
281
|
+
- To add a tag, include an entry that has no Uid and a Tag that holds the tag's Uid.
|
|
282
|
+
- To remove a tag, leave its entry out.
|
|
283
|
+
- To remove all tags, send an empty array.
|
|
284
|
+
|
|
285
|
+
If the body does not contain CaseTags, the current tags stay as they are. To read
|
|
286
|
+
the current tags, request them with the fields parameter, for example
|
|
287
|
+
fields=Uid,CaseTags.Uid,CaseTags.Tag.Uid,CaseTags.Tag.Name. To get the tags that are
|
|
288
|
+
available for tickets, use GET /attribute/tags?entityType=Case.
|
|
289
|
+
|
|
290
|
+
Case history is kept. Add replies and notes with their own endpoints.
|
|
291
|
+
* @summary Update a support ticket.
|
|
292
|
+
*/
|
|
293
|
+
export const caseUpdateCase = (
|
|
294
|
+
caseUid: string | null,
|
|
295
|
+
caseUpdateCaseBody: NonReadonly<CaseUpdateCaseBody>,
|
|
296
|
+
options?: SecondParameter<typeof customFetch>,) => {
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
return customFetch<Case>(
|
|
300
|
+
{url: `/api/v1/support/cases/${caseUid}`, method: 'PUT',
|
|
301
|
+
headers: {'Content-Type': 'application/json', },
|
|
302
|
+
data: caseUpdateCaseBody
|
|
303
|
+
},
|
|
304
|
+
options);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
export const getCaseUpdateCaseMutationOptions = <TError = void,
|
|
310
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof caseUpdateCase>>, TError,{caseUid: string | null;data: NonReadonly<CaseUpdateCaseBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
311
|
+
): UseMutationOptions<Awaited<ReturnType<typeof caseUpdateCase>>, TError,{caseUid: string | null;data: NonReadonly<CaseUpdateCaseBody>}, TContext> => {
|
|
312
|
+
|
|
313
|
+
const mutationKey = ['caseUpdateCase'];
|
|
314
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
315
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
316
|
+
options
|
|
317
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
318
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof caseUpdateCase>>, {caseUid: string | null;data: NonReadonly<CaseUpdateCaseBody>}> = (props) => {
|
|
324
|
+
const {caseUid,data} = props ?? {};
|
|
325
|
+
|
|
326
|
+
return caseUpdateCase(caseUid,data,requestOptions)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
return { mutationFn, ...mutationOptions }}
|
|
333
|
+
|
|
334
|
+
export type CaseUpdateCaseMutationResult = NonNullable<Awaited<ReturnType<typeof caseUpdateCase>>>
|
|
335
|
+
export type CaseUpdateCaseMutationBody = NonReadonly<CaseUpdateCaseBody>
|
|
336
|
+
export type CaseUpdateCaseMutationError = void
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* @summary Update a support ticket.
|
|
340
|
+
*/
|
|
341
|
+
export const useCaseUpdateCase = <TError = void,
|
|
342
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof caseUpdateCase>>, TError,{caseUid: string | null;data: NonReadonly<CaseUpdateCaseBody>}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
343
|
+
): UseMutationResult<
|
|
344
|
+
Awaited<ReturnType<typeof caseUpdateCase>>,
|
|
345
|
+
TError,
|
|
346
|
+
{caseUid: string | null;data: NonReadonly<CaseUpdateCaseBody>},
|
|
347
|
+
TContext
|
|
348
|
+
> => {
|
|
349
|
+
|
|
350
|
+
const mutationOptions = getCaseUpdateCaseMutationOptions(options);
|
|
351
|
+
|
|
352
|
+
return useMutation(mutationOptions);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
272
355
|
* @summary Adds a reply from an agent to a support case.
|
|
273
356
|
*/
|
|
274
357
|
export const caseAddReply = (
|