Added custom banner url

This commit is contained in:
chris
2022-05-24 18:02:52 +08:00
parent 27c8e0f610
commit bf6ef7af0c

View File

@@ -14,16 +14,10 @@ export class Upload2Notion {
this.app = app; this.app = app;
} }
async createPage(title:string, childArr: any) { async createPage(title:string, childArr: any) {
const bodyString = { const bodyString:any = {
parent: { parent: {
database_id: this.app.settings.databaseID database_id: this.app.settings.databaseID
}, },
cover: {
type: "external",
external: {
url: this.app.settings.bannerUrl
}
},
properties: { properties: {
Name: { Name: {
title: [ title: [
@@ -37,6 +31,16 @@ export class Upload2Notion {
}, },
children: childArr, children: childArr,
} }
if(this.app.settings.bannerUrl) {
bodyString.cover = {
type: "external",
external: {
url: this.app.settings.bannerUrl
}
}
}
const response = await requestUrl({ const response = await requestUrl({
url: `https://api.notion.com/v1/pages`, url: `https://api.notion.com/v1/pages`,
method: 'POST', method: 'POST',