"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/code.gitea.io/sdk/gitea/issue_subscription.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

issue_subscription.go  (gitea-1.13.1):issue_subscription.go  (gitea-1.13.2)
skipping to change at line 14 skipping to change at line 14
package gitea package gitea
import ( import (
"fmt" "fmt"
"net/http" "net/http"
) )
// GetIssueSubscribers get list of users who subscribed on an issue // GetIssueSubscribers get list of users who subscribed on an issue
func (c *Client) GetIssueSubscribers(owner, repo string, index int64) ([]*User, *Response, error) { func (c *Client) GetIssueSubscribers(owner, repo string, index int64) ([]*User, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.11.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_11_0); err != n il {
return nil, nil, err return nil, nil, err
} }
subscribers := make([]*User, 0, 10) subscribers := make([]*User, 0, 10)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d/subscriptions", owner, repo, index), nil, nil, &subscribers) resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d/subscriptions", owner, repo, index), nil, nil, &subscribers)
return subscribers, resp, err return subscribers, resp, err
} }
// AddIssueSubscription Subscribe user to issue // AddIssueSubscription Subscribe user to issue
func (c *Client) AddIssueSubscription(owner, repo string, index int64, user stri ng) (*Response, error) { func (c *Client) AddIssueSubscription(owner, repo string, index int64, user stri ng) (*Response, error) {
if err := c.CheckServerVersionConstraint(">=1.11.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_11_0); err != n il {
return nil, err return nil, err
} }
status, resp, err := c.getStatusCode("PUT", fmt.Sprintf("/repos/%s/%s/iss ues/%d/subscriptions/%s", owner, repo, index, user), nil, nil) status, resp, err := c.getStatusCode("PUT", fmt.Sprintf("/repos/%s/%s/iss ues/%d/subscriptions/%s", owner, repo, index, user), nil, nil)
if err != nil { if err != nil {
return resp, err return resp, err
} }
if status == http.StatusCreated { if status == http.StatusCreated {
return resp, nil return resp, nil
} }
if status == http.StatusOK { if status == http.StatusOK {
return resp, fmt.Errorf("already subscribed") return resp, fmt.Errorf("already subscribed")
} }
return resp, fmt.Errorf("unexpected Status: %d", status) return resp, fmt.Errorf("unexpected Status: %d", status)
} }
// DeleteIssueSubscription unsubscribe user from issue // DeleteIssueSubscription unsubscribe user from issue
func (c *Client) DeleteIssueSubscription(owner, repo string, index int64, user s tring) (*Response, error) { func (c *Client) DeleteIssueSubscription(owner, repo string, index int64, user s tring) (*Response, error) {
if err := c.CheckServerVersionConstraint(">=1.11.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_11_0); err != n il {
return nil, err return nil, err
} }
status, resp, err := c.getStatusCode("DELETE", fmt.Sprintf("/repos/%s/%s/ issues/%d/subscriptions/%s", owner, repo, index, user), nil, nil) status, resp, err := c.getStatusCode("DELETE", fmt.Sprintf("/repos/%s/%s/ issues/%d/subscriptions/%s", owner, repo, index, user), nil, nil)
if err != nil { if err != nil {
return resp, err return resp, err
} }
if status == http.StatusCreated { if status == http.StatusCreated {
return resp, nil return resp, nil
} }
if status == http.StatusOK { if status == http.StatusOK {
return resp, fmt.Errorf("already unsubscribed") return resp, fmt.Errorf("already unsubscribed")
} }
return resp, fmt.Errorf("unexpected Status: %d", status) return resp, fmt.Errorf("unexpected Status: %d", status)
} }
// CheckIssueSubscription check if current user is subscribed to an issue // CheckIssueSubscription check if current user is subscribed to an issue
func (c *Client) CheckIssueSubscription(owner, repo string, index int64) (*Watch Info, *Response, error) { func (c *Client) CheckIssueSubscription(owner, repo string, index int64) (*Watch Info, *Response, error) {
if err := c.CheckServerVersionConstraint(">=1.12.0"); err != nil { if err := c.checkServerVersionGreaterThanOrEqual(version1_12_0); err != n il {
return nil, nil, err return nil, nil, err
} }
wi := new(WatchInfo) wi := new(WatchInfo)
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d/subscriptions/check", owner, repo, index), nil, nil, wi) resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/ %d/subscriptions/check", owner, repo, index), nil, nil, wi)
return wi, resp, err return wi, resp, err
} }
// IssueSubscribe subscribe current user to an issue // IssueSubscribe subscribe current user to an issue
func (c *Client) IssueSubscribe(owner, repo string, index int64) (*Response, err or) { func (c *Client) IssueSubscribe(owner, repo string, index int64) (*Response, err or) {
u, _, err := c.GetMyUserInfo() u, _, err := c.GetMyUserInfo()
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)