@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.
79 lines • 3.58 kB
TypeScript
/**
* @fileoverview Client for managing transactions in the Sharetribe Integration API.
*
* This privileged API allows querying, transitioning, and updating metadata for transactions.
* Use it for admin tools, backend services, or automated workflows.
*
* @see https://www.sharetribe.com/api-reference/integration.html#transactions
*/
import type { AxiosResponse } from "axios";
import IntegrationApi from "./index";
import { ExtraParameter, TransactionsQueryParameter, TransactionsResponse, TransactionsShowParameter, TransactionsTransitionParameter, TransactionsTransitionSpeculativeParameter, TransactionsUpdateMetadataParameter } from "../../types";
/**
* Transactions API client (privileged)
*/
declare class Transactions {
readonly authRequired = true;
private readonly axios;
private readonly endpoint;
private readonly headers;
constructor(api: IntegrationApi);
/**
* Fetch a single transaction by ID
*
* @template P
* @param {P & TransactionsShowParameter} params
* @returns {Promise<AxiosResponse<TransactionsResponse<"show", P>>>}
*/
show<P extends TransactionsShowParameter>(params: P): Promise<AxiosResponse<TransactionsResponse<"show", P, {
expand: true;
}>>>;
/**
* Query transactions with privileged filters
*
* @template P
* @param {P & TransactionsQueryParameter<true>} params - Note: `true` enables privileged fields like `customerId`, `providerId`
* @returns {Promise<AxiosResponse<TransactionsResponse<"query", P>>>}
*/
query<P extends TransactionsQueryParameter<true>>(params: P): Promise<AxiosResponse<TransactionsResponse<"query", P>>>;
/**
* Transition a transaction to a new state
*
* @template P
* @template EP
* @param {P & TransactionsTransitionParameter} params
* @param {EP} [extraParams] - Optional extra parameters (e.g. `expand: true`)
* @returns {Promise<AxiosResponse<TransactionsResponse<"transition", P, EP>>>}
*
* @example
* await sdk.transactions.transition({
* id: "tx-abc123",
* transition: "transition/confirm-payment"
* });
*/
transition<P extends TransactionsTransitionParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<TransactionsResponse<"transition", P, EP>>>;
/**
* Perform a speculative transition (dry-run)
*
* Does not persist changes — useful for validation before real transition.
*
* @template P
* @template EP
* @param {P & TransactionsTransitionSpeculativeParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<TransactionsResponse<"transitionSpeculative", P, EP>>>}
*/
transitionSpeculative<P extends TransactionsTransitionSpeculativeParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<TransactionsResponse<"transitionSpeculative", P, EP>>>;
/**
* Update transaction metadata
*
* @template P
* @template EP
* @param {P & TransactionsUpdateMetadataParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<TransactionsResponse<"updateMetadata", P, EP>>>}
*/
updateMetadata<P extends TransactionsUpdateMetadataParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<TransactionsResponse<"updateMetadata", P, EP>>>;
}
export default Transactions;
//# sourceMappingURL=Transactions.d.ts.map