2 Commits

Author SHA1 Message Date
97fe20f364 Add missing methods to entry 2024-10-16 21:35:24 +02:00
0c24f80d09 Rename package to atom 2024-10-16 21:28:04 +02:00
23 changed files with 71 additions and 23 deletions

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"mime"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import "fmt"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"fmt"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"
@ -64,6 +64,54 @@ func NewEntry(title string) (*Entry, error) {
}, nil
}
// AddAuthor adds the Person as an author to the Entry.
func (e *Entry) AddAuthor(p *Person) {
if e.Authors == nil {
e.Authors = make([]*Person, 1)
e.Authors[0] = p
} else {
e.Authors = append(e.Authors, p)
}
e.Updated.DateTime = DateTime(time.Now())
}
// AddCategory adds the Category to the Entry.
func (e *Entry) AddCategory(c *Category) {
if e.Categories == nil {
e.Categories = make([]*Category, 1)
e.Categories[0] = c
} else {
e.Categories = append(e.Categories, c)
}
e.Updated.DateTime = DateTime(time.Now())
}
// AddContributor adds the Person as a contributor to the Entry.
func (e *Entry) AddContributor(c *Person) {
if e.Contributors == nil {
e.Contributors = make([]*Person, 1)
e.Contributors[0] = c
} else {
e.Contributors = append(e.Contributors, c)
}
e.Updated.DateTime = DateTime(time.Now())
}
// AddLink adds the Link to the Entry.
func (e *Entry) AddLink(l *Link) {
if e.Links == nil {
e.Links = make([]*Link, 1)
e.Links[0] = l
} else {
e.Links = append(e.Links, l)
}
e.Updated.DateTime = DateTime(time.Now())
}
// AddExtension adds the ExtensionElement to the Entry.
func (e *Entry) AddExtension(x *ExtensionElement) {
if e.Extensions == nil {

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"encoding/xml"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"encoding/xml"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"encoding/xml"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

2
id.go
View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import "errors"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import "fmt"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"fmt"

View File

@ -1,4 +1,4 @@
package atomfeed
package atom
import (
"encoding/xml"