@upstart.gg/sdk
Version:
You can test the CLI without recompiling by running:
24 lines (22 loc) • 881 B
JavaScript
import { UnauthorizedError } from "../../../../errors.js";
import { stringifyObjectValues } from "../../../utils.js";
//#region src/shared/datasources/external/youtube/list/fetcher.ts
const fetchYoutubeList = async ({ options, oauth }) => {
const url = `https://www.googleapis.com/youtube/v3/search?${new URLSearchParams({
...stringifyObjectValues(options),
part: "snippet,id",
type: "video",
videoEmbeddable: "true",
access_token: oauth.config.accessToken
})}`;
const response = await fetch(url);
if (!response.ok) {
if (response.status === 401) throw new UnauthorizedError(`fetchYoutubeList Error: Unauthorized.`);
throw new Error(`fetchYoutubeList Error: Response status: ${response.status}`);
}
return await response.json();
};
var fetcher_default = fetchYoutubeList;
//#endregion
export { fetcher_default as default };
//# sourceMappingURL=fetcher.js.map