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/?q=api&page=529&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 9363 results for "api"(1149ms)

valSessionmain.tsx3 matches

@tmcw•Updated 3 months ago
101 <pre><code class="language-typescript">import { ValSession } from "${rawUrl}";
102
103// Generate a token from your valtown api key.
104const token = await ValSession.new(Deno.env.get("valtown"));
105
127});
128
129type valSessionApi = typeof routes;
130
131const client = hc<valSessionApi>(httpEndpoint);
132
133export class ValSession {

gitHubSyncmain.tsx1 match

@tmcw•Updated 3 months ago
97 const { access_token } = await tokenResponse.json();
98
99 const userResponse = await fetch("https://api.github.com/user", {
100 headers: {
101 "Authorization": `token ${access_token}`,

proudJadeSeahorseREADME.md5 matches

@tmcw•Updated 3 months ago
14and the `excludes` for what you don't want to get notified for.
15
16You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
17
18## 2. Notification
22## Twitter Data & Limitations
23
24The Twitter API has become unusable. This val gets Twitter data via [SocialData](https://socialdata.tools),
25an affordable Twitter scraping API. In order to make this val easy for
26you to fork & use without signing up for another API, I am proxying
27SocialData via @stevekrouse/socialDataProxy. Val Town Pro users can call this proxy
28100 times per day, so be sure not to set this cron to run more than once every 15 min.
29
30If you want to run it more, get your own [SocialData](https://socialdata.tools)
31API token and pay for it directly.

sqlitemain.tsx4 matches

@tmcw•Updated 3 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type ResultSet, type Row, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {
78
79/* Val Town's Turso Proxy returns rows as an array of values
80 * Yet the LibSQL API has a Row type which behave as an array or object,
81 * ie you can access it via numerical index or string
82 */

valiantSalmonWarblermain.tsx1 match

@shouser•Updated 3 months ago
17 <p>
18 We've recently made improvements to Val Town's security by
19 <a href="https://blog.val.town/blog/api-token-scopes" target="_blank" rel="noopener noreferrer">
20 providing granular control over val permissions</a>.
21 As part of the rollout, we updated all vals to a safer set of default permissions.

mediainfoREADME.md1 match

@jamiedubs•Updated 3 months ago
1Fetches details about media files (images, video, audio, etc) using [Mediainfo.js](https://mediainfo.js.org/). e.g. codecs used, duration, file sizes, ID3 tags, etc. Check out https://jamiedubs-mediainfo.web.val.run/ for a little interactive example
2
3Beta! API response not 100% stable, I might move things around still. Especially this `summary` field idea

twitterAlertREADME.md4 matches

@charmaine•Updated 3 months ago
32```
33
34Refer to [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to fine-tune your query.
35
36### 3. Test API call
37Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
38Toggle it back to `true` when you're ready to run this cron job in production.
52
53### 5. NOTE: Usage Limits
54This val uses the SocialData API for Twitter data:
55- **Proxies via Val Town's SocialDataProxy**: Limited to 100 calls/day for [**Val Town Pro users**](https://www.val.town/pricing).
56- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

courteousAzureSquirrelmain.tsx1 match

@charmaine•Updated 3 months ago
8
9const stripe = new Stripe(Deno.env.get("stripe_sk_customer_readonly") as string, {
10 apiVersion: "2020-08-27",
11});
12

diplomaticApricotHeronmain.tsx1 match

@gigmx•Updated 3 months ago
18
19 useEffect(() => {
20 const ws = new WebSocket("wss://pumpportal.fun/api/data");
21
22 ws.onopen = () => {

stripeTriggermain.tsx1 match

@wolf•Updated 3 months ago
17const stripe = new Stripe(
18 Deno.env.get("TEST_STRIPE_SECRET") as string,
19 { apiVersion: "2023-10-16" },
20);
21

daily-advice-app1 file match

@dcm31•Updated 23 hours ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 2 days ago
papimark21
substrate
Substrate is the modular API for fast multi-step AI programs