Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
67
vendor/github.com/google/go-github/github/activity_notifications.go
generated
vendored
67
vendor/github.com/google/go-github/github/activity_notifications.go
generated
vendored
|
@ -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,19 +63,19 @@ 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
|
||||
}
|
||||
|
||||
return notifications, resp, err
|
||||
return notifications, resp, nil
|
||||
}
|
||||
|
||||
// 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,12 +88,12 @@ 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
|
||||
}
|
||||
|
||||
return notifications, resp, err
|
||||
return notifications, resp, nil
|
||||
}
|
||||
|
||||
type markReadOptions struct {
|
||||
|
@ -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,18 +144,18 @@ 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
|
||||
}
|
||||
|
||||
return notification, resp, err
|
||||
return notification, resp, nil
|
||||
}
|
||||
|
||||
// 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,19 +179,19 @@ 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
|
||||
}
|
||||
|
||||
return sub, resp, err
|
||||
return sub, resp, nil
|
||||
}
|
||||
|
||||
// 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,24 +200,24 @@ 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
|
||||
}
|
||||
|
||||
return sub, resp, err
|
||||
return sub, resp, nil
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue