UNPKG

@qite/tide-client

Version:
46 lines (40 loc) 1.02 kB
import { TideClientConfig } from "../types"; import { get } from "./api"; const ENDPOINT = "/api/web/file"; const ENDPOINT_FEED = `${ENDPOINT}/feed`; /** * api/web/file/feed * fetch a xml from blob feed. * @param config * @param slug * @param signal * @returns OK if succeeded. */ export const feedXml = ( config: TideClientConfig, request: string, signal?: AbortSignal ): Promise<Response> => { const url = `${config.host}${ENDPOINT_FEED}/${request}`; const apiKey = config.apiKey; return get(url, apiKey, config.token, signal); }; /** * api/web/file/feed * fetch a xml from blob feed in subfolder. * @param config * @param slug * @param folder * @param signal * @returns OK if succeeded. */ export const feedXmlFolder = ( config: TideClientConfig, slug: string, folder: string, signal?: AbortSignal ): Promise<Response> => { const url = `${config.host}${ENDPOINT_FEED}/${slug}/${folder}`; const apiKey = config.apiKey; return get(url, apiKey, config.token, signal); };