pollinaterpbldemo.tsx4 matches
910useEffect(() => {
11async function fetchSensorData() {
12try {
13// Simulated sensor data with realistic bee habitat conditions
19setLastUpdated(new Date());
20} catch (error) {
21console.error("Error fetching sensor data", error);
22}
23}
2425fetchSensorData();
26const intervalId = setInterval(fetchSensorData, 5000);
27return () => clearInterval(intervalId);
28}, []);
rdo-dailies-webhookmain.ts4 matches
1import { discordWebhook } from "https://esm.town/v/mmorihara/coherentVioletFinch";
23const strings = await fetch("https://esm.town/v/mmorihara/rdo-dailies-webhook@8-dev/data.json").then(r => r.json());
45const templates: { [key: string]: (goalText: string, goalNum: number) => string } = {
82}
8384async function fetchDailies() {
85const response = await fetch("https://api.rdo.gg/challenges/index.json");
86return response.json();
87}
141142export async function main() {
143const dailies = await fetchDailies();
144const formatted = formatDailies(dailies);
145
whatsapp-callbackindex.tsx7 matches
53console.log(`Attempting to send WhatsApp message to ${phoneNumber}: "${text}"`);
54const context = originalMessageId ? { context: { message_id: originalMessageId } } : {};
55const response = await fetch(
56`https://graph.facebook.com/v22.0/${businessId}/messages`,
57{
177try {
178console.log(`[SmartAck] Attempting to generate smart ack for: "${userQuery.substring(0, 50)}..." with ${QUICK_ACK_MODEL}`);
179const groqResponse = await fetch("https://api.groq.com/openai/v1/chat/completions", {
180method: "POST",
181headers: {
308console.log(`[initiateChat] Sending to CF Orchestrator (${CLOUDFLARE_WORKER_ORCHESTRATOR_URL}/initiate-async-chat) for ${userIdentifier}:`, JSON.stringify(mcpPayload, null, 2));
309310const mcpApiResponse = await fetch(`${CLOUDFLARE_WORKER_ORCHESTRATOR_URL}/initiate-async-chat`, {
311method: "POST",
312headers: { "Content-Type": "application/json" },
462try {
463console.log(`Marking read for ${userPhoneNumber} (msg_id: ${currentMessageId})`);
464const markReadResp = await fetch(`https://graph.facebook.com/v22.0/${business_phone_number_id}/messages`, {
465method: "POST", headers: {"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`, "Content-Type": "application/json"},
466body: JSON.stringify({messaging_product: "whatsapp", status: "read", message_id: currentMessageId}),
612613try {
614const response = await fetch('/send-welcome', {
615method: 'POST',
616headers: { 'Content-Type': 'application/json' },
681try {
682console.log(`Attempting to send custom message to ${phoneNumber} via business ID ${WHATSAPP_BUSINESS_ID}: "${messageBody.substring(0,50)}..."`);
683const response = await fetch(
684`https://graph.facebook.com/v22.0/${WHATSAPP_BUSINESS_ID}/messages`,
685{
713});
714715export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
orangeSolemain.tsx6 matches
1import { fetch as proxiedFetch } from "https://esm.town/v/std/fetch";
2import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
3import { convertHTMLToJSON } from "https://esm.town/v/tempguy/liteutils";
4const baseURLReq = await fetch(
5"https://multiembed.mov?video_id=114472&tmdb=1&s=1&e=2",
6{
18};
1920const baseReq = await proxiedFetch(baseURL, {
21"headers": headers,
22"body":
30const source = match[1];
3132const serverList = await proxiedFetch("https://streamingnow.mov/response.php", {
33method: "POST",
34body: `token=${source}`,
45`https://streamingnow.mov/playvideo.php?video_id=S0dpVVFEbWV3ZDBBNGI3QldBPT0=&server_id=42&token=${source}`,
46);
47const embedPage = await proxiedFetch(
48`https://streamingnow.mov/playvideo.php?video_id=STJHWFR6aUcxTWdWNWI0PQ==&server_id=21&token=${source}`,
49);
6970// FOR VIP STREAM ONLY
71const player = await fetch(url[1]);
72const regex = /eval\(function\(h,u,n,t,e,r\).*?\("(.*?)",\d*?,"(.*?)",(\d*?),(\d*?),\d*?\)\)/;
73const linkRegex = /file:"(.*?)"/;
122async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
123// Used to get the list of post id's for the discussion.
124const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
125const discussionResJson = await discussionRes.json();
126134135await Promise.all(chunks.map(async (c: string[]) => {
136const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
137const postJson = await postRes.json();
138215`;
216217export default app.fetch;
222223try {
224const response = await fetch("/api/share", {
225method: "POST",
226headers: {
GitHub-Release-Notesgithub.ts25 matches
23/**
4* Fetches commits from a GitHub repository within a date range
5* Implements pagination to fetch all commits
6*/
7export async function fetchCommits(
8token: string,
9owner: string,
34};
3536console.log(`Fetching commits between ${sinceISO} and ${untilISO}`);
3738// Fetch all pages
39while (hasMorePages) {
40const url =
41`https://api.github.com/repos/${owner}/${repo}/commits?since=${sinceISO}&until=${untilISO}&per_page=100&page=${page}`;
42console.log(`Fetching page ${page}...`);
4344const response = await fetch(url, { headers });
4546if (!response.ok) {
64}
6566console.log(`Fetched a total of ${allCommits.length} commits`);
67return allCommits;
68}
6970/**
71* Fetches a pull request by its number
72*/
73export async function fetchPR(
74token: string,
75owner: string,
79const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}`;
8081const response = await fetch(url, {
82headers: {
83"Accept": "application/vnd.github.v3+json",
101102/**
103* Fetches pull requests associated with a commit.
104*/
105async function fetchPRsForCommit(
106token: string,
107owner: string,
111const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}/pulls`;
112113const response = await fetch(url, {
114headers: {
115"Accept": "application/vnd.github.v3+json",
133134/**
135* Fetches issues referenced by a commit or PR using GitHub API
136*/
137async function fetchIssueReferences(
138token: string,
139owner: string,
149const prIssuesUrl = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/commits`;
150151const prResponse = await fetch(prIssuesUrl, {
152headers: {
153"Accept": "application/vnd.github.v3+json",
182const timelineUrl = `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/timeline`;
183184const timelineResponse = await fetch(timelineUrl, {
185headers: {
186"Accept": "application/vnd.github.mockingbird-preview+json",
211212/**
213* Fetches commits and their associated PRs
214* Includes progress tracking for large repositories
215* Uses GitHub API to find PR and issue references
216*/
217export async function fetchCommitsWithPRs(
218token: string,
219owner: string,
222endDate: string,
223): Promise<CommitWithPR[]> {
224// Fetch all commits with pagination
225const commits = await fetchCommits(token, owner, repo, startDate, endDate);
226227const commitsWithPRs: CommitWithPR[] = [];
236const batchPromises = batch.map(async (commit) => {
237// Use GitHub API to find associated PRs for this commit
238const associatedPRs = await fetchPRsForCommit(token, owner, repo, commit.sha);
239240let pr: GitHubPR | null = null;
246247// Get issue references using the GitHub API
248const prIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha, pr.number);
249issueRefs = [...prIssueRefs];
250} else {
251// If no PR is associated, still check for issue references in the commit
252const commitIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha);
253issueRefs = [...commitIssueRefs];
254}
TownieuseProject.tsx5 matches
11const [error, setError] = useState(null);
1213const fetchData = async () => {
14try {
15const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
23};
2425const { project } = await fetch(projectEndpoint, { headers })
26.then(res => res.json());
27const { files } = await fetch(filesEndpoint, { headers })
28.then(res => res.json());
2940useEffect(() => {
41if (!projectId) return;
42fetchData();
43}, [projectId, branchId]);
4445return { data, loading, error, refetch: fetchData };
46}
47
TownieuseProjects.tsx5 matches
10const [error, setError] = useState(null);
1112const fetchData = async () => {
13try {
14const res = await fetch(ENDPOINT, {
15headers: {
16"Authorization": "Bearer " + token,
18})
19const data = await res.json();
20console.log("useProjects fetchData", { res, data });
21if (!res.ok) {
22console.error(data);
3940useEffect(() => {
41fetchData();
42}, []);
4344return { data, loading, error, refetch: fetchData };
45}
46
TownieuseCreateProject.tsx1 match
19setError(null);
20try {
21const res = await fetch(ENDPOINT, {
22method: "POST",
23headers: {