Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$1?q=api&page=37&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 18265 results for "api"(1115ms)

sendNotificationREADME.md1 match

@gwoods22โ€ขUpdated 2 days ago
1# Push Notification Sender
2
3Val that can be referenced in other vals to send notifications to a specific segment using [OneSignal's REST API](https://documentation.onesignal.com/reference/create-notification)
4
5This is really handy if you want to send push notifications to your phone without building a native app! I built a barebones React PWA that asks for a password then loads the OneSignal Web SDK that I deployed to [Netlify](https://www.netlify.com/) for free. OneSignal has [easy to follow docs](https://documentation.onesignal.com/docs/web-sdk-setup) so you can build this functionality into a React, Angular, Vue app or even Wordpress! Then [install the PWA](https://www.bitcot.com/how-to-install-a-pwa-to-your-device/) on your platform of choice and you're off to the races!

blueskyAlertTemplatemain.tsx2 matches

@charmaineโ€ขUpdated 2 days ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2import { AtpAgent } from "npm:@atproto/api@0.13.15";
3import pMap from "npm:p-map";
4
6
7const agent = new AtpAgent({
8 service: "https://public.api.bsky.app/",
9 // fetch, ideally we'd use our @std/fetch proxy here but that doesn't work and I don't know why
10});

blueskyAlertmain.tsx3 matches

@charmaineโ€ขUpdated 2 days ago
1import { AtpAgent } from "npm:@atproto/api@0.13.15";
2import pMap from "npm:p-map";
3
5
6const agent = new AtpAgent({
7 service: "https://public.api.bsky.app/",
8});
9
37 if (!response.ok) {
38 throw new Error(
39 `Slack API error: ${response.status} ${response.statusText}`,
40 );
41 }
Discord-to-Linear

Discord-to-LinearREADME.md3 matches

@charmaineโ€ขUpdated 2 days ago
33 (right-click channel โ†’ Copy ID)
34 - Example: `1327384540187983926,1327384540187983927`
35- `LINEAR_API_KEY`: Your Linear API key
36 - For Linear Teams accounts, you need API key permissions from a workspace
37 admin.
38 - Members can create personal API keys from Settings โ†’ Account โ†’ Security &
39 Access.
40- `LINEAR_TEAM_ID`: Your Linear team UUID, this is NOT the 3 letter

linearStandup2main.tsx9 matches

@charmaineโ€ขUpdated 2 days ago
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
61 console.error("LINEAR_API_KEY not found in environment variables");
62 Deno.exit(1);
63 }
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
70 "Content-Type": "application/json",
71 Authorization: apiKey,
72 },
73 body: JSON.stringify({
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
99 "Content-Type": "application/json",
100 Authorization: apiKey,
101 },
102 body: JSON.stringify({
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {
Discord-to-Linear

Discord-to-Linearmain.tsx3 matches

@charmaineโ€ขUpdated 2 days ago
1import { blob } from "https://esm.town/v/std/blob";
2import { CONFIG } from "./backend/config.tsx";
3import { DiscordAPI } from "./backend/discord.tsx";
4import { LinearSDK } from "./backend/linear.tsx";
5
24
25 // Initialize services
26 const discord = new DiscordAPI();
27 const linear = new LinearSDK();
28
45 */
46async function processChannelReactions(
47 discord: DiscordAPI,
48 linear: LinearSDK,
49 serverId: string,

subcurrentShuffle2index.ts2 matches

@ashryanioโ€ขUpdated 2 days ago
58}
59
60// API endpoint to get a random post
61app.get("/api/random-post", async (c) => {
62 try {
63 // First, let's try to find the RSS feed URL

subcurrentShuffle2README.md1 match

@ashryanioโ€ขUpdated 2 days ago
5## Structure
6
7- `backend/` - Hono API server
8 - `index.ts` - Main entry point with RSS fetching and serving
9- `frontend/` - React UI

asurareleasesbotsender.ts11 matches

@asurgiftโ€ขUpdated 2 days ago
260}
261
262/*โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 8 โ–ธ Scraping Logic โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€*/
263function buildChapterObject(
264 $: cheerio.CheerioAPI,
265 chapterLinkElement: cheerio.Element,
266 seriesTitle: string,
301
302async function scrapeMainPageForChapterEvents(): Promise<ChapterEventInfo[]> {
303 log("Scraping main page for chapter events:", BASE_URL);
304 const chapterEvents: ChapterEventInfo[] = [];
305 try {
439 seriesPageUrl: string,
440): Promise<Pick<ChapterEventInfo, "definitiveSeriesTitle" | "definitiveSeriesImage" | "synopsis">> {
441 log("Scraping series page for details:", seriesPageUrl);
442 try {
443 const { data } = await httpClient.get(seriesPageUrl, { responseType: "text" });
547 log(`=== Multi-Event Announcer (Ch1, Season Start/End) to ${PRIMARY_CHAT_ID} then ${SECONDARY_CHAT_ID} ===`);
548 try {
549 await bot.api.getMe();
550 log("Bot token validated.");
551 }
650 log(`Announcing to PRIMARY (${PRIMARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
651 if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
652 await bot.api.sendPhoto(PRIMARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
653 } else {
654 await bot.api.sendMessage(PRIMARY_CHAT_ID, messageContent, {
655 parse_mode: "HTML",
656 disable_web_page_preview: false,
664 if (BOT_OWNER_ID) {
665 try {
666 await bot.api.sendMessage(
667 BOT_OWNER_ID,
668 `PRIMARY SEND FAIL: ${event.eventType} for ${nameOfManhwa}.\nError: ${e.message.substring(0, 300)}`,
679 log(`Reposting to SECONDARY (${SECONDARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
680 if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
681 await bot.api.sendPhoto(SECONDARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
682 } else {
683 await bot.api.sendMessage(SECONDARY_CHAT_ID, messageContent, {
684 parse_mode: "HTML",
685 disable_web_page_preview: false,
691 if (BOT_OWNER_ID) {
692 try {
693 await bot.api.sendMessage(
694 BOT_OWNER_ID,
695 `SECONDARY REPOST FAIL: ${event.eventType} for ${nameOfManhwa} (Primary was OK).\nError: ${

Discord-to-Lineardiscord.tsx5 matches

@hussufoโ€ขUpdated 2 days ago
1import { CONFIG } from "./config.tsx";
2
3export class DiscordAPI {
4 // Fetch from the Discord API
5 private async discordFetch(endpoint: string): Promise<any> {
6 console.log(Deno.env.get("DISCORD_BOT_TOKEN"));
7 console.log(`https://discord.com/api/v10${endpoint}`);
8 const response = await fetch(`https://discord.com/api/v10${endpoint}`, {
9 headers: { "Authorization": `Bot ${Deno.env.get("DISCORD_BOT_TOKEN")}` },
10 });
11 console.log(response.status);
12 if (!response.ok) {
13 throw new Error(`Discord API error: ${response.status}`);
14 }
15

github-api1 file match

@cricks_unmixed4uโ€ขUpdated 6 hours ago

beeminder-api4 file matches

@cricks_unmixed4uโ€ขUpdated 6 hours ago
snartapi
apiry