UNPKG

@spree/storefront-api-v2-sdk

Version:

Node module to easily integrate your JavaScript or TypeScript application with Spree 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

26 lines (21 loc) 847 B
import squashAndPreparePositionalArguments from '../helpers/squashAndPreparePositionalArguments' import Http from '../Http' import type { ListOptions, ShowOptions, VendorResult, VendorsResult, Vendors as VendorsType, Vendor } from '../interfaces/Vendor' import routes from '../routes' export default class Vendors extends Http { public async list(options: ListOptions = {}): Promise<VendorsResult> { const { token, params } = squashAndPreparePositionalArguments([options], []) return await this.spreeResponse<VendorsType>('get', routes.vendorsPath(), token, params) } public async show(options: ShowOptions): Promise<VendorResult> { const { id, token, params } = squashAndPreparePositionalArguments([options], ['id']) return await this.spreeResponse<Vendor>('get', routes.vendorPath(id), token, params) } }