17}): Promise<TweetResult[]> {
18 const { data } = await twitterJSON({
19 url: `https://api.twitter.com/2/tweets/search/recent?query=${await searchParams(
20 {
21 query,
55 const results = await twitterSearch({
56 query,
57 bearerToken: Deno.env.get("TWITTER_API_KEY"),
58 });
59 console.log("Here!", results);
19
20async function fetchUser(token: string): Promise<User> {
21 const resp = await fetch("https://api.val.town/v1/me", {
22 headers: {
23 Authorization: `Bearer ${token}`,
17```
18
19To authenticate, [paste an api token](https://www.val.town/settings/api) in the password prompt.
20
21Migrated from folder: Archive/basicAuth
6 key: string;
7}) {
8 const apiKey = process.env.sf_tidbyt_api_key;
9 const deviceId = process.env.sf_tidbyt_device_id;
10 const res = await fetch(
11 `https://api.tidbyt.com/v0/devices/${deviceId}/push`,
12 {
13 method: "POST",
14 headers: {
15 Authorization: `Bearer ${apiKey}`,
16 },
17 body: JSON.stringify({
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();
1# gsheet_call
2Wrapper around Google Sheets API v4.
3
4## Parameters
6- sheet_id: Google Sheet ID
7- method: HTTP method to use
8- action: Full URL with `https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/` removed
9- data: HTTP request body
10
11## Requirements
12- a Google Cloud service account
13- the Google Sheets API v4 enabled in your Google Cloud project
14- the spreadsheet ID (provide it in the sheet_id parameter)
15
1export async function test() {
2 const { default: axios } = await import("npm:axios");
3 const url = "http://207.244.232.58:8011/api/login";
4 const message = "testing";
5 const loginInfo = {
2
3const gpt3Example = async () => {
4 const response = await fetch("https://api.openai.com/v1/completions", {
5 method: "POST",
6 headers: {
7 "Content-Type": "application/json",
8 "Authorization": "Bearer " + process.env.OPENAI_API_KEY, // Replace with your OpenAI API Key
9 },
10 body: JSON.stringify({
1const googleSearchKey = "AIzaSyAY7rS9VJVEcS6196uOWXOx2mCq_cN2kXM";
2const googleCxId = "70c6ff0b41f6943a4";
3const baseurl = "https://www.googleapis.com/customsearch/v1";
4
5export default async function(req: Request): Promise<Response> {
14 try {
15 const data = await fetch(
16 `https://www.googleapis.com/customsearch/v1?q=${searchKey}&cx=70c6ff0b41f6943a4&key=AIzaSyAY7rS9VJVEcS6196uOWXOx2mCq_cN2kXM&c2coff=1&start=1&num=5&dateRestrict=m%5B1%5D`,
17 )
18 .then(response => response.json())
5const googleCxId = "70c6ff0b41f6943a4";
6
7const baseurl = "https://www.googleapis.com/customsearch/v1";
8
9export const getGoogleSearch = async ({ searchKey }) => {
25
26 const getSearch = async (data) => {
27 const response = await fetch("https://api.openai.com/v1/completions", {
28 method: "GET",
29 body: JSON.stringify(data),