1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-09 09:35:00 +09:00

GO-4144 Merge branch 'feature/chat' of github.com:anyproto/anytype-heart into go-4144-refactor-internal-details-structure

This commit is contained in:
Sergey 2024-10-15 13:34:56 +02:00
commit 17f33347b8
No known key found for this signature in database
GPG key ID: 3B6BEF79160221C6
157 changed files with 6829 additions and 5572 deletions

View file

@ -83,6 +83,8 @@ type options struct {
id string
backgroundColor string
fileHash string
fileName string
fileType model.BlockContentFileType
}
type Option func(*options)
@ -214,6 +216,18 @@ func FileHash(hash string) Option {
}
}
func FileName(fileName string) Option {
return func(o *options) {
o.fileName = fileName
}
}
func FileType(fileType model.BlockContentFileType) Option {
return func(o *options) {
o.fileType = fileType
}
}
func File(targetObjectId string, opts ...Option) *Block {
var o options
for _, apply := range opts {
@ -225,7 +239,29 @@ func File(targetObjectId string, opts ...Option) *Block {
File: &model.BlockContentFile{
Hash: o.fileHash,
TargetObjectId: targetObjectId,
Name: o.fileName,
Type: o.fileType,
},
},
}, opts...)
}
func Bookmark(url string) *Block {
return mkBlock(&model.Block{
Content: &model.BlockContentOfBookmark{
Bookmark: &model.BlockContentBookmark{
Url: url,
},
},
})
}
func Link(targetBlockId string) *Block {
return mkBlock(&model.Block{
Content: &model.BlockContentOfLink{
Link: &model.BlockContentLink{
TargetBlockId: targetBlockId,
},
},
})
}