Get rid of checks when creating constructs. Check should handle this.
This commit is contained in:
@@ -13,18 +13,9 @@ type InlineTextContent struct {
|
||||
}
|
||||
|
||||
// newInlineTextContent creates a new InlineTextContent. It returns a
|
||||
// *InlineTextContent and an error.
|
||||
func newInlineTextContent(mediaType string, content any) (*InlineTextContent, error) {
|
||||
if mediaType != "text" && mediaType != "html" && mediaType != "" {
|
||||
return nil, fmt.Errorf("media type %v incompatible with inline text content", mediaType)
|
||||
}
|
||||
|
||||
text, ok := content.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("content type %T incompatible with inline text content", content)
|
||||
}
|
||||
|
||||
return &InlineTextContent{Type: mediaType, Text: text}, nil
|
||||
// *InlineTextContent.
|
||||
func newInlineTextContent(mediaType, text string) *InlineTextContent {
|
||||
return &InlineTextContent{Type: mediaType, Text: text}
|
||||
}
|
||||
|
||||
// isContent checks whether the InlineTextContent is a Content. It returns a
|
||||
|
Reference in New Issue
Block a user