export type CreateApiV3MeFollowingsArgs = {body: BodyInit}; export type CreateApiV3MeFollowingsOptions = {baseUrl?: string | undefined, Token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Follows a new user. * * POST /v3/me/followings */ export const createApiV3MeFollowings = async (args: CreateApiV3MeFollowingsArgs, options?: CreateApiV3MeFollowingsOptions) => { const {baseUrl = "https://api.sketchfab.com", fetch: fetchFn = fetch, Token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Token !== undefined) headers.set("Authorization", Token) const url = `${baseUrl.replace(/\/+$/, '')}/v3/me/followings${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };