MCPcopy Index your code
hub / github.com/google/go-github / GetRepositorySubscription

Method GetRepositorySubscription

github/activity_watching.go:96–113  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

94//
95//meta:operation GET /repos/{owner}/{repo}/subscription
96func (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.

Calls 3

parseBoolResponseFunction · 0.85
NewRequestMethod · 0.80
DoMethod · 0.45