我想在Go中给我的文档添加一个页脚。下面是我的代码。
createFooterReq := &docs.Request{
CreateFooter: &docs.CreateFooterRequest{
SectionBreakLocation: &docs.Location{},
Type: "DEFAULT_FOOTER",
},
}
// Insert text into the footer
footerText := "This is a footer added with Go"
insertTextReq := &docs.Request{
InsertText: &docs.InsertTextRequest{
Text: footerText,
EndOfSegmentLocation: &docs.EndOfSegmentLocation{
SegmentId: "",
},
},
}
但是在编辑器中(我使用vscode)没有错误,但是当我尝试运行时,这个错误出现了。
Error 400: Invalid value at 'requests[0].create_footer.type' (type.googleapis.com/google.apps.docs.v1.HeaderFooterType), "DEFAULT_FOOTER"Details:[{"@type": "type.googleapis.com/google.rpc.BadRequest","fieldViolations": [{"description": "Invalid value at 'requests[0].create_footer.type' (type.googleapis.com/google.apps.docs.v1.HeaderFooterType), "DEFAULT_FOOTER"","field": "requests[0].create_footer.type"}]}], invalidexit status 1
1条答案
按热度按时间nkoocmlb1#
您为页脚类型提供了不正确的值,根据库文档,(此处)允许的值为:
所以,进行以下更改,它应该可以工作: