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