From b9f58599de026aae10bc4233a566fc8dac45a868 Mon Sep 17 00:00:00 2001 From: kevinlee11 Date: Fri, 19 Jul 2024 16:58:17 -0400 Subject: [PATCH] docs: add cartData to response (#10) --- src/types/api/cart/index.ts | 3 +++ src/types/api/cart/private.types.ts | 3 ++- src/types/api/resources/index.ts | 4 +--- typedocs/interfaces/types_api_cart.CartBaseResponse.md | 1 + typedocs/interfaces/types_api_cart.CartResponse.md | 1 + typedocs/interfaces/types_api_resources.ResourcesResponse.md | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/types/api/cart/index.ts b/src/types/api/cart/index.ts index 886e95d..c738b5e 100644 --- a/src/types/api/cart/index.ts +++ b/src/types/api/cart/index.ts @@ -428,6 +428,9 @@ export interface CartBaseResponse { * doing very custom order management. */ cart: string; + /** The cart object. See https://square.github.io/custom-sites-docs/resources/cart#cart */ + // eslint-disable-next-line @typescript-eslint/naming-convention + cart_data: unknown; /** Validation for scheduling. Empty if not pickup or delivery fulfillment. */ validation: CartValidation; }; diff --git a/src/types/api/cart/private.types.ts b/src/types/api/cart/private.types.ts index 9e4ed56..aa23d49 100644 --- a/src/types/api/cart/private.types.ts +++ b/src/types/api/cart/private.types.ts @@ -1,4 +1,4 @@ -import { +import { CartValidationErrors, CartValidation } from '.'; @@ -18,6 +18,7 @@ export interface CartBaseErrorResponse { export interface CartFetchResponse extends CartBaseErrorResponse { data?: { cart: string; + cart_data: unknown; validation: CartValidation; }; } diff --git a/src/types/api/resources/index.ts b/src/types/api/resources/index.ts index ac3785e..7c2e352 100644 --- a/src/types/api/resources/index.ts +++ b/src/types/api/resources/index.ts @@ -1,5 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - /** ResourcesRequest can take up to 5 keys (each representing a resource). */ export interface ResourcesRequest { [key: string]: ResourceInput; @@ -8,7 +6,7 @@ export interface ResourcesRequest { /** `key` is the same key we used in the request object, and the value is the resource being returned. */ export interface ResourcesResponse { [key: string]: { - data?: any; + data?: unknown; errors: string[]; }; } diff --git a/typedocs/interfaces/types_api_cart.CartBaseResponse.md b/typedocs/interfaces/types_api_cart.CartBaseResponse.md index a141bb4..3abf244 100644 --- a/typedocs/interfaces/types_api_cart.CartBaseResponse.md +++ b/typedocs/interfaces/types_api_cart.CartBaseResponse.md @@ -27,4 +27,5 @@ | Name | Type | Description | | :------ | :------ | :------ | | `cart` | `string` | The `orderId` for the order. Only needed if you're doing very custom order management. | +| `cart_data` | `unknown` | The cart object. See https://square.github.io/custom-sites-docs/resources/cart#cart | | `validation` | [`CartValidation`](types_api_cart.CartValidation.md) | Validation for scheduling. Empty if not pickup or delivery fulfillment. | diff --git a/typedocs/interfaces/types_api_cart.CartResponse.md b/typedocs/interfaces/types_api_cart.CartResponse.md index 9aee503..6928545 100644 --- a/typedocs/interfaces/types_api_cart.CartResponse.md +++ b/typedocs/interfaces/types_api_cart.CartResponse.md @@ -28,6 +28,7 @@ | Name | Type | Description | | :------ | :------ | :------ | | `cart` | `string` | The `orderId` for the order. Only needed if you're doing very custom order management. | +| `cart_data` | `unknown` | The cart object. See https://square.github.io/custom-sites-docs/resources/cart#cart | | `validation` | [`CartValidation`](types_api_cart.CartValidation.md) | Validation for scheduling. Empty if not pickup or delivery fulfillment. | #### Inherited from diff --git a/typedocs/interfaces/types_api_resources.ResourcesResponse.md b/typedocs/interfaces/types_api_resources.ResourcesResponse.md index c07155a..15d0eaa 100644 --- a/typedocs/interfaces/types_api_resources.ResourcesResponse.md +++ b/typedocs/interfaces/types_api_resources.ResourcesResponse.md @@ -8,4 +8,4 @@ ## Indexable -▪ [key: `string`]: { `data?`: `any` ; `errors`: `string`[] } +▪ [key: `string`]: { `data?`: `unknown` ; `errors`: `string`[] }