diff options
Diffstat (limited to 'vendor/github.com/google/go-github/github/activity_notifications.go')
-rw-r--r-- | vendor/github.com/google/go-github/github/activity_notifications.go | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/vendor/github.com/google/go-github/github/activity_notifications.go b/vendor/github.com/google/go-github/github/activity_notifications.go index 5ae80ad..45c8b2a 100644 --- a/vendor/github.com/google/go-github/github/activity_notifications.go +++ b/vendor/github.com/google/go-github/github/activity_notifications.go @@ -6,6 +6,7 @@ package github import ( + "context" "fmt" "time" ) @@ -18,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API Docs: https://developer.github.com/v3/activity/notifications/#notification-reasons + // GitHub API docs: https://developer.github.com/v3/activity/notifications/#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -48,8 +49,8 @@ type NotificationListOptions struct { // ListNotifications lists all notifications for the authenticated user. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications -func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*Notification, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications +func (s *ActivityService) ListNotifications(ctx context.Context, opt *NotificationListOptions) ([]*Notification, *Response, error) { u := fmt.Sprintf("notifications") u, err := addOptions(u, opt) if err != nil { @@ -62,7 +63,7 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*No } var notifications []*Notification - resp, err := s.client.Do(req, ¬ifications) + resp, err := s.client.Do(ctx, req, ¬ifications) if err != nil { return nil, resp, err } @@ -73,8 +74,8 @@ func (s *ActivityService) ListNotifications(opt *NotificationListOptions) ([]*No // ListRepositoryNotifications lists all notifications in a given repository // for the authenticated user. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository -func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository +func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opt *NotificationListOptions) ([]*Notification, *Response, error) { u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) u, err := addOptions(u, opt) if err != nil { @@ -87,7 +88,7 @@ func (s *ActivityService) ListRepositoryNotifications(owner, repo string, opt *N } var notifications []*Notification - resp, err := s.client.Do(req, ¬ifications) + resp, err := s.client.Do(ctx, req, ¬ifications) if err != nil { return nil, resp, err } @@ -101,8 +102,8 @@ type markReadOptions struct { // MarkNotificationsRead marks all notifications up to lastRead as read. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#mark-as-read -func (s *ActivityService) MarkNotificationsRead(lastRead time.Time) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-as-read +func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead time.Time) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, } @@ -111,14 +112,14 @@ func (s *ActivityService) MarkNotificationsRead(lastRead time.Time) (*Response, return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // MarkRepositoryNotificationsRead marks all notifications up to lastRead in // the specified repository as read. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository -func (s *ActivityService) MarkRepositoryNotificationsRead(owner, repo string, lastRead time.Time) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository +func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead time.Time) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, } @@ -128,13 +129,13 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(owner, repo string, la return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // GetThread gets the specified notification thread. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread -func (s *ActivityService) GetThread(id string) (*Notification, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#view-a-single-thread +func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -143,7 +144,7 @@ func (s *ActivityService) GetThread(id string) (*Notification, *Response, error) } notification := new(Notification) - resp, err := s.client.Do(req, notification) + resp, err := s.client.Do(ctx, req, notification) if err != nil { return nil, resp, err } @@ -153,8 +154,8 @@ func (s *ActivityService) GetThread(id string) (*Notification, *Response, error) // MarkThreadRead marks the specified thread as read. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read -func (s *ActivityService) MarkThreadRead(id string) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read +func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) req, err := s.client.NewRequest("PATCH", u, nil) @@ -162,14 +163,14 @@ func (s *ActivityService) MarkThreadRead(id string) (*Response, error) { return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } // GetThreadSubscription checks to see if the authenticated user is subscribed // to a thread. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription -func (s *ActivityService) GetThreadSubscription(id string) (*Subscription, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#get-a-thread-subscription +func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) req, err := s.client.NewRequest("GET", u, nil) @@ -178,7 +179,7 @@ func (s *ActivityService) GetThreadSubscription(id string) (*Subscription, *Resp } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + resp, err := s.client.Do(ctx, req, sub) if err != nil { return nil, resp, err } @@ -189,8 +190,8 @@ func (s *ActivityService) GetThreadSubscription(id string) (*Subscription, *Resp // SetThreadSubscription sets the subscription for the specified thread for the // authenticated user. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription -func (s *ActivityService) SetThreadSubscription(id string, subscription *Subscription) (*Subscription, *Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription +func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) req, err := s.client.NewRequest("PUT", u, subscription) @@ -199,7 +200,7 @@ func (s *ActivityService) SetThreadSubscription(id string, subscription *Subscri } sub := new(Subscription) - resp, err := s.client.Do(req, sub) + resp, err := s.client.Do(ctx, req, sub) if err != nil { return nil, resp, err } @@ -210,13 +211,13 @@ func (s *ActivityService) SetThreadSubscription(id string, subscription *Subscri // DeleteThreadSubscription deletes the subscription for the specified thread // for the authenticated user. // -// GitHub API Docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription -func (s *ActivityService) DeleteThreadSubscription(id string) (*Response, error) { +// GitHub API docs: https://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription +func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err } - return s.client.Do(req, nil) + return s.client.Do(ctx, req, nil) } |