@pantry-pilot/pantry-pilot-api 1.0.1

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 ADDED
@@ -0,0 +1,661 @@
1
+ /**
2
+ * Generated by orval v7.13.2 🍺
3
+ * Do not edit manually.
4
+ * Recipe Management API
5
+ * OpenAPI spec version: 1.0.1
6
+ */
7
+ import { useMutation, useQuery } from '@tanstack/react-query';
8
+ import axios from 'axios';
9
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
10
+ export const CuisineTypeEnum = {
11
+ italian: 'italian',
12
+ chinese: 'chinese',
13
+ mexican: 'mexican',
14
+ indian: 'indian',
15
+ french: 'french',
16
+ japanese: 'japanese',
17
+ thai: 'thai',
18
+ mediterranean: 'mediterranean',
19
+ american: 'american',
20
+ other: 'other',
21
+ };
22
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
23
+ export const ItemTypeEnum = {
24
+ spices: 'spices',
25
+ dairy: 'dairy',
26
+ meat: 'meat',
27
+ vegetables: 'vegetables',
28
+ fruits: 'fruits',
29
+ grains: 'grains',
30
+ condiments: 'condiments',
31
+ beverages: 'beverages',
32
+ other: 'other',
33
+ };
34
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
35
+ export const LocationEnum = {
36
+ fridge: 'fridge',
37
+ freezer: 'freezer',
38
+ cabinet: 'cabinet',
39
+ counter: 'counter',
40
+ pantry: 'pantry',
41
+ other: 'other',
42
+ };
43
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
44
+ export const OrderByEnum = {
45
+ name: 'name',
46
+ created_at: 'created_at',
47
+ expiration_date: 'expiration_date',
48
+ };
49
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
50
+ export const OrderEnum = {
51
+ asc: 'asc',
52
+ desc: 'desc',
53
+ };
54
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
55
+ export const QuantityUnitEnum = {
56
+ lbs: 'lbs',
57
+ pieces: 'pieces',
58
+ tablespoon: 'tablespoon',
59
+ teaspoon: 'teaspoon',
60
+ cups: 'cups',
61
+ oz: 'oz',
62
+ grams: 'grams',
63
+ ml: 'ml',
64
+ liters: 'liters',
65
+ };
66
+ /**
67
+ * @summary Signup
68
+ */
69
+ export const signupAuthSignupPost = (userCreate, options) => {
70
+ return axios.post(`/auth/signup`, userCreate, options);
71
+ };
72
+ export const getSignupAuthSignupPostMutationOptions = (options) => {
73
+ const mutationKey = ['signupAuthSignupPost'];
74
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
75
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
76
+ options
77
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
78
+ : { mutation: { mutationKey, }, axios: undefined };
79
+ const mutationFn = (props) => {
80
+ const { data } = props ?? {};
81
+ return signupAuthSignupPost(data, axiosOptions);
82
+ };
83
+ return { mutationFn, ...mutationOptions };
84
+ };
85
+ /**
86
+ * @summary Signup
87
+ */
88
+ export const useSignupAuthSignupPost = (options) => {
89
+ const mutationOptions = getSignupAuthSignupPostMutationOptions(options);
90
+ return useMutation(mutationOptions);
91
+ };
92
+ /**
93
+ * @summary Login
94
+ */
95
+ export const loginAuthLoginPost = (userLogin, options) => {
96
+ return axios.post(`/auth/login`, userLogin, options);
97
+ };
98
+ export const getLoginAuthLoginPostMutationOptions = (options) => {
99
+ const mutationKey = ['loginAuthLoginPost'];
100
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
101
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
102
+ options
103
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
104
+ : { mutation: { mutationKey, }, axios: undefined };
105
+ const mutationFn = (props) => {
106
+ const { data } = props ?? {};
107
+ return loginAuthLoginPost(data, axiosOptions);
108
+ };
109
+ return { mutationFn, ...mutationOptions };
110
+ };
111
+ /**
112
+ * @summary Login
113
+ */
114
+ export const useLoginAuthLoginPost = (options) => {
115
+ const mutationOptions = getLoginAuthLoginPostMutationOptions(options);
116
+ return useMutation(mutationOptions);
117
+ };
118
+ /**
119
+ * @summary Get Current User Info
120
+ */
121
+ export const getCurrentUserInfoAuthMeGet = (options) => {
122
+ return axios.get(`/auth/me`, options);
123
+ };
124
+ export const getGetCurrentUserInfoAuthMeGetQueryKey = () => {
125
+ return [
126
+ `/auth/me`
127
+ ];
128
+ };
129
+ export const getGetCurrentUserInfoAuthMeGetQueryOptions = (options) => {
130
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
131
+ const queryKey = queryOptions?.queryKey ?? getGetCurrentUserInfoAuthMeGetQueryKey();
132
+ const queryFn = ({ signal }) => getCurrentUserInfoAuthMeGet({ signal, ...axiosOptions });
133
+ return { queryKey, queryFn, ...queryOptions };
134
+ };
135
+ /**
136
+ * @summary Get Current User Info
137
+ */
138
+ export function useGetCurrentUserInfoAuthMeGet(options) {
139
+ const queryOptions = getGetCurrentUserInfoAuthMeGetQueryOptions(options);
140
+ const query = useQuery(queryOptions);
141
+ query.queryKey = queryOptions.queryKey;
142
+ return query;
143
+ }
144
+ /**
145
+ * @summary Update Profile
146
+ */
147
+ export const updateProfileAuthMePatch = (userUpdate, options) => {
148
+ return axios.patch(`/auth/me`, userUpdate, options);
149
+ };
150
+ export const getUpdateProfileAuthMePatchMutationOptions = (options) => {
151
+ const mutationKey = ['updateProfileAuthMePatch'];
152
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
153
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
154
+ options
155
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
156
+ : { mutation: { mutationKey, }, axios: undefined };
157
+ const mutationFn = (props) => {
158
+ const { data } = props ?? {};
159
+ return updateProfileAuthMePatch(data, axiosOptions);
160
+ };
161
+ return { mutationFn, ...mutationOptions };
162
+ };
163
+ /**
164
+ * @summary Update Profile
165
+ */
166
+ export const useUpdateProfileAuthMePatch = (options) => {
167
+ const mutationOptions = getUpdateProfileAuthMePatchMutationOptions(options);
168
+ return useMutation(mutationOptions);
169
+ };
170
+ /**
171
+ * @summary Change Password
172
+ */
173
+ export const changePasswordAuthChangePasswordPost = (passwordChange, options) => {
174
+ return axios.post(`/auth/change-password`, passwordChange, options);
175
+ };
176
+ export const getChangePasswordAuthChangePasswordPostMutationOptions = (options) => {
177
+ const mutationKey = ['changePasswordAuthChangePasswordPost'];
178
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
179
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
180
+ options
181
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
182
+ : { mutation: { mutationKey, }, axios: undefined };
183
+ const mutationFn = (props) => {
184
+ const { data } = props ?? {};
185
+ return changePasswordAuthChangePasswordPost(data, axiosOptions);
186
+ };
187
+ return { mutationFn, ...mutationOptions };
188
+ };
189
+ /**
190
+ * @summary Change Password
191
+ */
192
+ export const useChangePasswordAuthChangePasswordPost = (options) => {
193
+ const mutationOptions = getChangePasswordAuthChangePasswordPostMutationOptions(options);
194
+ return useMutation(mutationOptions);
195
+ };
196
+ /**
197
+ * @summary Get Pantry Image
198
+ */
199
+ export const getPantryImagePantryItemsPantryImageFilenameGet = (filename, options) => {
200
+ return axios.get(`/pantry-items/pantry-image/${filename}`, options);
201
+ };
202
+ export const getGetPantryImagePantryItemsPantryImageFilenameGetQueryKey = (filename) => {
203
+ return [
204
+ `/pantry-items/pantry-image/${filename}`
205
+ ];
206
+ };
207
+ export const getGetPantryImagePantryItemsPantryImageFilenameGetQueryOptions = (filename, options) => {
208
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
209
+ const queryKey = queryOptions?.queryKey ?? getGetPantryImagePantryItemsPantryImageFilenameGetQueryKey(filename);
210
+ const queryFn = ({ signal }) => getPantryImagePantryItemsPantryImageFilenameGet(filename, { signal, ...axiosOptions });
211
+ return { queryKey, queryFn, enabled: !!(filename), ...queryOptions };
212
+ };
213
+ /**
214
+ * @summary Get Pantry Image
215
+ */
216
+ export function useGetPantryImagePantryItemsPantryImageFilenameGet(filename, options) {
217
+ const queryOptions = getGetPantryImagePantryItemsPantryImageFilenameGetQueryOptions(filename, options);
218
+ const query = useQuery(queryOptions);
219
+ query.queryKey = queryOptions.queryKey;
220
+ return query;
221
+ }
222
+ /**
223
+ * @summary Create Pantry Item
224
+ */
225
+ export const createPantryItemPantryItemsPost = (bodyCreatePantryItemPantryItemsPost, options) => {
226
+ const formData = new FormData();
227
+ formData.append(`name`, bodyCreatePantryItemPantryItemsPost.name);
228
+ formData.append(`item_type`, bodyCreatePantryItemPantryItemsPost.item_type);
229
+ formData.append(`quantity`, bodyCreatePantryItemPantryItemsPost.quantity.toString());
230
+ formData.append(`quantity_unit`, bodyCreatePantryItemPantryItemsPost.quantity_unit);
231
+ if (bodyCreatePantryItemPantryItemsPost.expiration_date !== undefined && bodyCreatePantryItemPantryItemsPost.expiration_date !== null) {
232
+ formData.append(`expiration_date`, bodyCreatePantryItemPantryItemsPost.expiration_date);
233
+ }
234
+ if (bodyCreatePantryItemPantryItemsPost.location !== undefined && bodyCreatePantryItemPantryItemsPost.location !== null) {
235
+ formData.append(`location`, bodyCreatePantryItemPantryItemsPost.location);
236
+ }
237
+ if (bodyCreatePantryItemPantryItemsPost.notes !== undefined && bodyCreatePantryItemPantryItemsPost.notes !== null) {
238
+ formData.append(`notes`, bodyCreatePantryItemPantryItemsPost.notes);
239
+ }
240
+ if (bodyCreatePantryItemPantryItemsPost.image !== undefined && bodyCreatePantryItemPantryItemsPost.image !== null) {
241
+ formData.append(`image`, bodyCreatePantryItemPantryItemsPost.image);
242
+ }
243
+ return axios.post(`/pantry-items/`, formData, options);
244
+ };
245
+ export const getCreatePantryItemPantryItemsPostMutationOptions = (options) => {
246
+ const mutationKey = ['createPantryItemPantryItemsPost'];
247
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
248
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
249
+ options
250
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
251
+ : { mutation: { mutationKey, }, axios: undefined };
252
+ const mutationFn = (props) => {
253
+ const { data } = props ?? {};
254
+ return createPantryItemPantryItemsPost(data, axiosOptions);
255
+ };
256
+ return { mutationFn, ...mutationOptions };
257
+ };
258
+ /**
259
+ * @summary Create Pantry Item
260
+ */
261
+ export const useCreatePantryItemPantryItemsPost = (options) => {
262
+ const mutationOptions = getCreatePantryItemPantryItemsPostMutationOptions(options);
263
+ return useMutation(mutationOptions);
264
+ };
265
+ /**
266
+ * @summary Get Pantry Items
267
+ */
268
+ export const getPantryItemsPantryItemsGet = (params, options) => {
269
+ return axios.get(`/pantry-items/`, {
270
+ ...options,
271
+ params: { ...params, ...options?.params },
272
+ });
273
+ };
274
+ export const getGetPantryItemsPantryItemsGetQueryKey = (params) => {
275
+ return [
276
+ `/pantry-items/`, ...(params ? [params] : [])
277
+ ];
278
+ };
279
+ export const getGetPantryItemsPantryItemsGetQueryOptions = (params, options) => {
280
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
281
+ const queryKey = queryOptions?.queryKey ?? getGetPantryItemsPantryItemsGetQueryKey(params);
282
+ const queryFn = ({ signal }) => getPantryItemsPantryItemsGet(params, { signal, ...axiosOptions });
283
+ return { queryKey, queryFn, ...queryOptions };
284
+ };
285
+ /**
286
+ * @summary Get Pantry Items
287
+ */
288
+ export function useGetPantryItemsPantryItemsGet(params, options) {
289
+ const queryOptions = getGetPantryItemsPantryItemsGetQueryOptions(params, options);
290
+ const query = useQuery(queryOptions);
291
+ query.queryKey = queryOptions.queryKey;
292
+ return query;
293
+ }
294
+ /**
295
+ * @summary Get Pantry Item
296
+ */
297
+ export const getPantryItemPantryItemsItemIdGet = (itemId, options) => {
298
+ return axios.get(`/pantry-items/${itemId}`, options);
299
+ };
300
+ export const getGetPantryItemPantryItemsItemIdGetQueryKey = (itemId) => {
301
+ return [
302
+ `/pantry-items/${itemId}`
303
+ ];
304
+ };
305
+ export const getGetPantryItemPantryItemsItemIdGetQueryOptions = (itemId, options) => {
306
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
307
+ const queryKey = queryOptions?.queryKey ?? getGetPantryItemPantryItemsItemIdGetQueryKey(itemId);
308
+ const queryFn = ({ signal }) => getPantryItemPantryItemsItemIdGet(itemId, { signal, ...axiosOptions });
309
+ return { queryKey, queryFn, enabled: !!(itemId), ...queryOptions };
310
+ };
311
+ /**
312
+ * @summary Get Pantry Item
313
+ */
314
+ export function useGetPantryItemPantryItemsItemIdGet(itemId, options) {
315
+ const queryOptions = getGetPantryItemPantryItemsItemIdGetQueryOptions(itemId, options);
316
+ const query = useQuery(queryOptions);
317
+ query.queryKey = queryOptions.queryKey;
318
+ return query;
319
+ }
320
+ /**
321
+ * @summary Update Pantry Item
322
+ */
323
+ export const updatePantryItemPantryItemsItemIdPut = (itemId, bodyUpdatePantryItemPantryItemsItemIdPut, options) => {
324
+ const formData = new FormData();
325
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.name !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.name !== null) {
326
+ formData.append(`name`, bodyUpdatePantryItemPantryItemsItemIdPut.name);
327
+ }
328
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.item_type !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.item_type !== null) {
329
+ formData.append(`item_type`, bodyUpdatePantryItemPantryItemsItemIdPut.item_type);
330
+ }
331
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.quantity !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.quantity !== null) {
332
+ formData.append(`quantity`, bodyUpdatePantryItemPantryItemsItemIdPut.quantity.toString());
333
+ }
334
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.quantity_unit !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.quantity_unit !== null) {
335
+ formData.append(`quantity_unit`, bodyUpdatePantryItemPantryItemsItemIdPut.quantity_unit);
336
+ }
337
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.expiration_date !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.expiration_date !== null) {
338
+ formData.append(`expiration_date`, bodyUpdatePantryItemPantryItemsItemIdPut.expiration_date);
339
+ }
340
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.location !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.location !== null) {
341
+ formData.append(`location`, bodyUpdatePantryItemPantryItemsItemIdPut.location);
342
+ }
343
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.notes !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.notes !== null) {
344
+ formData.append(`notes`, bodyUpdatePantryItemPantryItemsItemIdPut.notes);
345
+ }
346
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.image !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.image !== null) {
347
+ formData.append(`image`, bodyUpdatePantryItemPantryItemsItemIdPut.image);
348
+ }
349
+ if (bodyUpdatePantryItemPantryItemsItemIdPut.clear_image !== undefined && bodyUpdatePantryItemPantryItemsItemIdPut.clear_image !== null) {
350
+ formData.append(`clear_image`, bodyUpdatePantryItemPantryItemsItemIdPut.clear_image);
351
+ }
352
+ return axios.put(`/pantry-items/${itemId}`, formData, options);
353
+ };
354
+ export const getUpdatePantryItemPantryItemsItemIdPutMutationOptions = (options) => {
355
+ const mutationKey = ['updatePantryItemPantryItemsItemIdPut'];
356
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
357
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
358
+ options
359
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
360
+ : { mutation: { mutationKey, }, axios: undefined };
361
+ const mutationFn = (props) => {
362
+ const { itemId, data } = props ?? {};
363
+ return updatePantryItemPantryItemsItemIdPut(itemId, data, axiosOptions);
364
+ };
365
+ return { mutationFn, ...mutationOptions };
366
+ };
367
+ /**
368
+ * @summary Update Pantry Item
369
+ */
370
+ export const useUpdatePantryItemPantryItemsItemIdPut = (options) => {
371
+ const mutationOptions = getUpdatePantryItemPantryItemsItemIdPutMutationOptions(options);
372
+ return useMutation(mutationOptions);
373
+ };
374
+ /**
375
+ * @summary Delete Pantry Item
376
+ */
377
+ export const deletePantryItemPantryItemsItemIdDelete = (itemId, options) => {
378
+ return axios.delete(`/pantry-items/${itemId}`, options);
379
+ };
380
+ export const getDeletePantryItemPantryItemsItemIdDeleteMutationOptions = (options) => {
381
+ const mutationKey = ['deletePantryItemPantryItemsItemIdDelete'];
382
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
383
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
384
+ options
385
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
386
+ : { mutation: { mutationKey, }, axios: undefined };
387
+ const mutationFn = (props) => {
388
+ const { itemId } = props ?? {};
389
+ return deletePantryItemPantryItemsItemIdDelete(itemId, axiosOptions);
390
+ };
391
+ return { mutationFn, ...mutationOptions };
392
+ };
393
+ /**
394
+ * @summary Delete Pantry Item
395
+ */
396
+ export const useDeletePantryItemPantryItemsItemIdDelete = (options) => {
397
+ const mutationOptions = getDeletePantryItemPantryItemsItemIdDeleteMutationOptions(options);
398
+ return useMutation(mutationOptions);
399
+ };
400
+ /**
401
+ * @summary Get Recipe Image
402
+ */
403
+ export const getRecipeImageRecipesRecipeImageFilenameGet = (filename, options) => {
404
+ return axios.get(`/recipes/recipe-image/${filename}`, options);
405
+ };
406
+ export const getGetRecipeImageRecipesRecipeImageFilenameGetQueryKey = (filename) => {
407
+ return [
408
+ `/recipes/recipe-image/${filename}`
409
+ ];
410
+ };
411
+ export const getGetRecipeImageRecipesRecipeImageFilenameGetQueryOptions = (filename, options) => {
412
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
413
+ const queryKey = queryOptions?.queryKey ?? getGetRecipeImageRecipesRecipeImageFilenameGetQueryKey(filename);
414
+ const queryFn = ({ signal }) => getRecipeImageRecipesRecipeImageFilenameGet(filename, { signal, ...axiosOptions });
415
+ return { queryKey, queryFn, enabled: !!(filename), ...queryOptions };
416
+ };
417
+ /**
418
+ * @summary Get Recipe Image
419
+ */
420
+ export function useGetRecipeImageRecipesRecipeImageFilenameGet(filename, options) {
421
+ const queryOptions = getGetRecipeImageRecipesRecipeImageFilenameGetQueryOptions(filename, options);
422
+ const query = useQuery(queryOptions);
423
+ query.queryKey = queryOptions.queryKey;
424
+ return query;
425
+ }
426
+ /**
427
+ * Search pantry items:
428
+ - Exact case-insensitive match -> results
429
+ - >=50% similarity but <100% -> suggestions
430
+ * @summary Search Pantry Items
431
+ */
432
+ export const searchPantryItemsRecipesPantrySearchGet = (params, options) => {
433
+ return axios.get(`/recipes/pantry/search`, {
434
+ ...options,
435
+ params: { ...params, ...options?.params },
436
+ });
437
+ };
438
+ export const getSearchPantryItemsRecipesPantrySearchGetQueryKey = (params) => {
439
+ return [
440
+ `/recipes/pantry/search`, ...(params ? [params] : [])
441
+ ];
442
+ };
443
+ export const getSearchPantryItemsRecipesPantrySearchGetQueryOptions = (params, options) => {
444
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
445
+ const queryKey = queryOptions?.queryKey ?? getSearchPantryItemsRecipesPantrySearchGetQueryKey(params);
446
+ const queryFn = ({ signal }) => searchPantryItemsRecipesPantrySearchGet(params, { signal, ...axiosOptions });
447
+ return { queryKey, queryFn, ...queryOptions };
448
+ };
449
+ /**
450
+ * @summary Search Pantry Items
451
+ */
452
+ export function useSearchPantryItemsRecipesPantrySearchGet(params, options) {
453
+ const queryOptions = getSearchPantryItemsRecipesPantrySearchGetQueryOptions(params, options);
454
+ const query = useQuery(queryOptions);
455
+ query.queryKey = queryOptions.queryKey;
456
+ return query;
457
+ }
458
+ /**
459
+ * @summary Create Recipe
460
+ */
461
+ export const createRecipeRecipesPost = (bodyCreateRecipeRecipesPost, options) => {
462
+ const formData = new FormData();
463
+ formData.append(`name`, bodyCreateRecipeRecipesPost.name);
464
+ formData.append(`cuisine`, bodyCreateRecipeRecipesPost.cuisine);
465
+ formData.append(`instructions`, bodyCreateRecipeRecipesPost.instructions);
466
+ formData.append(`ingredients`, bodyCreateRecipeRecipesPost.ingredients);
467
+ if (bodyCreateRecipeRecipesPost.prep_time !== undefined) {
468
+ formData.append(`prep_time`, bodyCreateRecipeRecipesPost.prep_time.toString());
469
+ }
470
+ if (bodyCreateRecipeRecipesPost.cook_time !== undefined) {
471
+ formData.append(`cook_time`, bodyCreateRecipeRecipesPost.cook_time.toString());
472
+ }
473
+ if (bodyCreateRecipeRecipesPost.servings !== undefined) {
474
+ formData.append(`servings`, bodyCreateRecipeRecipesPost.servings.toString());
475
+ }
476
+ if (bodyCreateRecipeRecipesPost.image !== undefined) {
477
+ formData.append(`image`, bodyCreateRecipeRecipesPost.image);
478
+ }
479
+ return axios.post(`/recipes/`, formData, options);
480
+ };
481
+ export const getCreateRecipeRecipesPostMutationOptions = (options) => {
482
+ const mutationKey = ['createRecipeRecipesPost'];
483
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
484
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
485
+ options
486
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
487
+ : { mutation: { mutationKey, }, axios: undefined };
488
+ const mutationFn = (props) => {
489
+ const { data } = props ?? {};
490
+ return createRecipeRecipesPost(data, axiosOptions);
491
+ };
492
+ return { mutationFn, ...mutationOptions };
493
+ };
494
+ /**
495
+ * @summary Create Recipe
496
+ */
497
+ export const useCreateRecipeRecipesPost = (options) => {
498
+ const mutationOptions = getCreateRecipeRecipesPostMutationOptions(options);
499
+ return useMutation(mutationOptions);
500
+ };
501
+ /**
502
+ * @summary Get Recipes
503
+ */
504
+ export const getRecipesRecipesGet = (params, options) => {
505
+ return axios.get(`/recipes/`, {
506
+ ...options,
507
+ params: { ...params, ...options?.params },
508
+ });
509
+ };
510
+ export const getGetRecipesRecipesGetQueryKey = (params) => {
511
+ return [
512
+ `/recipes/`, ...(params ? [params] : [])
513
+ ];
514
+ };
515
+ export const getGetRecipesRecipesGetQueryOptions = (params, options) => {
516
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
517
+ const queryKey = queryOptions?.queryKey ?? getGetRecipesRecipesGetQueryKey(params);
518
+ const queryFn = ({ signal }) => getRecipesRecipesGet(params, { signal, ...axiosOptions });
519
+ return { queryKey, queryFn, ...queryOptions };
520
+ };
521
+ /**
522
+ * @summary Get Recipes
523
+ */
524
+ export function useGetRecipesRecipesGet(params, options) {
525
+ const queryOptions = getGetRecipesRecipesGetQueryOptions(params, options);
526
+ const query = useQuery(queryOptions);
527
+ query.queryKey = queryOptions.queryKey;
528
+ return query;
529
+ }
530
+ /**
531
+ * @summary Get Recipe
532
+ */
533
+ export const getRecipeRecipesRecipeIdGet = (recipeId, options) => {
534
+ return axios.get(`/recipes/${recipeId}`, options);
535
+ };
536
+ export const getGetRecipeRecipesRecipeIdGetQueryKey = (recipeId) => {
537
+ return [
538
+ `/recipes/${recipeId}`
539
+ ];
540
+ };
541
+ export const getGetRecipeRecipesRecipeIdGetQueryOptions = (recipeId, options) => {
542
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
543
+ const queryKey = queryOptions?.queryKey ?? getGetRecipeRecipesRecipeIdGetQueryKey(recipeId);
544
+ const queryFn = ({ signal }) => getRecipeRecipesRecipeIdGet(recipeId, { signal, ...axiosOptions });
545
+ return { queryKey, queryFn, enabled: !!(recipeId), ...queryOptions };
546
+ };
547
+ /**
548
+ * @summary Get Recipe
549
+ */
550
+ export function useGetRecipeRecipesRecipeIdGet(recipeId, options) {
551
+ const queryOptions = getGetRecipeRecipesRecipeIdGetQueryOptions(recipeId, options);
552
+ const query = useQuery(queryOptions);
553
+ query.queryKey = queryOptions.queryKey;
554
+ return query;
555
+ }
556
+ /**
557
+ * @summary Update Recipe
558
+ */
559
+ export const updateRecipeRecipesRecipeIdPut = (recipeId, bodyUpdateRecipeRecipesRecipeIdPut, options) => {
560
+ const formData = new FormData();
561
+ if (bodyUpdateRecipeRecipesRecipeIdPut.name !== undefined) {
562
+ formData.append(`name`, bodyUpdateRecipeRecipesRecipeIdPut.name);
563
+ }
564
+ if (bodyUpdateRecipeRecipesRecipeIdPut.cuisine !== undefined && bodyUpdateRecipeRecipesRecipeIdPut.cuisine !== null) {
565
+ formData.append(`cuisine`, bodyUpdateRecipeRecipesRecipeIdPut.cuisine);
566
+ }
567
+ if (bodyUpdateRecipeRecipesRecipeIdPut.instructions !== undefined) {
568
+ formData.append(`instructions`, bodyUpdateRecipeRecipesRecipeIdPut.instructions);
569
+ }
570
+ if (bodyUpdateRecipeRecipesRecipeIdPut.ingredients !== undefined) {
571
+ formData.append(`ingredients`, bodyUpdateRecipeRecipesRecipeIdPut.ingredients);
572
+ }
573
+ if (bodyUpdateRecipeRecipesRecipeIdPut.prep_time !== undefined) {
574
+ formData.append(`prep_time`, bodyUpdateRecipeRecipesRecipeIdPut.prep_time.toString());
575
+ }
576
+ if (bodyUpdateRecipeRecipesRecipeIdPut.cook_time !== undefined) {
577
+ formData.append(`cook_time`, bodyUpdateRecipeRecipesRecipeIdPut.cook_time.toString());
578
+ }
579
+ if (bodyUpdateRecipeRecipesRecipeIdPut.servings !== undefined) {
580
+ formData.append(`servings`, bodyUpdateRecipeRecipesRecipeIdPut.servings.toString());
581
+ }
582
+ if (bodyUpdateRecipeRecipesRecipeIdPut.image !== undefined) {
583
+ formData.append(`image`, bodyUpdateRecipeRecipesRecipeIdPut.image);
584
+ }
585
+ if (bodyUpdateRecipeRecipesRecipeIdPut.clear_image !== undefined && bodyUpdateRecipeRecipesRecipeIdPut.clear_image !== null) {
586
+ formData.append(`clear_image`, bodyUpdateRecipeRecipesRecipeIdPut.clear_image);
587
+ }
588
+ return axios.put(`/recipes/${recipeId}`, formData, options);
589
+ };
590
+ export const getUpdateRecipeRecipesRecipeIdPutMutationOptions = (options) => {
591
+ const mutationKey = ['updateRecipeRecipesRecipeIdPut'];
592
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
593
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
594
+ options
595
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
596
+ : { mutation: { mutationKey, }, axios: undefined };
597
+ const mutationFn = (props) => {
598
+ const { recipeId, data } = props ?? {};
599
+ return updateRecipeRecipesRecipeIdPut(recipeId, data, axiosOptions);
600
+ };
601
+ return { mutationFn, ...mutationOptions };
602
+ };
603
+ /**
604
+ * @summary Update Recipe
605
+ */
606
+ export const useUpdateRecipeRecipesRecipeIdPut = (options) => {
607
+ const mutationOptions = getUpdateRecipeRecipesRecipeIdPutMutationOptions(options);
608
+ return useMutation(mutationOptions);
609
+ };
610
+ /**
611
+ * @summary Delete Recipe
612
+ */
613
+ export const deleteRecipeRecipesRecipeIdDelete = (recipeId, options) => {
614
+ return axios.delete(`/recipes/${recipeId}`, options);
615
+ };
616
+ export const getDeleteRecipeRecipesRecipeIdDeleteMutationOptions = (options) => {
617
+ const mutationKey = ['deleteRecipeRecipesRecipeIdDelete'];
618
+ const { mutation: mutationOptions, axios: axiosOptions } = options ?
619
+ options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
620
+ options
621
+ : { ...options, mutation: { ...options.mutation, mutationKey } }
622
+ : { mutation: { mutationKey, }, axios: undefined };
623
+ const mutationFn = (props) => {
624
+ const { recipeId } = props ?? {};
625
+ return deleteRecipeRecipesRecipeIdDelete(recipeId, axiosOptions);
626
+ };
627
+ return { mutationFn, ...mutationOptions };
628
+ };
629
+ /**
630
+ * @summary Delete Recipe
631
+ */
632
+ export const useDeleteRecipeRecipesRecipeIdDelete = (options) => {
633
+ const mutationOptions = getDeleteRecipeRecipesRecipeIdDeleteMutationOptions(options);
634
+ return useMutation(mutationOptions);
635
+ };
636
+ /**
637
+ * @summary Read Root
638
+ */
639
+ export const readRootGet = (options) => {
640
+ return axios.get(`/`, options);
641
+ };
642
+ export const getReadRootGetQueryKey = () => {
643
+ return [
644
+ `/`
645
+ ];
646
+ };
647
+ export const getReadRootGetQueryOptions = (options) => {
648
+ const { query: queryOptions, axios: axiosOptions } = options ?? {};
649
+ const queryKey = queryOptions?.queryKey ?? getReadRootGetQueryKey();
650
+ const queryFn = ({ signal }) => readRootGet({ signal, ...axiosOptions });
651
+ return { queryKey, queryFn, ...queryOptions };
652
+ };
653
+ /**
654
+ * @summary Read Root
655
+ */
656
+ export function useReadRootGet(options) {
657
+ const queryOptions = getReadRootGetQueryOptions(options);
658
+ const query = useQuery(queryOptions);
659
+ query.queryKey = queryOptions.queryKey;
660
+ return query;
661
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@pantry-pilot/pantry-pilot-api",
3
+ "version": "1.0.1",
4
+ "description": "Auto-generated TypeScript client for Pantry Pilot API — TanStack Query hooks + Axios",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc"
12
+ },
13
+ "peerDependencies": {
14
+ "@tanstack/react-query": ">=5.0.0",
15
+ "axios": ">=1.0.0",
16
+ "react": ">=18.0.0"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.0.0",
20
+ "@tanstack/react-query": "^5.0.0",
21
+ "axios": "^1.0.0",
22
+ "react": "^18.0.0",
23
+ "@types/react": "^18.0.0"
24
+ },
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://gitlab.com/mrplumbum82/pantry-pilot-api"
29
+ }
30
+ }