@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.
119 lines (118 loc) • 5.34 kB
TypeScript
/**
* @fileoverview Client for managing your own listings in the Sharetribe Marketplace API.
*
* Use this to create, edit, publish, close, and manage images for listings you own.
* All operations require authentication.
*
* @see https://www.sharetribe.com/api-reference/marketplace.html#own-listings
*/
import type { AxiosResponse } from "axios";
import MarketplaceApi from "./index";
import { ExtraParameter, OwnListingsAddImageParameter, OwnListingsCloseParameter, OwnListingsCreateDraftParameter, OwnListingsCreateParameter, OwnListingsDiscardDraftParameter, OwnListingsOpenParameter, OwnListingsPublishDraftParameter, OwnListingsQueryParameter, OwnListingsResponse, OwnListingsShowParameter, OwnListingsUpdateParameter } from "../../types";
/**
* Own Listings API client (authenticated user)
*/
declare class OwnListings {
readonly authRequired = true;
private readonly axios;
private readonly endpoint;
private readonly headers;
constructor(api: MarketplaceApi);
/**
* Fetch one of your listings by ID
*
* @template P
* @param {P & OwnListingsShowParameter} params
* @returns {Promise<AxiosResponse<OwnListingsResponse<"show", P>>>}
*/
show<P extends OwnListingsShowParameter>(params: P): Promise<AxiosResponse<OwnListingsResponse<"show", P, {
expand: true;
}>>>;
/**
* List all your listings (drafts, published, closed)
*
* @template P
* @param {P & OwnListingsQueryParameter} params
* @returns {Promise<AxiosResponse<OwnListingsResponse<"query", P>>>}
*/
query<P extends OwnListingsQueryParameter>(params?: P): Promise<AxiosResponse<OwnListingsResponse<"query", P>>>;
/**
* Create a published listing
*
* @template P
* @template EP
* @param {P & OwnListingsCreateParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"create", P, EP>>>}
*/
create<P extends OwnListingsCreateParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"create", P, EP>>>;
/**
* Create a draft listing (for step-by-step creation)
*
* @template P
* @template EP
* @param {P & OwnListingsCreateDraftParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"createDraft", P, EP>>>}
*/
createDraft<P extends OwnListingsCreateDraftParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"createDraft", P, EP>>>;
/**
* Update a listing (draft or published)
*
* @template P
* @template EP
* @param {P & OwnListingsUpdateParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"update", P, EP>>>}
*/
update<P extends OwnListingsUpdateParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"update", P, EP>>>;
/**
* Publish a draft listing
*
* @template P
* @template EP
* @param {P & OwnListingsPublishDraftParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"publishDraft", P, EP>>>}
*/
publishDraft<P extends OwnListingsPublishDraftParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"publishDraft", P, EP>>>;
/**
* Discard a draft listing
*
* @template P
* @param {P & OwnListingsDiscardDraftParameter} params
* @returns {Promise<AxiosResponse<OwnListingsResponse<"discardDraft", P>>>}
*/
discardDraft<P extends OwnListingsDiscardDraftParameter>(params: P): Promise<AxiosResponse<OwnListingsResponse<"discardDraft", P>>>;
/**
* Close a published listing
*
* @template P
* @template EP
* @param {P & OwnListingsCloseParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"close", P, EP>>>}
*/
close<P extends OwnListingsCloseParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"close", P, EP>>>;
/**
* Re-open a closed listing
*
* @template P
* @template EP
* @param {P & OwnListingsOpenParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"open", P, EP>>>}
*/
open<P extends OwnListingsOpenParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"open", P, EP>>>;
/**
* Attach an uploaded image to a listing
*
* @template P
* @template EP
* @param {P & OwnListingsAddImageParameter} params
* @param {EP} [extraParams]
* @returns {Promise<AxiosResponse<OwnListingsResponse<"addImage", P, EP>>>}
*/
addImage<P extends OwnListingsAddImageParameter, EP extends ExtraParameter | undefined = undefined>(params: P, extraParams?: EP): Promise<AxiosResponse<OwnListingsResponse<"addImage", P, EP>>>;
}
export default OwnListings;