UNPKG

@spree/storefront-api-v2-sdk

Version:

Node module to easily integrate your JavaScript or TypeScript application with Spree Storefront API V2. You can create an entirely custom Storefront in JS/TS with this package including one page checkout, Single Page Apps, PWAs and so on.

64 lines (63 loc) 2.35 kB
import { Http } from '@spree/core-api-v2-sdk'; import type { IQuery } from '@spree/core-api-v2-sdk'; import type { ICountriesResult, ICountryResult, DefaultOptions, ListOptions, ShowOptions } from '../interfaces/Country'; export default class Countries extends Http { /** * Returns a list of all countries. See [api docs](https://api.spreecommerce.org/docs/api-v2/ca56911efbaab-list-all-countries). * * **Success response schema:** [Success schema](../pages/response-schema.html#success-schema) * * **Failure response schema:** [Error schema](../pages/response-schema.html#error-schema) * * **Example:** * ```ts * const countries = await client.countries.list() * ``` */ list(options?: ListOptions): Promise<ICountriesResult>; /** * Returns the details of a specific country. See [api docs](https://api.spreecommerce.org/docs/api-v2/5f5116adb3113-retrieve-a-country). * * **Options schema:** * ```ts * interface options { * iso: string * } * ``` * * **Success response schema:** [Success schema](../pages/response-schema.html#success-schema) * * **Failure response schema:** [Error schema](../pages/response-schema.html#error-schema) * * **Example:** * ```ts * const country = await client.countries.show({ * iso: 'USA' * }) * ``` */ show(options: ShowOptions): Promise<ICountryResult>; /** * @hidden * @deprecated Use the combined options signature instead. */ show(iso: string, params: IQuery): Promise<ICountryResult>; /** * Returns the default country for the current store. By default this will be the US. See [api docs](https://api.spreecommerce.org/docs/api-v2/7cf807c85c035-get-default-country). * * **Success response schema:** [Success schema](../pages/response-schema.html#success-schema) * * **Failure response schema:** [Error schema](../pages/response-schema.html#error-schema) * * **Example:** * ```ts * const countries = await client.countries.default() * ``` */ default(options?: DefaultOptions): Promise<ICountryResult>; /** * @hidden * @deprecated Use the combined options signature instead. */ default(params: IQuery): Promise<ICountryResult>; }