1 | type Gdocs = { |
2 | token: string; |
3 | }; |
4 | export async function main(gdocs_auth: Gdocs, title: string) { |
5 | const token = gdocs_auth["token"]; |
6 |
|
7 | const body = { |
8 | title: title, |
9 | }; |
10 | const CREATE_DOC_URL = `https://docs.googleapis.com/v1/documents`; |
11 |
|
12 | const response = await fetch(CREATE_DOC_URL, { |
13 | method: "POST", |
14 | body: JSON.stringify(body), |
15 | headers: { |
16 | Authorization: "Bearer " + token, |
17 | "Content-Type": "application/json", |
18 | }, |
19 | }); |
20 |
|
21 | return await response.text(); |
22 | } |
23 |
|