@outseta/react 0.2.0 → 0.2.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/package.json +2 -2
- package/src/generated/activity/activity.ts +175 -0
- package/src/generated/billing/billing.ts +1113 -0
- package/src/generated/crm/crm.ts +1529 -284
- package/src/generated/email/email.ts +772 -0
- package/src/generated/outsetaAPI.schemas.ts +1372 -322
- package/src/generated/support/support.ts +478 -221
- package/src/mutator.ts +32 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outseta/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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
|
"scripts": {
|
|
21
|
-
"build": "bun build src/index.ts --outdir dist --target browser --format esm --packages external",
|
|
21
|
+
"build": "rimraf dist && bun build src/index.ts --outdir dist --target browser --format esm --packages external",
|
|
22
22
|
"typecheck": "tsc --noEmit",
|
|
23
23
|
"lint": "eslint src --ignore-pattern generated"
|
|
24
24
|
},
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import {
|
|
3
|
+
useMutation,
|
|
4
|
+
useQuery
|
|
5
|
+
} from '@tanstack/react-query';
|
|
6
|
+
import type {
|
|
7
|
+
MutationFunction,
|
|
8
|
+
QueryFunction,
|
|
9
|
+
QueryKey,
|
|
10
|
+
UseMutationOptions,
|
|
11
|
+
UseMutationResult,
|
|
12
|
+
UseQueryOptions,
|
|
13
|
+
UseQueryResult
|
|
14
|
+
} from '@tanstack/react-query';
|
|
15
|
+
|
|
16
|
+
import type {
|
|
17
|
+
Activity,
|
|
18
|
+
ActivityAddCustomActivityBody,
|
|
19
|
+
ActivityGetAllParams
|
|
20
|
+
} from '../outsetaAPI.schemas';
|
|
21
|
+
|
|
22
|
+
import { customFetch } from '../../mutator';
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @summary Retrieves all the activities. One or multiple parameters can be defined to filter the results.
|
|
31
|
+
ActivityType=[100,101] where ActivityUpdated = 100 and AcccountUpdated = 101
|
|
32
|
+
Results will be limited to the last year unless ActivityDateTime is specified,
|
|
33
|
+
possibly with ActivityDateTime__gt/ActivityDateTime__gte and ActivityDateTime__lt/ActivityDateTime__lte
|
|
34
|
+
*/
|
|
35
|
+
export const activityGetAll = (
|
|
36
|
+
params?: ActivityGetAllParams,
|
|
37
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
38
|
+
) => {
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
return customFetch<Activity[]>(
|
|
42
|
+
{url: `/api/v1/activities`, method: 'GET',
|
|
43
|
+
params, signal
|
|
44
|
+
},
|
|
45
|
+
options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export const getActivityGetAllQueryKey = (params?: ActivityGetAllParams,) => {
|
|
52
|
+
return [
|
|
53
|
+
`/api/v1/activities`, ...(params ? [params]: [])
|
|
54
|
+
] as const;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export const getActivityGetAllQueryOptions = <TData = Awaited<ReturnType<typeof activityGetAll>>, TError = void>(params?: ActivityGetAllParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof activityGetAll>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
59
|
+
) => {
|
|
60
|
+
|
|
61
|
+
const {query: queryOptions, request: requestOptions} = options ?? {};
|
|
62
|
+
|
|
63
|
+
const queryKey = queryOptions?.queryKey ?? getActivityGetAllQueryKey(params);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof activityGetAll>>> = ({ signal }) => activityGetAll(params, requestOptions, signal);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof activityGetAll>>, TError, TData> & { queryKey: QueryKey }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type ActivityGetAllQueryResult = NonNullable<Awaited<ReturnType<typeof activityGetAll>>>
|
|
77
|
+
export type ActivityGetAllQueryError = void
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @summary Retrieves all the activities. One or multiple parameters can be defined to filter the results.
|
|
82
|
+
ActivityType=[100,101] where ActivityUpdated = 100 and AcccountUpdated = 101
|
|
83
|
+
Results will be limited to the last year unless ActivityDateTime is specified,
|
|
84
|
+
possibly with ActivityDateTime__gt/ActivityDateTime__gte and ActivityDateTime__lt/ActivityDateTime__lte
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
export function useActivityGetAll<TData = Awaited<ReturnType<typeof activityGetAll>>, TError = void>(
|
|
88
|
+
params?: ActivityGetAllParams, options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof activityGetAll>>, TError, TData>, request?: SecondParameter<typeof customFetch>}
|
|
89
|
+
|
|
90
|
+
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
|
91
|
+
|
|
92
|
+
const queryOptions = getActivityGetAllQueryOptions(params,options)
|
|
93
|
+
|
|
94
|
+
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };
|
|
95
|
+
|
|
96
|
+
query.queryKey = queryOptions.queryKey ;
|
|
97
|
+
|
|
98
|
+
return query;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @summary Record custom events associated to an account, person or deal. These activities show up
|
|
106
|
+
on the activity feed of the corresponding entity and can be leveraged to trigger drip
|
|
107
|
+
campaigns and other automation. For integration with drip campaigns make sure that what
|
|
108
|
+
you pass in the Title property matches the start / stop value specified for the campaign.
|
|
109
|
+
*/
|
|
110
|
+
export const activityAddCustomActivity = (
|
|
111
|
+
activityAddCustomActivityBody: ActivityAddCustomActivityBody,
|
|
112
|
+
options?: SecondParameter<typeof customFetch>,signal?: AbortSignal
|
|
113
|
+
) => {
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
return customFetch<Blob>(
|
|
117
|
+
{url: `/api/v1/activities/customactivity`, method: 'POST',
|
|
118
|
+
headers: {'Content-Type': 'application/json', },
|
|
119
|
+
data: activityAddCustomActivityBody,
|
|
120
|
+
responseType: 'blob', signal
|
|
121
|
+
},
|
|
122
|
+
options);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
export const getActivityAddCustomActivityMutationOptions = <TError = void,
|
|
128
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof activityAddCustomActivity>>, TError,{data: ActivityAddCustomActivityBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
129
|
+
): UseMutationOptions<Awaited<ReturnType<typeof activityAddCustomActivity>>, TError,{data: ActivityAddCustomActivityBody}, TContext> => {
|
|
130
|
+
|
|
131
|
+
const mutationKey = ['activityAddCustomActivity'];
|
|
132
|
+
const {mutation: mutationOptions, request: requestOptions} = options ?
|
|
133
|
+
options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
|
|
134
|
+
options
|
|
135
|
+
: {...options, mutation: {...options.mutation, mutationKey}}
|
|
136
|
+
: {mutation: { mutationKey, }, request: undefined};
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
const mutationFn: MutationFunction<Awaited<ReturnType<typeof activityAddCustomActivity>>, {data: ActivityAddCustomActivityBody}> = (props) => {
|
|
142
|
+
const {data} = props ?? {};
|
|
143
|
+
|
|
144
|
+
return activityAddCustomActivity(data,requestOptions)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
return { mutationFn, ...mutationOptions }}
|
|
151
|
+
|
|
152
|
+
export type ActivityAddCustomActivityMutationResult = NonNullable<Awaited<ReturnType<typeof activityAddCustomActivity>>>
|
|
153
|
+
export type ActivityAddCustomActivityMutationBody = ActivityAddCustomActivityBody
|
|
154
|
+
export type ActivityAddCustomActivityMutationError = void
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @summary Record custom events associated to an account, person or deal. These activities show up
|
|
158
|
+
on the activity feed of the corresponding entity and can be leveraged to trigger drip
|
|
159
|
+
campaigns and other automation. For integration with drip campaigns make sure that what
|
|
160
|
+
you pass in the Title property matches the start / stop value specified for the campaign.
|
|
161
|
+
*/
|
|
162
|
+
export const useActivityAddCustomActivity = <TError = void,
|
|
163
|
+
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof activityAddCustomActivity>>, TError,{data: ActivityAddCustomActivityBody}, TContext>, request?: SecondParameter<typeof customFetch>}
|
|
164
|
+
): UseMutationResult<
|
|
165
|
+
Awaited<ReturnType<typeof activityAddCustomActivity>>,
|
|
166
|
+
TError,
|
|
167
|
+
{data: ActivityAddCustomActivityBody},
|
|
168
|
+
TContext
|
|
169
|
+
> => {
|
|
170
|
+
|
|
171
|
+
const mutationOptions = getActivityAddCustomActivityMutationOptions(options);
|
|
172
|
+
|
|
173
|
+
return useMutation(mutationOptions);
|
|
174
|
+
}
|
|
175
|
+
|