Edits history of script submission #38 for ' Get Changes (gdrive)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    import * as wmill from "https://deno.land/x/[email protected]/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 hugo697 374 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/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 1006 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1010 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1138 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1173 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1381 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/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 1387 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1390 days ago

  • deno
    import * as wmill from 'https://deno.land/x/[email protected]/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 1390 days ago

  • deno
    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 1390 days ago