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%22Optional%20title%22?q=api&page=1018&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 12539 results for "api"(1703ms)

fetchPaginatedDataREADME.md2 matches

@nbbaierUpdated 1 year ago
1# Fetch Paginated Data
2
3This val exports a function that loops through paginated API responses and returns the combined data as an array. It expects pagination with `next` and there to be a `data` property in the API response. This conforms to the Val Town API, so this function is useful when fetching paginated Val Town API responses for creating custom folders in [pomdtr's vscode extension](https://github.com/pomdtr/valtown-vscode).
4
5Usage:
7```ts
8const id = <vt user id>
9await fetchPaginatedData(`https://api.val.town/v1/users/${id}/vals`, {
10 headers: { Authorization: `Bearer ${Deno.env.get("valtown")}` },
11});

auth_middlewareREADME.md2 matches

@pomdtrUpdated 1 year ago
11Set an `AUTH_SECRET_KEY` env variable (used to sign/verify jwt tokens) to a [random string](https://randomkeygen.com/).
12
13Then use an API token to authenticate.
14
15```typescript
25See @pomdtr/test_auth for an example
26
27⚠️ Make sure to only provides your api token to vals you trust (i.e. your own), as it gives access to your whole account.

qstashmain.tsx1 match

@saolsenUpdated 1 year ago
4 SpanStatusCode,
5 trace,
6} from "https://cdn.skypack.dev/@opentelemetry/api";
7import { Client, Receiver } from "npm:@upstash/qstash";
8

redismain.tsx1 match

@saolsenUpdated 1 year ago
1import { SpanStatusCode } from "https://cdn.skypack.dev/@opentelemetry/api";
2import { Redis } from "https://deno.land/x/upstash_redis@v1.14.0/mod.ts";
3

tracingmain.tsx6 matches

@saolsenUpdated 1 year ago
1import "https://deno.land/x/xhr@0.1.0/mod.ts";
2import "node:async_hooks";
3import { context, propagation, SpanStatusCode, trace } from "https://cdn.skypack.dev/@opentelemetry/api";
4import { OTLPTraceExporter } from "https://cdn.skypack.dev/@opentelemetry/exporter-trace-otlp-http";
5import { B3Propagator } from "https://cdn.skypack.dev/@opentelemetry/propagator-b3";
32 }
33
34 // Send traces to honeycomb if HONEYCOMB_API_KEY key is set.
35 const honeycomb_api_key = Deno.env.get("HONEYCOMB_API_KEY");
36 if (honeycomb_api_key) {
37 provider.addSpanProcessor(
38 new SimpleSpanProcessor(
39 new OTLPTraceExporter({
40 url: "https://api.honeycomb.io/v1/traces",
41 headers: {
42 "x-honeycomb-team": honeycomb_api_key,
43 },
44 }),

connect4_sitemain.tsx1 match

@saolsenUpdated 1 year ago
2import { track } from "https://esm.town/v/saolsen/plausible?v=3";
3import { init, traced_fetch, traced_handler, traced, get_tracer } from "https://esm.town/v/saolsen/tracing?v=135";
4import { trace } from "npm:@opentelemetry/api";
5init("connect4_site");
6const tracer = get_tracer("connect4_site");

engraft_wikipediamain.tsx1 match

@joshuahhhUpdated 1 year ago
17 "urlProgram": {
18 "toolName": "slot",
19 "code": "\"https://en.wikipedia.org/w/api.php\"",
20 "modeName": "code",
21 "defaultCode": "\"https://httpbin.org/get\"",
1import process from "node:process";
2import { TodoistApi } from "npm:@doist/todoist-api-typescript";
3import { Client } from "npm:@notionhq/client";
4
5const TODOIST_API_KEY = process.env.TODOIST_API_KEY;
6const todoistapi = new TodoistApi(TODOIST_API_KEY);
7const NOTION_API_KEY = process.env.NOTION_API_KEY;
8const notion = new Client({
9 auth: NOTION_API_KEY,
10});
11
121
122export default async function(interval: Interval) {
123 var tasks = await todoistapi.getTasks({
124 projectId: add_to_notion_todoist_project_id,
125 });
136 addPageToNotionDatabse(mappedNotionId, task.content);
137 }
138 todoistapi.deleteTask(task.id);
139 }
140 }
4
5export default async function(interval: Interval) {
6 const NOTION_API_KEY = process.env.NOTION_API_KEY;
7 const PAPERPILE_DB_ID = "DB_ID_GOES_HERE";
8
9 if (!NOTION_API_KEY || !PAPERPILE_DB_ID) {
10 throw new Error("Please fill in your API key and database ID");
11 }
12 let dont_update = [];
13
14 const notion = new Client({ auth: NOTION_API_KEY });
15
16 const databaseId = PAPERPILE_DB_ID;
51
52 const j = await fetch(
53 `https://api.semanticscholar.org/graph/v1/paper/search?query=${
54 encodeURIComponent(
55 semscholar_query,
92
93 if (doi_to_add) {
94 // const bib = await fetch('https://api.paperpile.com/api/public/convert', {
95 // method: 'POST',
96 // headers: {
151 let tldr = null;
152 const tl_f = await fetch(
153 `https://api.semanticscholar.org/graph/v1/paper/${encodeURIComponent(sem_scholar_ppid)}?fields=${
154 encodeURIComponent("tldr")
155 }`,

git_syncmain.tsx11 matches

@saolsenUpdated 1 year ago
4// Note: this will not run on val town. You need to run it locally with deno.
5// * Install Deno: https://docs.deno.com/runtime/manual/getting_started/installation
6// * Set your val.town api key environment variable. https://www.val.town/settings/api
7// * `export valtown="abcdefgh-ijkl-mnop-qrst-uvwxyz123456"`
8// * Create a git repo to sync to.
71 let next_page:
72 | string
73 | undefined = `https://api.val.town/v1/users/${me.id}/vals`;
74 while (next_page) {
75 const [_, result] = await valtown(next_page);
97 for (let v = 1; v <= val.version; v++) {
98 const [_, result] = await valtown(
99 `https://api.val.town/v1/vals/${val.id}/versions/${v}`,
100 );
101 if (result !== null) {
131
132export default async function main() {
133 // check for api key
134 const api_key = Deno.env.get("valtown");
135 if (!api_key) {
136 console.error(
137 "Set your val.town api key as an enviroment variable.\n"
138 + ` $ export valtown="abcdefgh-ijkl-mnop-qrst-uvwxyz123456"`,
139 );
149 }
150
151 if (!api_key || !git_repo) {
152 Deno.exit(1);
153 }
178 }
179
180 // check the api key
181 const [status, result] = await valtown("https://api.val.town/v1/me");
182 if (status != 200) {
183 console.error("Invalid API key.");
184 Deno.exit(1);
185 }

vapi-minutes-db2 file matches

@henrywilliamsUpdated 11 hours ago

social_data_api_project3 file matches

@tsuchi_yaUpdated 3 days ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration