forked from intercom/intercom-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag.go
43 lines (34 loc) · 976 Bytes
/
tag.go
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
32
33
34
35
36
37
38
39
40
41
42
43
package intercom
import "fmt"
// TagService handles interactions with the API through a TagRepository.
type TagService struct {
Repository TagRepository
}
// Tag represents an Tag in Intercom.
type Tag struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
// TagList, an object holding a list of Tags
type TagList struct {
Tags []Tag `json:"tags,omitempty"`
}
// List all Tags for the App
func (t *TagService) List() (TagList, error) {
return t.Repository.list()
}
// Save a new Tag for the App.
func (t *TagService) Save(tag *Tag) (Tag, error) {
return t.Repository.save(tag)
}
// Delete a Tag
func (t *TagService) Delete(id string) error {
return t.Repository.delete(id)
}
// Tag Users or Companies using a TaggingList.
func (t *TagService) Tag(taggingList *TaggingList) (Tag, error) {
return t.Repository.tag(taggingList)
}
func (t Tag) String() string {
return fmt.Sprintf("[intercom] tag { id: %s name: %s }", t.ID, t.Name)
}