khansama-api 1.65.0 → 1.66.0

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.d.ts CHANGED
@@ -334,16 +334,80 @@ export interface AgentPantryItem {
334
334
  item_type: ItemTypeEnum;
335
335
  location?: AgentPantryItemLocation;
336
336
  }
337
+ export type AgentPantryItemCreateExpirationDate = string | null;
338
+ export type AgentPantryItemCreateLocation = LocationEnum | null;
339
+ export type AgentPantryItemCreateNotes = string | null;
340
+ /**
341
+ * Add one pantry item on behalf of the token's household (PAN-535).
342
+
343
+ Deliberately smaller than the app's form: no images, no custom storage
344
+ locations, no restock hints — the agent gets the fields it can name.
345
+ */
346
+ export interface AgentPantryItemCreate {
347
+ /**
348
+ * @minLength 1
349
+ * @maxLength 200
350
+ */
351
+ name: string;
352
+ item_type: ItemTypeEnum;
353
+ quantity: number;
354
+ quantity_unit: QuantityUnitEnum;
355
+ expiration_date?: AgentPantryItemCreateExpirationDate;
356
+ location?: AgentPantryItemCreateLocation;
357
+ notes?: AgentPantryItemCreateNotes;
358
+ }
337
359
  export interface AgentPantryResponse {
338
360
  items: AgentPantryItem[];
339
361
  total: number;
340
362
  }
363
+ export type AgentPlanSlotCreateRecipeId = number | null;
364
+ export type AgentPlanSlotCreateCatalogRecipeId = number | null;
365
+ export type AgentPlanSlotCreateServingsOverride = number | null;
366
+ export type AgentPlanSlotCreateNotes = string | null;
367
+ /**
368
+ * Add one meal to the plan that covers today (PAN-535).
369
+
370
+ ``recipe_id`` (a household recipe) and ``catalog_recipe_id`` (a global
371
+ catalog recipe) are mutually exclusive — the app's slot rule.
372
+ */
373
+ export interface AgentPlanSlotCreate {
374
+ recipe_id?: AgentPlanSlotCreateRecipeId;
375
+ catalog_recipe_id?: AgentPlanSlotCreateCatalogRecipeId;
376
+ /**
377
+ * 0 = Monday of the plan's week (week_start)
378
+ * @minimum 0
379
+ * @maximum 6
380
+ */
381
+ day_index: number;
382
+ meal_type?: MealTypeEnum;
383
+ servings_override?: AgentPlanSlotCreateServingsOverride;
384
+ notes?: AgentPlanSlotCreateNotes;
385
+ }
386
+ export type AgentPlanSlotCreatedWeekStart = string | null;
387
+ export type AgentPlanSlotCreatedRecipeId = number | null;
388
+ export type AgentPlanSlotCreatedCatalogRecipeId = number | null;
389
+ export type AgentPlanSlotCreatedRecipeTitle = string | null;
390
+ /**
391
+ * What the agent gets back after adding a plan slot.
392
+ */
393
+ export interface AgentPlanSlotCreated {
394
+ plan_id: number;
395
+ plan_name: string;
396
+ week_start?: AgentPlanSlotCreatedWeekStart;
397
+ slot_id: number;
398
+ day_index: number;
399
+ meal_type: MealTypeEnum;
400
+ recipe_id?: AgentPlanSlotCreatedRecipeId;
401
+ catalog_recipe_id?: AgentPlanSlotCreatedCatalogRecipeId;
402
+ recipe_title?: AgentPlanSlotCreatedRecipeTitle;
403
+ }
341
404
  export interface AgentTokenCreate {
342
405
  /**
343
406
  * @minLength 1
344
407
  * @maxLength 100
345
408
  */
346
409
  name: string;
410
+ scope?: AgentTokenScopeEnum;
347
411
  }
348
412
  export type AgentTokenCreatedLastUsedAt = string | null;
349
413
  export type AgentTokenCreatedRevokedAt = string | null;
@@ -353,6 +417,7 @@ export type AgentTokenCreatedRevokedAt = string | null;
353
417
  export interface AgentTokenCreated {
354
418
  id: number;
355
419
  name: string;
420
+ scope: AgentTokenScopeEnum;
356
421
  created_at: string;
357
422
  last_used_at?: AgentTokenCreatedLastUsedAt;
358
423
  revoked_at?: AgentTokenCreatedRevokedAt;
@@ -366,10 +431,21 @@ export type AgentTokenResponseRevokedAt = string | null;
366
431
  export interface AgentTokenResponse {
367
432
  id: number;
368
433
  name: string;
434
+ scope: AgentTokenScopeEnum;
369
435
  created_at: string;
370
436
  last_used_at?: AgentTokenResponseLastUsedAt;
371
437
  revoked_at?: AgentTokenResponseRevokedAt;
372
438
  }
439
+ /**
440
+ * What an agent token may do (PAN-535): read anything under /agent/v1,
441
+ or additionally create pantry items and plan slots. Write is opt-in at
442
+ creation because a leaked read token must never change data.
443
+ */
444
+ export type AgentTokenScopeEnum = typeof AgentTokenScopeEnum[keyof typeof AgentTokenScopeEnum];
445
+ export declare const AgentTokenScopeEnum: {
446
+ readonly read: "read";
447
+ readonly write: "write";
448
+ };
373
449
  export interface BarcodeRequest {
374
450
  /**
375
451
  * UPC/EAN barcode (8-14 digits)
@@ -8769,6 +8845,36 @@ export declare function useGetPantryAgentV1PantryGet<TData = Awaited<ReturnType<
8769
8845
  }): UseQueryResult<TData, TError> & {
8770
8846
  queryKey: QueryKey;
8771
8847
  };
8848
+ /**
8849
+ * Add one pantry item to the token's household (write scope required).
8850
+
8851
+ It goes through the same service the app uses, so catalog linking, the
8852
+ expiry heuristic and the ``added`` inventory event all happen as usual.
8853
+ * @summary Add Pantry Item
8854
+ */
8855
+ export declare const addPantryItemAgentV1PantryPost: (agentPantryItemCreate: AgentPantryItemCreate, options?: AxiosRequestConfig) => Promise<AxiosResponse<AgentPantryItem>>;
8856
+ export declare const getAddPantryItemAgentV1PantryPostMutationOptions: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8857
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8858
+ data: AgentPantryItemCreate;
8859
+ }, TContext>;
8860
+ axios?: AxiosRequestConfig;
8861
+ }) => UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8862
+ data: AgentPantryItemCreate;
8863
+ }, TContext>;
8864
+ export type AddPantryItemAgentV1PantryPostMutationResult = NonNullable<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>>;
8865
+ export type AddPantryItemAgentV1PantryPostMutationBody = AgentPantryItemCreate;
8866
+ export type AddPantryItemAgentV1PantryPostMutationError = AxiosError<HTTPValidationError>;
8867
+ /**
8868
+ * @summary Add Pantry Item
8869
+ */
8870
+ export declare const useAddPantryItemAgentV1PantryPost: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8871
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8872
+ data: AgentPantryItemCreate;
8873
+ }, TContext>;
8874
+ axios?: AxiosRequestConfig;
8875
+ }) => UseMutationResult<Awaited<ReturnType<typeof addPantryItemAgentV1PantryPost>>, TError, {
8876
+ data: AgentPantryItemCreate;
8877
+ }, TContext>;
8772
8878
  /**
8773
8879
  * Items that expire today or within ``days`` days, soonest first. Already-expired items are not included.
8774
8880
  * @summary Get Expiring
@@ -8792,6 +8898,36 @@ export declare function useGetExpiringAgentV1ExpiringGet<TData = Awaited<ReturnT
8792
8898
  }): UseQueryResult<TData, TError> & {
8793
8899
  queryKey: QueryKey;
8794
8900
  };
8901
+ /**
8902
+ * Add one meal to the plan that covers today (write scope required).
8903
+
8904
+ ``day_index`` is 0-6 from the plan's ``week_start``; ``meal_type`` defaults
8905
+ to dinner. No active plan covering today is a 409.
8906
+ * @summary Add To Plan
8907
+ */
8908
+ export declare const addToPlanAgentV1PlanPost: (agentPlanSlotCreate: AgentPlanSlotCreate, options?: AxiosRequestConfig) => Promise<AxiosResponse<AgentPlanSlotCreated>>;
8909
+ export declare const getAddToPlanAgentV1PlanPostMutationOptions: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8910
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8911
+ data: AgentPlanSlotCreate;
8912
+ }, TContext>;
8913
+ axios?: AxiosRequestConfig;
8914
+ }) => UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8915
+ data: AgentPlanSlotCreate;
8916
+ }, TContext>;
8917
+ export type AddToPlanAgentV1PlanPostMutationResult = NonNullable<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>>;
8918
+ export type AddToPlanAgentV1PlanPostMutationBody = AgentPlanSlotCreate;
8919
+ export type AddToPlanAgentV1PlanPostMutationError = AxiosError<HTTPValidationError>;
8920
+ /**
8921
+ * @summary Add To Plan
8922
+ */
8923
+ export declare const useAddToPlanAgentV1PlanPost: <TError = AxiosError<HTTPValidationError>, TContext = unknown>(options?: {
8924
+ mutation?: UseMutationOptions<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8925
+ data: AgentPlanSlotCreate;
8926
+ }, TContext>;
8927
+ axios?: AxiosRequestConfig;
8928
+ }) => UseMutationResult<Awaited<ReturnType<typeof addToPlanAgentV1PlanPost>>, TError, {
8929
+ data: AgentPlanSlotCreate;
8930
+ }, TContext>;
8795
8931
  /**
8796
8932
  * @summary Read Root
8797
8933
  */