UNPKG

@upstart.gg/sdk

Version:

You can test the CLI without recompiling by running:

42 lines (40 loc) 1.18 kB
import { UnauthorizedError } from "../../../../errors.js"; import { stringifyObjectValues } from "../../../utils.js"; //#region src/shared/datasources/external/facebook/posts/fetcher.ts const fetchFacebookPostDatasource = async ({ options, oauth }) => { const params = new URLSearchParams({ ...stringifyObjectValues(options), fields: [ "from", "permalink_url", "name", "description", "caption", "id", "is_hidden", "message", "application", "object_id", "link", "is_published", "properties", "status_type", "story", "type", "actions", "call_to_action", "child_attachments" ].join(","), access_token: oauth.config.accessToken }); const response = await fetch(`https://graph.facebook.com/me/posts?${params}`); if (!response.ok) { if (response.status === 401) throw new UnauthorizedError(`fetchFacebookPostDatasource Error: Unauthorized.`); throw new Error(`fetchFacebookPostDatasource Error: Response status: ${response.status}`); } return await response.json(); }; var fetcher_default = fetchFacebookPostDatasource; //#endregion export { fetcher_default as default }; //# sourceMappingURL=fetcher.js.map