3
4/* Search Hacker News via Agolia
5Look for the valid params: https://hn.algolia.com/api */
6export let hnSearch = async ({
7 search_by_date,
17 let cleaned_params = await searchParams(params);
18 let data = await fetchJSON(
19 `http://hn.algolia.com/api/v1/${type}?${cleaned_params}`
20 );
21 if (!data.hits && data.message) {
3export function discordChannel({ botToken, serverId }) {
4 return fetchJSON(
5 `https://discord.com/api/guilds/${serverId}/channels`,
6 {
7 headers: {
1import { spotifyAPI } from "https://esm.town/v/stevekrouse/spotifyAPI";
2
3export let spotifyAddToPlaylist = ({ id, ...params }) => spotifyAPI({
4 endpoint: `playlists/${id}/tracks`,
5 method: 'POST',
3// called by supabase newsletter trigger (defined in sql editor)
4export let addSendGridEmail = ({ token, email, listId }) =>
5 fetchJSON("https://api.sendgrid.com/v3/marketing/contacts", {
6 method: "PUT",
7 headers: {
3export async function getWeatherByCoords(lat, long) {
4 const weather = await fetchJSON(
5 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${long}&hourly=temperature_2m,precipitation_probability&forecast_days=1`,
6 );
7 return weather;
2
3export let meow = fetchJSON(
4 "https://pokeapi.co/api/v2/pokemon/ditto"
5);
2
3export let githubRepos = fetchJSON(
4 "https://api.github.com/users/markthree/repos"
5);
1export function myApi(name) {
2 return "hi " + name;
3}
2
3export let github = fetchJSON(
4 "https://api.github.com/users/markthree"
5);
4 return renderHtml(
5 args,
6 `<form action="https://api.val.town/eval/@joey.untitled_handleForm">
7 Subject <input name="subject" /> <br/>
8 <textarea name="body" placeholder="Enter message body.."></textarea><br/>