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/$%7Bart_info.art.src%7D?q=api&page=1240&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 19823 results for "api"(7984ms)

getPolicyREADME.md2 matches

@fabiofurlano•Updated 2 months ago
1Returns a simple privacy policy for the GPT Memory API.
2
3Examples of input:
4- `apiName`: `Memory API`
5- `contactEmail`: `some@email.com`
6- `lastUpdated`: `2023-11-28`

getPolicymain.tsx10 matches

@fabiofurlano•Updated 2 months ago
2import { markdownToHtml } from "https://esm.town/v/xkonti/markdownToHtml";
3
4export const getPolicy = (apiName: string, contactEmail: string, lastUpdated: string) => {
5 if (apiName == null || apiName === "") apiName = "Memory API";
6 if (contactEmail == null || contactEmail === "") throw new Error("Contact email must be specified");
7 if (lastUpdated == null || lastUpdated === "") throw new Error("The last updated date must be specified");
8 const body = markdownToHtml(
9 `# ${apiName} Privacy Policy
10Last Updated: ${lastUpdated}
11
12## 1. Introduction
13Welcome to ${apiName}. This privacy policy outlines our practices regarding the collection, use, and sharing of information through ${apiName}.
14
15## 2. Data Collection and Use
16${apiName} allows users to store, retrieve, list, and delete data. The data stored can be of any type as inputted by the user. We do not restrict or control the content of the data stored. ${apiName} serves as a public database accessible to anyone with an API key.
17
18## 3. User Restrictions
19${apiName} does not impose age or user restrictions. However, users are advised to consider the sensitivity of the information they share.
20
21## 4. Global Use
22Our API is accessible globally. Users from all regions can store and access data on ${apiName}.
23
24## 5. Data Management
25Given the nature of ${apiName}, there are no user accounts or user identification measures. The API operates like a public database where data can be added, viewed, and deleted by any user. Users should be aware that any data they input can be accessed, modified, or deleted by other users.
26
27## 6. Data Security
28${apiName} is protected by an API key; beyond this, there is no specific data security measure in place. Users should not store sensitive, personal, or confidential information using ${apiName}. We assume no responsibility for the security of the data stored.
29
30## 7. Third-Party Involvement
31The API code is run and data is stored by val.town. They act as a third-party service provider for ${apiName}.
32
33## 8. Changes to This Policy

FixItWandworkorders.ts4 matches

@wolf•Updated 2 months ago
10}> {
11 try {
12 const response = await fetch("/api/workorders/user", {
13 credentials: "include",
14 });
38}> {
39 try {
40 const response = await fetch(`/api/workorders/user/${id}/send`, {
41 method: "POST",
42 credentials: "include",
66}> {
67 try {
68 const response = await fetch(`/api/workorders/user/${id}/complete`, {
69 method: "POST",
70 credentials: "include",
94}> {
95 try {
96 const response = await fetch(`/api/workorders/user/${id}`, {
97 method: "DELETE",
98 credentials: "include",

magicalOrangeLobstermain.tsx25 matches

@dcm31•Updated 2 months ago
73 const menuRef = useRef(null);
74 const isPublic = blob.key.startsWith("__public/");
75 const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
76
77 useEffect(() => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
557 onClick={() =>
558 copyToClipboard(
559 `${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560 )}
561 className="text-blue-400 hover:text-blue-300 text-sm"
580 >
581 <img
582 src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583 alt="Blob content"
584 className="max-w-full h-auto"
660
661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663 const key = `__public/${c.req.param("id")}`;
664 const { blob } = await import("https://esm.town/v/std/blob");
778};
779
780app.get("/api/blobs", checkAuth, async (c) => {
781 const prefix = c.req.query("prefix") || "";
782 const limit = parseInt(c.req.query("limit") || "20", 10);
787});
788
789app.get("/api/blob", checkAuth, async (c) => {
790 const key = c.req.query("key");
791 if (!key) return c.text("Missing key parameter", 400);
795});
796
797app.put("/api/blob", checkAuth, async (c) => {
798 const key = c.req.query("key");
799 if (!key) return c.text("Missing key parameter", 400);
804});
805
806app.delete("/api/blob", checkAuth, async (c) => {
807 const key = c.req.query("key");
808 if (!key) return c.text("Missing key parameter", 400);
812});
813
814app.post("/api/blob", checkAuth, async (c) => {
815 const { file, key } = await c.req.parseBody();
816 if (!file || !key) return c.text("Missing file or key", 400);

compassionateTomatoNarwhalmain.tsx1 match

@Anjali_Suresh27•Updated 2 months ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

sbc_register_fixed_partner_ladder_eventmain.tsx2 matches

@xxxjjj•Updated 2 months ago
1// SBC Ladder Client for Val Town
2// Requires fetch API which is available in Val Town environment
3
4const BASE_URL = "https://sbc-ladder.kgignatyev.com/badminton/api/v1";
5
6class SBCLadderClient {

FixItWandHome.tsx5 matches

@wolf•Updated 2 months ago
3import { useAuth } from "../hooks/useAuth.ts";
4import { Link } from "https://esm.sh/react-router-dom@7.4.1?deps=react@19.0.0,react-dom@19.0.0";
5import * as api from "../crud/workorders.ts";
6import { WorkOrder } from "../../backend/db/schemas_http.ts";
7import { GenerateWorkorderForm } from "../components/WorkOrders/GenerateWorkOrderForm/GenerateWorkOrderForm.tsx";
19
20 setLoading(true);
21 const result = await api.fetchWorkorders();
22 setWorkorders(result.workorders);
23 setError(result.error);
39 // Handle sending a workorder
40 const handleSendWorkorder = async (id: string) => {
41 const result = await api.sendWorkorder(id);
42 if (result.error) {
43 setError(result.error);
49 // Handle completing a workorder
50 const handleCompleteWorkorder = async (id: string) => {
51 const result = await api.completeWorkorder(id);
52 if (result.error) {
53 setError(result.error);
59 // Handle deleting a workorder
60 const handleDeleteWorkorder = async (id: string) => {
61 const result = await api.deleteWorkorder(id);
62 if (result.error) {
63 setError(result.error);

FixItWandconsts.tsx1 match

@wolf•Updated 2 months ago
4export const MAGIC_LINK_SECRET = Deno.env.get("MAGIC_LINK_SECRET")!;
5export const JWT_SECRET = Deno.env.get("JWT_SECRET")!;
6export const VAL_TOWN_API_KEY = Deno.env.get("valtown")!;
7
8export const EmailTemplate = ({ magicLink }) => (

FixItWandmod.ts1 match

@wolf•Updated 2 months ago
1export { apiRoute } from "./api.ts";
2export { authRoute } from "./auth.tsx";
3export { workorderRoute } from "./workorder.ts";

methodicalTanFishmain.tsx1 match

@methrubandara•Updated 2 months ago
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();

hunting_api1 file match

@mundal•Updated 15 hours ago
Plantfo

Plantfo8 file matches

@Llad•Updated 2 days ago
API for AI plant info
Kapil01
apiv1