226});
227228// --- API Calls ---
229async function fetchIdeas(topic) {
230ideaSelector.innerHTML = '<option>Synthesizing concepts...</option>';
ostpolispambsky.ts1 match
1import { BskyAgent } from "npm:@atproto/api";
23// constants
ostpolispammeteo.ts3 matches
13const ANNEMASSE_LATITUDE = "46.1933";
14const ANNEMASSE_LONGITUDE = "6.2342";
15const METEO_API_VERSION = 1;
16const METEO_API_BASE = `https://api.open-meteo.com/v${METEO_API_VERSION}`;
1718// functions
20export async function getCurrentTemperature(): Promise<number> {
21const resourceUrl =
22`${METEO_API_BASE}/forecast?latitude=47.3769&longitude=8.5417¤t=temperature_2m&timezone=auto`;
23const res = await fetch(resourceUrl);
24validateResponse(res);
formalforgemain.tsx4 matches
47<meta name="viewport" content="width=device-width, initial-scale=1.0">
48<title>The Formal Letter Forge</title>
49<link rel="preconnect" href="https://fonts.googleapis.com">
50<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
51<link href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600&family=Source+Sans+3:wght@400;600;700&display=swap" rel="stylesheet">
52<style>
53:root {
255<script>
256(function() {
257const API_URL = '${sourceUrl}';
258const THEME_KEY = 'formal_forge_theme';
259let commandPaletteItems = [];
422try {
423updateStatus('Initiating Process...', 'Sending context to strategists.');
424const response = await fetch(\`\${API_URL}?action=forge\`, {
425method: 'POST',
426headers: { 'Content-Type': 'application/json' },
github-apiindex.tsx5 matches
8getGitHubIssuesUpdatedSinceLastRun,
9getIssueContentAsMarkdown,
10} from "../api/index.tsx";
11import { createGitHubClient } from "../shared/github-utils.ts";
1255});
5657// API Routes with authentication
58app.get("/api/issues", requireAuth, async (c) => {
59try {
60const repoOwner = c.req.query("owner") || "oguzhanogreden";
79});
8081app.get("/api/issues/:number/content", requireAuth, async c => {
82try {
83const issueNumber = parseInt(c.req.param("number"));
9899// New endpoint with query parameter authentication
100app.get("/api/markdown/:number", async c => {
101try {
102const licenseKey = Deno.env.get("LICENSE_KEY");
ostpolispamutils.ts1 match
1export function validateResponse(res: Response): void {
2if (!res.ok) throw new Error(`api error: ${res.status}: ${res.statusText}`);
3if (res.status < 200 || res.status >= 300)
4throw new Error(`Unexpected status code: ${res.status}: ${res.statusText}`);
github-apiknowledge.md13 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
299## Retrieving GitHub Issue Content as Markdown
300301The new functionality added in the GitHub API library allows developers to fetch a specific issue's content from a GitHub repository and format it in Markdown. This includes both the issue's main description and all comments associated with that issue, with any URLs present in the text also extracted and listed.
302303### Function Overview
328329```tsx
330import { getIssueContentAsMarkdown } from 'https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30'; // Ensure to use the correct version based on the function declaration.
331332async function displayIssueContent() {
358This new functionality streamlines the process of retrieving and displaying GitHub issue content and enhances collaboration and visibility in development environments.
359360# DONE: Next Step 1 - Export a new function from api
361362The new function should return the relevant content of a given issue in markdown format.
ProposalHandler.cursorrules10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
github-apiApp.tsx1 match
53
54try {
55const response = await fetch(`/api/issues?owner=${repoOwner}&repo=${repoName}`, {
56headers: {
57"Authorization": `Bearer ${key || licenseKey}`,
github-apiIssueViewer.tsx1 match
44try {
45const response = await fetch(
46`/api/issues/${issue.number}/content?owner=${repoOwner}&repo=${repoName}`,
47{
48headers: {