37 : searchName;
38
39 const response = await fetch(
40 `https://serpapi.com/search.json?engine=google&q=${encodeURIComponent(searchQuery)}&api_key=${serpApiKey}`
41 );
127 return null;
128 } catch (error) {
129 console.error("Error fetching data from SERP API:", error);
130 return null;
131 }
147
148 if (serpApiKey) {
149 const response = await fetch(
150 `https://serpapi.com/search.json?engine=google&q=${encodeURIComponent(domain)}&api_key=${serpApiKey}`
151 );
185 };
186 } catch (error) {
187 console.error("Error fetching company data:", error);
188 return null;
189 }
261
262 // Create the page in Notion
263 const response = await fetch("https://api.notion.com/v1/pages", {
264 method: "POST",
265 headers: {
1import { fetchTodaysMeetings } from "./googleCalendar.ts";
2import { createMeetingPage } from "./notion.ts";
3import { getUserInfo } from "./userInfo.ts";
21 try {
22 // Get today's meetings from Google Calendar
23 const meetings = await fetchTodaysMeetings();
24 console.log(`Found ${meetings.length} total meetings for today`);
25
1/**
2 * Google Calendar integration to fetch meetings and identify user meetings
3 */
4
45 }
46
47 const tokenResponse = await fetch("https://oauth2.googleapis.com/token", {
48 method: "POST",
49 headers: {
67
68/**
69 * Fetch today's calendar events from Google Calendar
70 */
71async function fetchCalendarEvents(): Promise<GoogleCalendarEvent[]> {
72 const accessToken = await getAccessToken();
73
83 const url = `https://www.googleapis.com/calendar/v3/calendars/${encodeURIComponent(calendarId)}/events?timeMin=${encodeURIComponent(timeMin)}&timeMax=${encodeURIComponent(timeMax)}&singleEvents=true&orderBy=startTime`;
84
85 const response = await fetch(url, {
86 headers: {
87 Authorization: `Bearer ${accessToken}`,
90
91 if (!response.ok) {
92 throw new Error(`Failed to fetch calendar events: ${await response.text()}`);
93 }
94
127 * Process calendar events to identify user meetings
128 */
129export async function fetchTodaysMeetings(): Promise<Meeting[]> {
130 const events = await fetchCalendarEvents();
131 const teamDomain = Deno.env.get("TEAM_DOMAIN") || "val.town";
132 console.log(`Using team domain: ${teamDomain}`);
1import { blob } from "https://esm.town/v/std/blob";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import { TABLE_NAME } from "./updateTable";
4
5export default async function(req: Request): Promise<Response> {
32 let func = `(async () => {
33 try {
34 await fetch(import.meta.url, {
35 method: "POST",
36 headers: {
145
146 useEffect(() => {
147 fetchReadings();
148 }, []);
149
150 const fetchReadings = async () => {
151 try {
152 const response = await fetch('/readings');
153 const data = await response.json();
154 setReadings(data);
155 } catch (err) {
156 setError('Failed to fetch readings');
157 }
158 };
167
168 try {
169 const response = await fetch('/log', {
170 method: 'POST',
171 headers: { 'Content-Type': 'application/json' },
183 setPulse('');
184 setError('');
185 fetchReadings();
186 }
187 } catch (err) {
19 : Math.floor((Date.now() - 2 * 24 * 60 * 60 * 1000) / 1000);
20
21 // Fetch and log tweets
22 const response = await socialDataSearch(`${query} since_time:${timeFrame}`);
23 console.log("Response from socialDataSearch:", response);
11
12 useEffect(() => {
13 fetchOutfits();
14 }, []);
15
16 const fetchOutfits = async () => {
17 try {
18 const response = await fetch(window.location.href + "outfits");
19 const data = await response.json();
20 setOutfits(data);
21 } catch (error) {
22 console.error("Error fetching outfits:", error);
23 }
24 };
40
41 try {
42 const response = await fetch(window.location.href, {
43 method: "POST",
44 body: JSON.stringify({ image, outfitName, rating }),
51 setOutfitName("");
52 setRating(0);
53 fetchOutfits();
54 } catch (error) {
55 setSubmitMessage("Error submitting outfit");
141
142 try {
143 const response = await fetch('/generate-activity', {
144 method: 'POST',
145 headers: {