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:
commit
17f33347b8
157 changed files with 6829 additions and 5572 deletions
|
@ -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,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue