this repo has no description www.baileykane.co/
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert to typescript

BK610 719273bf 4241abe5

+43
+9
lib/bskyApi.ts
··· 1 + import { AtpAgent } from "@atproto/api"; 2 + 3 + export const agent: AtpAgent = new AtpAgent({ 4 + // App View URL 5 + service: "https://api.bsky.app", 6 + // If you were making an authenticated client, you would 7 + // use the PDS URL here instead - the main one is bsky.social 8 + // service: "https://bsky.social", 9 + });
+34
lib/sheetsConnector.ts
··· 1 + import Papa from "papaparse"; 2 + import type { ParseResult } from "papaparse"; 3 + 4 + /**Fetch the CSV data from the provided Google Sheets URL. */ 5 + async function getSheetsCSV(url: URL): Promise<string> { 6 + const response = await fetch(url); 7 + 8 + if (!response.ok) { 9 + throw new Error(`Failed to fetch data from ${url}`); 10 + } 11 + 12 + const csv = await response.text(); 13 + return csv; 14 + } 15 + 16 + /**Parse the provided CSV data into an array of JSON objects. */ 17 + function parseCSV(csvData: string): ParseResult<string> { 18 + return Papa.parse(csvData, { header: true }); 19 + } 20 + 21 + /**Convenience function to fetch CSV data from the provided Google Sheets URL 22 + * and parse it into an array of JSON objects, all in one. 23 + * 24 + * Combines getSheetsCSV and parseCSV. 25 + */ 26 + export async function importCSVDataAsJson( 27 + url: string 28 + ): Promise<ParseResult<string>> { 29 + const urlObj = new URL(url); 30 + 31 + const csv = await getSheetsCSV(urlObj); 32 + const json = parseCSV(csv); 33 + return json; 34 + }