UNPKG

@hoxhaolsi/cloud-sdk

Version:

LiquidCommerce Cloud SDK

32 lines (31 loc) 1.42 kB
import type { AuthenticatedService, CartHelperService } from '../core'; import type { ICart, ICartUpdateParams } from '../interfaces'; import type { IApiResponseWithoutData } from '../types'; /** * The CartService class is responsible for fetching and updating cart data from the server. * * @class CartService */ export declare class CartService { private client; private cartHelperService; private readonly servicePath; constructor(client: AuthenticatedService, cartHelperService: CartHelperService); /** * Retrieves the cart with the specified ID or a new cart from the server. * * @param {string} id - The ID of the cart to retrieve. * @param {boolean} refresh - A flag that if true return a refreshed access token. * @return {Promise<IApiResponseWithoutData<ICart>>} A Promise that resolves to the cart object. * @throws {Error} If the request to update the cart fails. */ get(id?: string, refresh?: boolean): Promise<IApiResponseWithoutData<ICart>>; /** * Updates the cart with the provided parameters. * * @param {ICartUpdateParams} params - The parameters for updating the cart. * @returns {Promise<IApiResponseWithoutData<ICart>>} A promise that resolves to the updated cart data. * @throws {Error} If the cart update request fails. */ update(params: ICartUpdateParams): Promise<IApiResponseWithoutData<ICart>>; }