type Gdrive = {
token: string;
};
export async function main(
gdrive_auth: Gdrive,
drive_id: string,
webhook_address: string,
channelId: any,
) {
const SUPPORT_ALL_DRIVES = true;
const SUPPORT_TEAM_DRIVES = true;
const INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const START_PAGE_URL = `https://www.googleapis.com/drive/v3/changes/startPageToken/?driveId=${drive_id}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const token = gdrive_auth["token"];
const response_sp = await fetch(START_PAGE_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const start_page_result = await response_sp.json();
const START_PAGE_TOKEN = start_page_result["startPageToken"];
const WATCH_URL = `https://www.googleapis.com/drive/v3/changes/watch/?pageToken=${START_PAGE_TOKEN}&supportsAllDrives=${SUPPORT_ALL_DRIVES}&supportsTeamDrives=${SUPPORT_TEAM_DRIVES}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}`;
const requestBody = {
kind: "api#channel",
type: "webhook",
address: webhook_address,
id: channelId,
};
const response = await fetch(WATCH_URL, {
method: "POST",
body: JSON.stringify(requestBody),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const message = await response.json();
return message;
}
Submitted by admin 468 days ago
type Gdrive = {
token: string;
};
export async function main(
gdrive_auth: Gdrive,
drive_id: string,
webhook_address: string,
channelId: any,
) {
const SUPPORT_ALL_DRIVES = true;
const SUPPORT_TEAM_DRIVES = true;
const INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/?driveId=${drive_id}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const token = gdrive_auth["token"];
const response_sp = await fetch(START_PAGE_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const start_page_result = await response_sp.json();
const START_PAGE_TOKEN = start_page_result["startPageToken"];
const WATCH_URL =
`https://www.googleapis.com/drive/v3/changes/watch/?pageToken=${START_PAGE_TOKEN}&supportsAllDrives=${SUPPORT_ALL_DRIVES}&supportsTeamDrives=${SUPPORT_TEAM_DRIVES}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}`;
const requestBody = {
kind: "api#channel",
"type": "webhook",
address: webhook_address,
id: channelId,
};
const response = await fetch(WATCH_URL, {
method: "POST",
body: JSON.stringify(requestBody),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const message = await response.json();
return message;
}
Submitted by admin 471 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
export async function main(
gdrive_auth: wmill.Resource<"gdrive">,
drive_id: string,
webhook_address: string,
channelId: any,
) {
const SUPPORT_ALL_DRIVES = true;
const SUPPORT_TEAM_DRIVES = true;
const INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/?driveId=${drive_id}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const token = gdrive_auth["token"];
const response_sp = await fetch(START_PAGE_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const start_page_result = await response_sp.json();
const START_PAGE_TOKEN = start_page_result["startPageToken"];
const WATCH_URL =
`https://www.googleapis.com/drive/v3/changes/watch/?pageToken=${START_PAGE_TOKEN}&supportsAllDrives=${SUPPORT_ALL_DRIVES}&supportsTeamDrives=${SUPPORT_TEAM_DRIVES}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}`;
const requestBody = {
kind: "api#channel",
"type": "webhook",
address: webhook_address,
id: channelId,
};
const response = await fetch(WATCH_URL, {
method: "POST",
body: JSON.stringify(requestBody),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const message = await response.json();
return message;
}
Submitted by adam186 599 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
export async function main(
gdrive_auth: wmill.Resource<"gdrive">,
drive_id: string,
webhook_address: string,
channelId: any,
) {
const SUPPORT_ALL_DRIVES = true;
const SUPPORT_TEAM_DRIVES = true;
const INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/?driveId=${drive_id}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const token = gdrive_auth["token"];
const response_sp = await fetch(START_PAGE_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const start_page_result = await response_sp.json();
const START_PAGE_TOKEN = start_page_result["startPageToken"];
const WATCH_URL =
`https://www.googleapis.com/drive/v3/changes/watch/?pageToken=${START_PAGE_TOKEN}&supportsAllDrives=${SUPPORT_ALL_DRIVES}&supportsTeamDrives=${SUPPORT_TEAM_DRIVES}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}`;
const requestBody = {
kind: "api#channel",
"type": "webhook",
address: webhook_address,
id: channelId,
};
const response = await fetch(WATCH_URL, {
method: "POST",
body: JSON.stringify(requestBody),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const message = await response.json();
return message;
}
Submitted by adam186 634 days ago
import * as wmill from "https://deno.land/x/windmill@v1.23.0/mod.ts";
export async function main(
gdrive_auth: wmill.Resource<"gdrive">,
drive_id: string,
webhook_address: string,
channelId: any,
) {
const SUPPORT_ALL_DRIVES = true;
const SUPPORT_TEAM_DRIVES = true;
const INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/?driveId=${drive_id}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const token = gdrive_auth["token"];
const response_sp = await fetch(START_PAGE_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const start_page_result = await response_sp.json();
const START_PAGE_TOKEN = start_page_result["startPageToken"];
const WATCH_URL =
`https://www.googleapis.com/drive/v3/changes/watch/?pageToken=${START_PAGE_TOKEN}&supportsAllDrives=${SUPPORT_ALL_DRIVES}&supportsTeamDrives=${SUPPORT_TEAM_DRIVES}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}`;
const requestBody = {
kind: "api#channel",
"type": "webhook",
address: webhook_address,
id: channelId,
};
const response = await fetch(WATCH_URL, {
method: "POST",
body: JSON.stringify(requestBody),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const message = await response.json();
return message;
}
Submitted by rossmccrann 851 days ago