@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.
37 lines (36 loc) • 1.22 kB
TypeScript
/**
* @fileoverview Client for fetching public user profiles in the Sharetribe Marketplace API.
*
* Use this to retrieve publicly visible information about any user (e.g. name, bio, profile image).
* Only returns data the current user is allowed to see.
*
* @see https://www.sharetribe.com/api-reference/marketplace.html#show-user
*/
import type { AxiosResponse } from "axios";
import MarketplaceApi from "./index";
import { UsersResponse, UsersShowParameter } from "../../types";
/**
* Public Users API client
*/
declare class Users {
private readonly axios;
private readonly endpoint;
private readonly headers;
constructor(api: MarketplaceApi);
/**
* Fetch a public user profile by ID
*
* @template P
* @param {P & UsersShowParameter} params
* @returns {Promise<AxiosResponse<UsersResponse<"show", P>>>}
*
* @example
* const { data } = await sdk.users.show({ id: "user-abc123" });
* console.log(data.attributes.profile.displayName);
* console.log(data.attributes.profile.bio);
*/
show<P extends UsersShowParameter>(params: P): Promise<AxiosResponse<UsersResponse<"show", P, {
expand: true;
}>>>;
}
export default Users;