UNPKG

@vansite/ts-sharetribe-flex-sdk

Version:

This is a TypeScript SDK for Sharetribe Flex API. It reduces the complexity of the API and provides a more user-friendly interface.

41 lines (40 loc) 1.32 kB
/** * @fileoverview Client for querying time slots in the Sharetribe Marketplace API. * * Use this to fetch availability for listings that use time-based booking * (e.g. hourly rentals, appointments, classes). * * Returns day or time-range slots with seat availability. * * @see https://www.sharetribe.com/api-reference/marketplace.html#time-slots */ import type { AxiosResponse } from "axios"; import MarketplaceApi from "./index"; import { TimeSlotsQueryParameter, TimeSlotsResponse } from "../../types"; /** * Time Slots API client */ declare class TimeSlots { private readonly axios; private readonly endpoint; private readonly headers; constructor(api: MarketplaceApi); /** * Query available time slots for a listing * * @template P * @param {P & TimeSlotsQueryParameter} params * @returns {Promise<AxiosResponse<TimeSlotsResponse<"query">>>} * * @example * const { data } = await sdk.timeSlots.query({ * listingId: "listing-abc123", * start: "2025-06-01T00:00:00Z", * end: "2025-06-07T23:59:59Z" * }); * * // `data` contains TimeSlot[] with `seats` and `start`/`end` */ query<P extends TimeSlotsQueryParameter>(params: P): Promise<AxiosResponse<TimeSlotsResponse<"query">>>; } export default TimeSlots;