Documentation
¶
Index ¶
- type Meta
- type Notification
- type NotificationMap
- type Notifications
- func (n Notifications) Compact() Notifications
- func (n Notifications) FilterFromIds(ids []string) Notifications
- func (n Notifications) IDList() []string
- func (n Notifications) Map() NotificationMap
- func (n Notifications) Marshall() (interface{}, error)
- func (n Notifications) Sort()
- func (n Notifications) String() string
- func (n Notifications) Table() (string, error)
- func (n Notifications) Uniq() Notifications
- func (n Notifications) Visible() Notifications
- type Repository
- type Subject
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶
type Notification struct {
// Standard API fields
Id string `json:"id"`
Unread bool `json:"unread"`
Reason string `json:"reason"`
UpdatedAt time.Time `json:"updated_at"`
URL string `json:"url"`
Repository Repository `json:"repository"`
Subject Subject `json:"subject"`
// Enriched API fields
Author User `json:"author"`
// gh-not specific fields
// Those fields are not part of the GitHub API and will persist between
// syncs.
Meta Meta `json:"meta"`
}
func (Notification) Debug ¶ added in v0.2.0
func (n Notification) Debug() string
func (Notification) String ¶ added in v0.2.0
func (n Notification) String() string
func (Notification) Visible ¶ added in v0.2.0
func (n Notification) Visible() bool
type NotificationMap ¶
type NotificationMap map[string]*Notification
func (NotificationMap) List ¶ added in v0.1.5
func (m NotificationMap) List() Notifications
type Notifications ¶
type Notifications []*Notification
func Sync ¶ added in v0.1.5
func Sync(local, remote Notifications) Notifications
Sync merges the local and remote notifications.
It applies the following rules: | remote \ local | Missing | Exist | Done | | --- | --- | --- | --- | | Exist | (1)Insert | (2)Update | (2)Update | | Missing | (3)Keep | (3)Keep | (4)Drop |
- Insert: Add the notification ass is.
- Update: Update the local notification with the remote data, keep the Meta unchanged.
- Keep: Keep the local notification unchanged.
- Drop: Remove the notification from the local list.
TODO: refactor this to `func (n Notifications) Sync(remote Notifications) {}`
func (Notifications) Compact ¶ added in v0.1.0
func (n Notifications) Compact() Notifications
TODO: in-place update
func (Notifications) FilterFromIds ¶
func (n Notifications) FilterFromIds(ids []string) Notifications
func (Notifications) IDList ¶ added in v0.0.3
func (n Notifications) IDList() []string
func (Notifications) Map ¶ added in v0.1.5
func (n Notifications) Map() NotificationMap
func (Notifications) Marshall ¶ added in v0.1.0
func (n Notifications) Marshall() (interface{}, error)
func (Notifications) Sort ¶ added in v0.1.5
func (n Notifications) Sort()
func (Notifications) String ¶ added in v0.2.0
func (n Notifications) String() string
func (Notifications) Table ¶ added in v0.2.0
func (n Notifications) Table() (string, error)
func (Notifications) Uniq ¶ added in v0.0.3
func (n Notifications) Uniq() Notifications
TODO: in-place update
func (Notifications) Visible ¶ added in v0.2.0
func (n Notifications) Visible() Notifications
type Repository ¶
Click to show internal directories.
Click to hide internal directories.