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/image-url.jpg%20%22Image%20title%22?q=api&page=1005&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 12646 results for "api"(1114ms)

sqlite_docsmain.tsx3 matches

@andreterron•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

blob_docsmain.tsx5 matches

@andreterron•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { ValTownBlobError } from "https://esm.town/v/std/ValTownBlobError";
3import { ValTownBlobNotFoundError } from "https://esm.town/v/std/ValTownBlobNotFoundError";
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {

awesomeREADME.md2 matches

@pomdtr•Updated 1 year ago
40- @pomdtr/test_explorer
41
42### Api
43
44- @pomdtr/api
45- @pomdtr/trpc
46

sqlite_adminREADME.md1 match

@robsimmons•Updated 1 year ago
9To use it on your own Val Town SQLite database, [fork it](https://www.val.town/v/stevekrouse/sqlite_admin/fork) to your account.
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).

valshotmain.tsx2 matches

@burningion•Updated 1 year ago
22
23export async function createScreenshot(code: string, theme: string = "dark-plus"): Promise<URL> {
24 const apiUrl = "https://sourcecodeshots.com/api/image/permalink";
25 const { url } = await ky.post(apiUrl, {
26 json: {
27 code,

aqiREADME.md1 match

@burningion•Updated 1 year ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

weatherGPTREADME.md1 match

@seflless•Updated 1 year ago
1If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
2
3

love_letterREADME.md7 matches

@pomdtr•Updated 1 year ago
24In any other platform, I would have just given up and moved on. But Val Town is different. I was confident that I could address this issue in userspace, without having to wait for the platform to implement it.
25
26Val Town allows you to run a val on a cron schedule, so I wrote a val that would fetch all the vals from the API, and store them as a sqlite table (did I mention that every user get it's own sqlite database ?).
27
28```ts
36 await options.sqlite.execute(createQuery);
37
38 let url = "https://api.val.town/v1/search/vals?query=%20&limit=100";
39
40 // fetch all vals, and store them in the sqlite table
70There was still a challenge to overcome: the table was part of my account database, and I didn't want to give everyone access to it (there are some sensitive tables in there).
71
72One way to solve this issue would be to publish a stripped-down api that only allows a few predefined queries. But that would be boring, and I wanted to give users the full power of SQL.
73
74So I decided to isolate the val table in a separate account. There is a neat trick to achieve this on val.town: each val get's it own email address, and email sent to vals can be forwarded to your own email address.
96## Publishing the Table
97
98The val.town stdlib provides a neat `rpc` function that provides a simple way to expose a function as an API. So I decided to write a simple val that would run a query on the table, and return the result.
99
100```ts
123```
124
125Of course I don't expect the average val.town user to use shell commands to run queries, so I also built an [helper val](https://val.town/v/sqlite/db) to interact with the API, allowing users to run queries from their own vals.
126
127```ts
133```
134
135I've seen some really cool vals built on top of this API. Someone even wrote down [a guide](https://gist.github.com/tarasglek/076879bd06460e223bf8366031cf4c88) to help users interact with it from the command-line!
136
137I hope that someone will build an search UI to interact with it at some point, but in the meantime, you can use a community-contributed [sqlite web interface](https://sqlite-explorer.web.val.run) to run queries on top of the `vals` table.
139## Val.town as a code-taking app
140
141As I've tried to show, having both a runtime, an editor and an API on the same platform is quite a magic formula. It's probably why val.town resonates so much with me.
142
143Using CodeSandbox, Stackblitz, Repl.it, Gitpod, Github Codespaces or Gitpod feels pretty much the same, everything still revolves around the same concept of a project/repository. They feel uninspired somehow, trying to replicate the desktop IDE experience in the browser, instead of embracing the new possibilities that the web platform offers.

pushovermain.tsx2 matches

@pranjaldotdev•Updated 1 year ago
2
3// Send a pushover message.
4// token, user, and other opts are as specified at https://pushover.net/api
5export default async function pushover({
6 token,
16 url: string;
17}) {
18 return await fetch("https://api.pushover.net/1/messages.json", {
19 method: "POST",
20 headers: {

pollerREADME.md1 match

@pranjaldotdev•Updated 1 year ago
18- *scraper* Goes to bytes.dev and scrapes latest published newsletter
19- *inserter* Insert it to SQLite if this newsletter already not exists
20- *notifier* Uses Pushover API to send ios mobile notifications
21
22### Pushover notifications

vapi-minutes-db1 file match

@henrywilliams•Updated 9 hours ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 11 hours ago
api
aquapi