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=185&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 15470 results for "api"(1089ms)

figma-variables-managernotion.ts9 matches

@humblโ€ขUpdated 1 week ago
1// Notion API integration
2
3import { VariableData, MappingConfig } from '../utils/constants';
9export async function syncVariablesFromNotion(
10 databaseId: string,
11 apiKey: string,
12 mappingConfig?: MappingConfig
13): Promise<VariableData[]> {
14 // Validate inputs
15 if (!databaseId) throw new Error('Notion database ID is required');
16 if (!apiKey) throw new Error('Notion API key is required');
17
18 try {
19 // Query the Notion database
20 const data = await queryNotionDatabase(databaseId, apiKey);
21
22 // Use default mapping if not provided
34 * Query a Notion database
35 */
36async function queryNotionDatabase(databaseId: string, apiKey: string) {
37 const response = await fetch(`https://api.notion.com/v1/databases/${databaseId}/query`, {
38 method: 'POST',
39 headers: {
40 'Authorization': `Bearer ${apiKey}`,
41 'Notion-Version': '2022-06-28',
42 'Content-Type': 'application/json'
55 if (!response.ok) {
56 const errorText = await response.text();
57 throw new Error(`Notion API error (${response.status}): ${errorText}`);
58 }
59
63
64/**
65 * Process Notion API results into a more usable format
66 */
67function processNotionResults(results: any[]) {

figma-variables-managerconstants.ts4 matches

@humblโ€ขUpdated 1 week ago
3export enum StorageKeys {
4 CONFIG = 'variables-sync-config',
5 NOTION_API_KEY = 'notion-api-key',
6 CODA_API_KEY = 'coda-api-key'
7}
8
40
41export interface NotionConfig {
42 apiKey: string;
43 databaseId: string;
44 mappingConfig: MappingConfig;
46
47export interface CodaConfig {
48 apiKey: string;
49 docId: string;
50 tableId: string;

figma-variables-managermain.ts4 matches

@humblโ€ขUpdated 1 week ago
1// This is the main entry point for the Figma plugin
2
3import { syncVariablesFromNotion } from './api/notion';
4import { syncVariablesFromCoda } from './api/coda';
5import { applyVariablesToFigma, getExistingVariables } from './utils/variables';
6import { StorageKeys } from './utils/constants';
31 try {
32 figma.notify('Syncing variables from Notion...');
33 const variables = await syncVariablesFromNotion(msg.databaseId, msg.apiKey);
34 await applyVariablesToFigma(variables, msg.mappingConfig);
35 figma.notify('Variables synced successfully!');
62 try {
63 figma.notify('Syncing variables from Coda...');
64 const variables = await syncVariablesFromCoda(msg.docId, msg.tableId, msg.apiKey);
65 await applyVariablesToFigma(variables, msg.mappingConfig);
66 figma.notify('Variables synced successfully!');

figma-variables-managermanifest.json4 matches

@humblโ€ขUpdated 1 week ago
2 "name": "Variables Sync",
3 "id": "variables-sync-plugin",
4 "api": "1.0.0",
5 "main": "code/main.js",
6 "ui": "ui/ui.html",
9 "allowedDomains": [
10 "notion.so",
11 "api.notion.com",
12 "coda.io",
13 "apis.coda.io"
14 ],
15 "reasoning": "This plugin needs to connect to Notion and Coda APIs to fetch variable data"
16 },
17 "permissions": [

figma-variables-managerREADME.md4 matches

@humblโ€ขUpdated 1 week ago
20โ”œโ”€โ”€ code/
21โ”‚ โ”œโ”€โ”€ main.ts # Plugin main code
22โ”‚ โ”œโ”€โ”€ api/
23โ”‚ โ”‚ โ”œโ”€โ”€ notion.ts # Notion API integration
24โ”‚ โ”‚ โ””โ”€โ”€ coda.ts # Coda API integration
25โ”‚ โ””โ”€โ”€ utils/
26โ”‚ โ”œโ”€โ”€ variables.ts # Figma variables utilities
45## Development
46
47This plugin uses TypeScript and follows the Figma plugin API guidelines.
48
49## License

OpenTownieuseUser.tsx1 match

@h0aโ€ขUpdated 1 week ago
1import { useState, useEffect } from "react";
2
3const USER_ENDPOINT = "/api/user";
4
5export function useUser() {

OpenTownieuser-summary.ts1 match

@h0aโ€ขUpdated 1 week ago
20 SUM(num_images) as total_images
21 FROM ${USAGE_TABLE}
22 WHERE our_api_token = 1
23 GROUP BY user_id, username
24 ORDER BY total_price DESC

OpenTownieuseProject.tsx2 matches

@h0aโ€ขUpdated 1 week ago
1import { useState, useEffect } from "react";
2
3const PROJECT_ENDPOINT = "/api/project";
4const FILES_ENDPOINT = "/api/project-files";
5
6export function useProject(projectId: string, branchId?: string) {

OpenTownieuseProjects.tsx1 match

@h0aโ€ขUpdated 1 week ago
1import { useState, useEffect } from "react";
2
3const ENDPOINT = "/api/projects-loader";
4
5export function useProjects() {

OpenTownieuseCreateProject.tsx1 match

@h0aโ€ขUpdated 1 week ago
1import { useState, useEffect } from "react";
2
3const ENDPOINT = "/api/create-project";
4
5export function useCreateProject() {

HN-fetch-call2 file matches

@ImGqbโ€ขUpdated 2 days ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiโ€ขUpdated 3 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1