1
Get Document
One script reply has been approved by the moderators Verified
Created by rossmccrann 631 days ago Viewed 4346 times
0
Submitted by rossmccrann Deno
Verified 631 days ago
1
type Gdocs = {
2
  token: string;
3
};
4
export async function main(gdocs_auth: Gdocs, documentId: string) {
5
  const token = gdocs_auth["token"];
6

7
  const GET_DOC_URL = `https://docs.googleapis.com/v1/documents/${documentId}`;
8

9
  const response = await fetch(GET_DOC_URL, {
10
    method: "GET",
11
    headers: {
12
      Authorization: "Bearer " + token,
13
      "Content-Type": "application/json",
14
    },
15
  });
16

17
  return await response.text();
18
}
19