fix: Minor updates to the http typings (#7378)

This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-05-21 10:19:35 +02:00
1 parent 2371626198
commit e72174c4ff
4 files changed
+79 -16

No files matched your search

@@ -1,4 +1,7 @@
import { BigNumberValue } from "../../totals" import { BigNumberValue } from "../../totals"
import { BasePaymentCollection } from "../payment/common"
import { BaseProduct, BaseProductVariant } from "../product/common"
import { BaseRegion } from "../region/common"
export interface BaseCart { export interface BaseCart {
/** /**
@@ -6,6 +9,13 @@ export interface BaseCart {
*/ */
id: string id: string
/**
* The associated region.
*
* @expandable
*/
region?: BaseRegion
/** /**
* The ID of the region the cart belongs to. * The ID of the region the cart belongs to.
*/ */
@@ -59,6 +69,13 @@ export interface BaseCart {
*/ */
shipping_methods?: BaseCartShippingMethod[] shipping_methods?: BaseCartShippingMethod[]
/**
* The associated payment collection
*
* @expandable
*/
payment_collection?: BasePaymentCollection
/** /**
* Holds custom data in key-value pairs. * Holds custom data in key-value pairs.
*/ */
@@ -405,6 +422,13 @@ export interface BaseCartLineItem extends BaseCartLineItemTotals {
*/ */
quantity: BigNumberValue quantity: BigNumberValue
/**
* The associated product with the line item.
*
* @expandable
*/
product?: BaseProduct
/** /**
* The ID of the associated product. * The ID of the associated product.
*/ */
@@ -440,6 +464,13 @@ export interface BaseCartLineItem extends BaseCartLineItemTotals {
*/ */
product_handle?: string product_handle?: string
/**
* The associated variant with the line item.
*
* @expandable
*/
variant?: BaseProductVariant
/** /**
* The associated variant's ID of the line item. * The associated variant's ID of the line item.
*/ */
+9 -1
View File
@@ -1,3 +1,11 @@
import { BaseOrder } from "./common" import {
BaseOrder,
BaseOrderAddress,
BaseOrderLineItem,
BaseOrderShippingMethod,
} from "./common"
export interface AdminOrder extends BaseOrder {} export interface AdminOrder extends BaseOrder {}
export interface AdminOrderLineItem extends BaseOrderLineItem {}
export interface AdminOrderAddress extends BaseOrderAddress {}
export interface AdminOrderShippingMethod extends BaseOrderShippingMethod {}
+30 -14
View File
@@ -1,4 +1,8 @@
interface BaseOrderSummary { import { BigNumberValue } from "../../totals"
import { BasePaymentCollection } from "../payment/common"
import { BaseProduct, BaseProductVariant } from "../product/common"
export interface BaseOrderSummary {
total: number total: number
subtotal: number subtotal: number
total_tax: number total_tax: number
@@ -21,7 +25,7 @@ interface BaseOrderSummary {
refunded_total: number refunded_total: number
} }
interface BaseOrderAdjustmentLine { export interface BaseOrderAdjustmentLine {
id: string id: string
code?: string code?: string
amount: number amount: number
@@ -33,17 +37,18 @@ interface BaseOrderAdjustmentLine {
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderShippingMethodAdjustment extends BaseOrderAdjustmentLine { export interface BaseOrderShippingMethodAdjustment
extends BaseOrderAdjustmentLine {
shipping_method: BaseOrderShippingMethod shipping_method: BaseOrderShippingMethod
shipping_method_id: string shipping_method_id: string
} }
interface BaseOrderLineItemAdjustment extends BaseOrderAdjustmentLine { export interface BaseOrderLineItemAdjustment extends BaseOrderAdjustmentLine {
item: BaseOrderLineItem item: BaseOrderLineItem
item_id: string item_id: string
} }
interface BaseOrderTaxLine { export interface BaseOrderTaxLine {
id: string id: string
description?: string description?: string
tax_rate_id?: string tax_rate_id?: string
@@ -54,21 +59,21 @@ interface BaseOrderTaxLine {
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderShippingMethodTaxLine extends BaseOrderTaxLine { export interface BaseOrderShippingMethodTaxLine extends BaseOrderTaxLine {
shipping_method: BaseOrderShippingMethod shipping_method: BaseOrderShippingMethod
shipping_method_id: string shipping_method_id: string
total: number total: number
subtotal: number subtotal: number
} }
interface BaseOrderLineItemTaxLine extends BaseOrderTaxLine { export interface BaseOrderLineItemTaxLine extends BaseOrderTaxLine {
item: BaseOrderLineItem item: BaseOrderLineItem
item_id: string item_id: string
total: number total: number
subtotal: number subtotal: number
} }
interface BaseOrderAddress { export interface BaseOrderAddress {
id: string id: string
customer_id?: string customer_id?: string
first_name?: string first_name?: string
@@ -86,7 +91,7 @@ interface BaseOrderAddress {
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderShippingMethod { export interface BaseOrderShippingMethod {
id: string id: string
order_id: string order_id: string
name: string name: string
@@ -98,16 +103,26 @@ interface BaseOrderShippingMethod {
metadata: Record<string, unknown> | null metadata: Record<string, unknown> | null
tax_lines?: BaseOrderShippingMethodTaxLine[] tax_lines?: BaseOrderShippingMethodTaxLine[]
adjustments?: BaseOrderShippingMethodAdjustment[] adjustments?: BaseOrderShippingMethodAdjustment[]
original_total: BigNumberValue
original_subtotal: BigNumberValue
original_tax_total: BigNumberValue
total: BigNumberValue
subtotal: BigNumberValue
tax_total: BigNumberValue
discount_total: BigNumberValue
discount_tax_total: BigNumberValue
created_at: Date | string created_at: Date | string
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderLineItem { export interface BaseOrderLineItem {
id: string id: string
title: string title: string
subtitle: string | null subtitle: string | null
thumbnail: string | null thumbnail: string | null
variant?: BaseProductVariant
variant_id: string | null variant_id: string | null
product?: BaseProduct
product_id: string | null product_id: string | null
product_title: string | null product_title: string | null
product_description: string | null product_description: string | null
@@ -144,7 +159,7 @@ interface BaseOrderLineItem {
discount_tax_total: number discount_tax_total: number
} }
interface BaseOrderItemDetail { export interface BaseOrderItemDetail {
id: string id: string
item_id: string item_id: string
item: BaseOrderLineItem item: BaseOrderLineItem
@@ -160,7 +175,7 @@ interface BaseOrderItemDetail {
updated_at: Date updated_at: Date
} }
interface BaseOrderChange { export interface BaseOrderChange {
id: string id: string
order_id: string order_id: string
actions: BaseOrderChangeAction[] actions: BaseOrderChangeAction[]
@@ -179,7 +194,7 @@ interface BaseOrderChange {
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderChangeAction { export interface BaseOrderChangeAction {
id: string id: string
order_change_id: string | null order_change_id: string | null
order_change: BaseOrderChange | null order_change: BaseOrderChange | null
@@ -193,7 +208,7 @@ interface BaseOrderChangeAction {
updated_at: Date | string updated_at: Date | string
} }
interface BaseOrderTransaction { export interface BaseOrderTransaction {
id: string id: string
order_id: string order_id: string
amount: number amount: number
@@ -218,6 +233,7 @@ export interface BaseOrder {
billing_address?: BaseOrderAddress billing_address?: BaseOrderAddress
items: BaseOrderLineItem[] | null items: BaseOrderLineItem[] | null
shipping_methods: BaseOrderShippingMethod[] | null shipping_methods: BaseOrderShippingMethod[] | null
payment_collection?: BasePaymentCollection
transactions?: BaseOrderTransaction[] transactions?: BaseOrderTransaction[]
summary: BaseOrderSummary summary: BaseOrderSummary
metadata: Record<string, unknown> | null metadata: Record<string, unknown> | null
+9 -1
View File
@@ -1,3 +1,11 @@
import { BaseOrder } from "./common" import {
BaseOrder,
BaseOrderAddress,
BaseOrderLineItem,
BaseOrderShippingMethod,
} from "./common"
export interface StoreOrder extends BaseOrder {} export interface StoreOrder extends BaseOrder {}
export interface StoreOrderLineItem extends BaseOrderLineItem {}
export interface StoreOrderAddress extends BaseOrderAddress {}
export interface StoreOrderShippingMethod extends BaseOrderShippingMethod {}