generated from padok-team/yatas-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCheckPage.go
58 lines (54 loc) · 1.22 KB
/
CheckPage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"strings"
"github.com/jomei/notionapi"
"github.com/stangirard/yatas/plugins/commons"
)
func createPageCheckRequest(check commons.Check, databaseId string) notionapi.PageCreateRequest {
//calculate status boolean
status := true
if check.Status == "FAIL" {
status = false
}
notionTitle := notionapi.Text{
Content: check.Id,
}
notionDecription := notionapi.Text{
Content: check.Description,
}
emo := notionapi.Emoji("🥷")
checkType := strings.Split(check.Id, "_")
pageCreateRequest := notionapi.PageCreateRequest{
Parent: notionapi.Parent{
DatabaseID: notionapi.DatabaseID(databaseId),
},
Properties: notionapi.Properties{
"Id": notionapi.TitleProperty{
Title: []notionapi.RichText{
{Text: ¬ionTitle},
},
},
"Type": notionapi.SelectProperty{
Select: notionapi.Option{
Name: checkType[1],
},
},
"Status": notionapi.CheckboxProperty{
Checkbox: status,
},
"Description": notionapi.RichTextProperty{
RichText: []notionapi.RichText{
{Text: ¬ionDecription},
},
},
},
Icon: ¬ionapi.Icon{
Type: `emoji`,
Emoji: &emo,
},
Children: []notionapi.Block{
createCheckTable(check),
},
}
return pageCreateRequest
}