import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
type Gdrive = {
token: string;
};
export async function main(gdrive_auth: Gdrive) {
const START_PAGE_URL = `https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined =
await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined) {
const START_PAGE_URL = `https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL = `https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes["newStartPageToken"]);
return result_changes["changes"];
}
Submitted by admin 480 days ago
import * as wmill from 'https://deno.land/x/windmill@v1.85.0/mod.ts'
type Gdrive = {
token: string;
};
export async function main(gdrive_auth: Gdrive) {
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined = await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined){
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes['newStartPageToken']);
return result_changes["changes"];
}
Submitted by admin 483 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">) {
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined = await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined){
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes['newStartPageToken']);
return result_changes["changes"];
}
Submitted by adam186 612 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">) {
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined = await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined){
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes['newStartPageToken']);
return result_changes["changes"];
}
Submitted by adam186 647 days ago
import * as wmill from 'https://deno.land/x/windmill@v1.27.2/mod.ts'
export async function main(gdrive_auth: wmill.Resource<"gdrive">) {
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined = await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined){
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes['newStartPageToken']);
return result_changes["changes"];
}
Submitted by rossmccrann 854 days ago
import * as wmill from "https://deno.land/x/windmill@v1.25.0/mod.ts";
export async function main(gdrive_auth: wmill.Resource<"gdrive">) {
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken/`;
let last_start_page_token: string | undefined = await wmill.getInternalState();
const token = gdrive_auth["token"];
if (last_start_page_token == undefined){
const START_PAGE_URL =
`https://www.googleapis.com/drive/v3/changes/startPageToken`;
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();
last_start_page_token = start_page_result["startPageToken"];
}
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${last_start_page_token}`;
const changes_response = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await changes_response.json();
await wmill.setInternalState(result_changes['newStartPageToken']);
return result_changes["changes"];
}
Submitted by rossmccrann 861 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,
) {
const SUPPORT_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 INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${START_PAGE_TOKEN}&driveId=${drive_id}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const response_changes = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await response_changes.json();
return result_changes["changes"];
}
Submitted by rossmccrann 864 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,
) {
const SUPPORT_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 INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${START_PAGE_TOKEN}&driveId=${GOOGLE_SHARED_DRIVE_ID}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const response_changes = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await response_changes.json();
return result_changes["changes"];
}
Submitted by rossmccrann 864 days ago
export async function main(
gdrive_auth: wmill.Resource<"gdrive">,
drive_id: string,
) {
const SUPPORT_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 INCLUDE_ITEMS_FROM_ALL_DRIVES = true;
const CHECK_CHANGES_URL =
`https://www.googleapis.com/drive/v3/changes/?pageToken=${START_PAGE_TOKEN}&driveId=${GOOGLE_SHARED_DRIVE_ID}&includeItemsFromAllDrives=${INCLUDE_ITEMS_FROM_ALL_DRIVES}&supportsAllDrives=${SUPPORT_ALL_DRIVES}`;
const response_changes = await fetch(CHECK_CHANGES_URL, {
method: "GET",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const result_changes = await response_changes.json();
return result_changes["changes"];
}
Submitted by rossmccrann 864 days ago