-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext_input.go
More file actions
31 lines (28 loc) · 805 Bytes
/
text_input.go
File metadata and controls
31 lines (28 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package rss2
import (
"encoding/xml"
"fmt"
)
// TextInput represents a Channel's textInput element. All sub-elements
// must be present.
type TextInput struct {
XMLName xml.Name `xml:"textInput"`
Title string `xml:"title"`
Description string `xml:"description"`
Name string `xml:"name"`
Link string `xml:"link"`
}
// NewTextInput creates a new TextInput element.
func NewTextInput(title, description, name, link string) (*TextInput, error) {
if len(title) == 0 || len(description) == 0 || len(name) == 0 ||
len(link) == 0 {
return nil, fmt.Errorf(`empty string passed to NewTextInput()`)
}
return &TextInput{
XMLName: xml.Name{Local: `textInput`},
Title: title,
Description: description,
Name: name,
Link: link,
}, nil
}