@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.
44 lines (43 loc) • 1.47 kB
TypeScript
/**
* @fileoverview Client for querying events in the Sharetribe Integration API.
*
* The Events API provides a stream of marketplace events (e.g. listing created, transaction transitioned)
* for building integrations, webhooks, analytics, or real-time features.
*
* @see https://www.sharetribe.com/api-reference/integration.html#events
*/
import type { AxiosResponse } from "axios";
import IntegrationApi from "./index";
import { EventsQueryParameter, EventsResponse } from "../../types";
/**
* Events API client
*/
declare class Events {
private readonly axios;
private readonly endpoint;
private readonly headers;
constructor(api: IntegrationApi);
/**
* Query marketplace events
*
* @template P
* @param {P & EventsQueryParameter} params - Query filters and pagination
* @returns {Promise<AxiosResponse<EventsResponse<"query">>>}
*
* @example
* // Fetch events after a specific sequence ID
* const response = await sdk.events.query({
* startAfterSequenceId: 12345,
* eventTypes: ["transaction/initiated", "booking/created"]
* });
*
* @example
* // Fetch recent events for a specific listing
* await sdk.events.query({
* resourceId: "listing-abc-123",
* createdAtStart: "2025-01-01T00:00:00Z"
* });
*/
query<P extends EventsQueryParameter>(params: P): Promise<AxiosResponse<EventsResponse<"query">>>;
}
export default Events;