Skip to content

Commit

Permalink
Add audio type (#127)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladimir <[email protected]>
  • Loading branch information
vutratenko and Vladimir authored Feb 5, 2023
1 parent b136385 commit ad0b55e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions block.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,29 @@ func (i Image) GetURL() string {
return ""
}

type AudioBlock struct {
BasicBlock
Audio Audio `json:"audio"`
}

type Audio struct {
Caption []RichText `json:"caption,omitempty"`
Type FileType `json:"type"`
File *FileObject `json:"file,omitempty"`
External *FileObject `json:"external,omitempty"`
}

// GetURL returns the external or internal URL depending on the image type.
func (i Audio) GetURL() string {
if i.File != nil {
return i.File.URL
}
if i.External != nil {
return i.External.URL
}
return ""
}

type CodeBlock struct {
BasicBlock
Code Code `json:"code"`
Expand Down

0 comments on commit ad0b55e

Please sign in to comment.