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=47&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 14808 results for "api"(2397ms)

Waho_Stop_Banmain.tsx2 matches

@wahobd•Updated 2 days ago
480 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
481 <style>
482 @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
483 body {
484 margin: 0;
657 margin: 10px auto;
658 display: block;
659 text-transform: capitalize;
660 }
661 .toggle-additional-fields:hover {

dbssetprofileindex.ts7 matches

@desniland•Updated 2 days ago
22await insertSampleData();
23
24// API routes
25app.route("/api/profile", profile);
26app.route("/api/academics", academics);
27app.route("/api/finances", finances);
28app.route("/api/socials", socials);
29app.route("/api/repository", repository);
30
31// Serve static files
44 const initialData = {
45 student: defaultStudent,
46 apiBase: "" // Since we're serving from the same domain
47 };
48

dbssetprofileindex.html16 matches

@desniland•Updated 2 days ago
67 // Global state
68 let currentStudent = null;
69 let apiBase = '';
70
71 // Initialize the application
74 if (window.__INITIAL_DATA__) {
75 currentStudent = window.__INITIAL_DATA__.student;
76 apiBase = window.__INITIAL_DATA__.apiBase;
77 updateProfileDisplay();
78 } else {
87 async function loadDefaultStudent() {
88 try {
89 const response = await fetch(`${apiBase}/api/profile/admission/2023/CS/3`);
90 const result = await response.json();
91 if (result.success) {
230 // Data loading functions
231 async function loadUnits() {
232 const response = await fetch(`${apiBase}/api/academics/${currentStudent.id}/units`);
233 const result = await response.json();
234
255
256 async function loadExaminations() {
257 const response = await fetch(`${apiBase}/api/academics/${currentStudent.id}/examinations`);
258 const result = await response.json();
259
283
284 async function loadProgress() {
285 const response = await fetch(`${apiBase}/api/academics/${currentStudent.id}/progress`);
286 const result = await response.json();
287
310
311 async function loadFeePayments() {
312 const response = await fetch(`${apiBase}/api/finances/${currentStudent.id}/payments`);
313 const result = await response.json();
314
335
336 async function loadFeeStructure() {
337 const response = await fetch(`${apiBase}/api/finances/${currentStudent.id}/structure`);
338 const result = await response.json();
339
356
357 async function loadFeeBalance() {
358 const response = await fetch(`${apiBase}/api/finances/${currentStudent.id}/balance`);
359 const result = await response.json();
360
377
378 async function loadEvents() {
379 const response = await fetch(`${apiBase}/api/socials/events`);
380 const result = await response.json();
381
403
404 async function loadNews() {
405 const response = await fetch(`${apiBase}/api/socials/news`);
406 const result = await response.json();
407
428
429 async function loadClubs() {
430 const response = await fetch(`${apiBase}/api/socials/clubs`);
431 const result = await response.json();
432
454
455 async function loadProjects() {
456 const response = await fetch(`${apiBase}/api/socials/projects/student/${currentStudent.id}`);
457 const result = await response.json();
458
480
481 async function loadDocuments(type) {
482 const response = await fetch(`${apiBase}/api/repository/${currentStudent.id}/${type}`);
483 const result = await response.json();
484
505
506 async function loadAllDocuments() {
507 const response = await fetch(`${apiBase}/api/repository/${currentStudent.id}/grouped`);
508 const result = await response.json();
509
598
599 try {
600 const response = await fetch(`${apiBase}/api/profile/${currentStudent.id}`, {
601 method: 'PUT',
602 headers: {

dbssetprofilerepository.ts11 matches

@desniland•Updated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getStudentDocuments } from "../database/queries.ts";
3import type { ApiResponse, Document } from "../../shared/types.ts";
4
5const repository = new Hono();
10 const studentId = parseInt(c.req.param("studentId"));
11 if (isNaN(studentId)) {
12 return c.json<ApiResponse<null>>({
13 success: false,
14 error: "Invalid student ID"
18 const documents = await getStudentDocuments(studentId);
19
20 return c.json<ApiResponse<Document[]>>({
21 success: true,
22 data: documents
23 });
24 } catch (error) {
25 return c.json<ApiResponse<null>>({
26 success: false,
27 error: "Internal server error"
37
38 if (isNaN(studentId)) {
39 return c.json<ApiResponse<null>>({
40 success: false,
41 error: "Invalid student ID"
45 const validTypes = ['logbook', 'insurance', 'mentor-letter', 'transcript', 'certificate'];
46 if (!validTypes.includes(type)) {
47 return c.json<ApiResponse<null>>({
48 success: false,
49 error: "Invalid document type"
53 const documents = await getStudentDocuments(studentId, type);
54
55 return c.json<ApiResponse<Document[]>>({
56 success: true,
57 data: documents
58 });
59 } catch (error) {
60 return c.json<ApiResponse<null>>({
61 success: false,
62 error: "Internal server error"
70 const studentId = parseInt(c.req.param("studentId"));
71 if (isNaN(studentId)) {
72 return c.json<ApiResponse<null>>({
73 success: false,
74 error: "Invalid student ID"
87 }, {} as Record<string, Document[]>);
88
89 return c.json<ApiResponse<Record<string, Document[]>>>({
90 success: true,
91 data: grouped
92 });
93 } catch (error) {
94 return c.json<ApiResponse<null>>({
95 success: false,
96 error: "Internal server error"

dbssetprofilesocials.ts15 matches

@desniland•Updated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getEvents, getNews, getClubs, getProjects, getStudentById } from "../database/queries.ts";
3import type { ApiResponse, Event, News, Club, Project } from "../../shared/types.ts";
4
5const socials = new Hono();
11 const events = await getEvents(limit);
12
13 return c.json<ApiResponse<Event[]>>({
14 success: true,
15 data: events
16 });
17 } catch (error) {
18 return c.json<ApiResponse<null>>({
19 success: false,
20 error: "Internal server error"
29 const news = await getNews(limit);
30
31 return c.json<ApiResponse<News[]>>({
32 success: true,
33 data: news
34 });
35 } catch (error) {
36 return c.json<ApiResponse<null>>({
37 success: false,
38 error: "Internal server error"
46 const clubs = await getClubs();
47
48 return c.json<ApiResponse<Club[]>>({
49 success: true,
50 data: clubs
51 });
52 } catch (error) {
53 return c.json<ApiResponse<null>>({
54 success: false,
55 error: "Internal server error"
64 const projects = await getProjects(department);
65
66 return c.json<ApiResponse<Project[]>>({
67 success: true,
68 data: projects
69 });
70 } catch (error) {
71 return c.json<ApiResponse<null>>({
72 success: false,
73 error: "Internal server error"
81 const studentId = parseInt(c.req.param("studentId"));
82 if (isNaN(studentId)) {
83 return c.json<ApiResponse<null>>({
84 success: false,
85 error: "Invalid student ID"
89 const student = await getStudentById(studentId);
90 if (!student) {
91 return c.json<ApiResponse<null>>({
92 success: false,
93 error: "Student not found"
97 const projects = await getProjects(student.department);
98
99 return c.json<ApiResponse<Project[]>>({
100 success: true,
101 data: projects
102 });
103 } catch (error) {
104 return c.json<ApiResponse<null>>({
105 success: false,
106 error: "Internal server error"
121 ]);
122
123 return c.json<ApiResponse<{
124 events: Event[];
125 news: News[];
136 });
137 } catch (error) {
138 return c.json<ApiResponse<null>>({
139 success: false,
140 error: "Internal server error"

dbssetprofilefinances.ts16 matches

@desniland•Updated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getStudentFeePayments, getFeeStructure, getFeeBalance, getStudentById } from "../database/queries.ts";
3import type { ApiResponse, FeePayment, FeeStructure } from "../../shared/types.ts";
4
5const finances = new Hono();
10 const studentId = parseInt(c.req.param("studentId"));
11 if (isNaN(studentId)) {
12 return c.json<ApiResponse<null>>({
13 success: false,
14 error: "Invalid student ID"
17
18 const payments = await getStudentFeePayments(studentId);
19 return c.json<ApiResponse<FeePayment[]>>({
20 success: true,
21 data: payments
22 });
23 } catch (error) {
24 return c.json<ApiResponse<null>>({
25 success: false,
26 error: "Internal server error"
34 const studentId = parseInt(c.req.param("studentId"));
35 if (isNaN(studentId)) {
36 return c.json<ApiResponse<null>>({
37 success: false,
38 error: "Invalid student ID"
42 const student = await getStudentById(studentId);
43 if (!student) {
44 return c.json<ApiResponse<null>>({
45 success: false,
46 error: "Student not found"
52
53 if (!feeStructure) {
54 return c.json<ApiResponse<null>>({
55 success: false,
56 error: "Fee structure not found for this department and year"
58 }
59
60 return c.json<ApiResponse<FeeStructure>>({
61 success: true,
62 data: feeStructure
63 });
64 } catch (error) {
65 return c.json<ApiResponse<null>>({
66 success: false,
67 error: "Internal server error"
75 const studentId = parseInt(c.req.param("studentId"));
76 if (isNaN(studentId)) {
77 return c.json<ApiResponse<null>>({
78 success: false,
79 error: "Invalid student ID"
84 const balance = await getFeeBalance(studentId, year);
85
86 return c.json<ApiResponse<{ balance: number; year: string }>>({
87 success: true,
88 data: { balance, year }
89 });
90 } catch (error) {
91 return c.json<ApiResponse<null>>({
92 success: false,
93 error: "Internal server error"
101 const studentId = parseInt(c.req.param("studentId"));
102 if (isNaN(studentId)) {
103 return c.json<ApiResponse<null>>({
104 success: false,
105 error: "Invalid student ID"
109 const student = await getStudentById(studentId);
110 if (!student) {
111 return c.json<ApiResponse<null>>({
112 success: false,
113 error: "Student not found"
125 const totalPaid = payments.reduce((sum, payment) => sum + payment.amount, 0);
126
127 return c.json<ApiResponse<{
128 payments: FeePayment[];
129 feeStructure: FeeStructure | null;
142 });
143 } catch (error) {
144 return c.json<ApiResponse<null>>({
145 success: false,
146 error: "Internal server error"

dbssetprofileacademics.ts13 matches

@desniland•Updated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getStudentUnits, getStudentExaminations, getAcademicProgress } from "../database/queries.ts";
3import type { ApiResponse, Unit, Examination } from "../../shared/types.ts";
4
5const academics = new Hono();
10 const studentId = parseInt(c.req.param("studentId"));
11 if (isNaN(studentId)) {
12 return c.json<ApiResponse<null>>({
13 success: false,
14 error: "Invalid student ID"
17
18 const units = await getStudentUnits(studentId);
19 return c.json<ApiResponse<Unit[]>>({
20 success: true,
21 data: units
22 });
23 } catch (error) {
24 return c.json<ApiResponse<null>>({
25 success: false,
26 error: "Internal server error"
34 const studentId = parseInt(c.req.param("studentId"));
35 if (isNaN(studentId)) {
36 return c.json<ApiResponse<null>>({
37 success: false,
38 error: "Invalid student ID"
41
42 const examinations = await getStudentExaminations(studentId);
43 return c.json<ApiResponse<Examination[]>>({
44 success: true,
45 data: examinations
46 });
47 } catch (error) {
48 return c.json<ApiResponse<null>>({
49 success: false,
50 error: "Internal server error"
58 const studentId = parseInt(c.req.param("studentId"));
59 if (isNaN(studentId)) {
60 return c.json<ApiResponse<null>>({
61 success: false,
62 error: "Invalid student ID"
65
66 const progress = await getAcademicProgress(studentId);
67 return c.json<ApiResponse<typeof progress>>({
68 success: true,
69 data: progress
70 });
71 } catch (error) {
72 return c.json<ApiResponse<null>>({
73 success: false,
74 error: "Internal server error"
82 const studentId = parseInt(c.req.param("studentId"));
83 if (isNaN(studentId)) {
84 return c.json<ApiResponse<null>>({
85 success: false,
86 error: "Invalid student ID"
94 ]);
95
96 return c.json<ApiResponse<{
97 units: Unit[];
98 examinations: Examination[];
107 });
108 } catch (error) {
109 return c.json<ApiResponse<null>>({
110 success: false,
111 error: "Internal server error"

dbssetprofileprofile.ts13 matches

@desniland•Updated 2 days ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getStudentById, getStudentByAdmission, updateStudent } from "../database/queries.ts";
3import type { ApiResponse, Student } from "../../shared/types.ts";
4
5const profile = new Hono();
10 const id = parseInt(c.req.param("id"));
11 if (isNaN(id)) {
12 return c.json<ApiResponse<null>>({
13 success: false,
14 error: "Invalid student ID"
18 const student = await getStudentById(id);
19 if (!student) {
20 return c.json<ApiResponse<null>>({
21 success: false,
22 error: "Student not found"
24 }
25
26 return c.json<ApiResponse<Student>>({
27 success: true,
28 data: student
29 });
30 } catch (error) {
31 return c.json<ApiResponse<null>>({
32 success: false,
33 error: "Internal server error"
43
44 if (!student) {
45 return c.json<ApiResponse<null>>({
46 success: false,
47 error: "Student not found"
49 }
50
51 return c.json<ApiResponse<Student>>({
52 success: true,
53 data: student
54 });
55 } catch (error) {
56 return c.json<ApiResponse<null>>({
57 success: false,
58 error: "Internal server error"
66 const id = parseInt(c.req.param("id"));
67 if (isNaN(id)) {
68 return c.json<ApiResponse<null>>({
69 success: false,
70 error: "Invalid student ID"
76 // Validate required fields if they're being updated
77 if (updates.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(updates.email)) {
78 return c.json<ApiResponse<null>>({
79 success: false,
80 error: "Invalid email format"
84 const success = await updateStudent(id, updates);
85 if (!success) {
86 return c.json<ApiResponse<null>>({
87 success: false,
88 error: "Failed to update student"
91
92 const updatedStudent = await getStudentById(id);
93 return c.json<ApiResponse<Student>>({
94 success: true,
95 data: updatedStudent!,
97 });
98 } catch (error) {
99 return c.json<ApiResponse<null>>({
100 success: false,
101 error: "Internal server error"

dbssetprofiletypes.ts1 match

@desniland•Updated 2 days ago
112}
113
114export interface ApiResponse<T> {
115 success: boolean;
116 data?: T;

dbssetprofileREADME.md8 matches

@desniland•Updated 2 days ago
391. The backend automatically creates the database tables on first run
402. Access the profile page at the root URL
413. Use the API endpoints to manage data
42
43## API Endpoints
44
45- `GET /api/profile/:id` - Get student profile
46- `PUT /api/profile/:id` - Update student profile
47- `GET /api/academics/:studentId` - Get academic data
48- `GET /api/finances/:studentId` - Get financial data
49- `GET /api/socials/events` - Get events
50- `GET /api/repository/:studentId` - Get documents

token-server1 file match

@kwhinnery_openai•Updated 4 hours ago
Mint tokens to use with the OpenAI Realtime API for WebRTC

book-lookup-notion6 file matches

@nucky•Updated 17 hours ago
use google book api to look up bibliographic metadata elements
Kapil01
apiv1