GetRepositorySubscription returns the subscription for the specified repository for the authenticated user. If the authenticated user is not watching the repository, a nil Subscription is returned. GitHub API docs: https://docs.github.com/rest/activity/watching?apiVersion=2022-11-28#get-a-repositor
(ctx context.Context, owner, repo string)
| 94 | // |
| 95 | //meta:operation GET /repos/{owner}/{repo}/subscription |
| 96 | func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { |
| 97 | u := fmt.Sprintf("repos/%v/%v/subscription", owner, repo) |
| 98 | |
| 99 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 100 | if err != nil { |
| 101 | return nil, nil, err |
| 102 | } |
| 103 | |
| 104 | var sub *Subscription |
| 105 | resp, err := s.client.Do(req, &sub) |
| 106 | if err != nil { |
| 107 | // if it's just a 404, don't return that as an error |
| 108 | _, err = parseBoolResponse(err) |
| 109 | return nil, resp, err |
| 110 | } |
| 111 | |
| 112 | return sub, resp, nil |
| 113 | } |
| 114 | |
| 115 | // SetRepositorySubscription sets the subscription for the specified repository |
| 116 | // for the authenticated user. |