diff options
author | 6543 <6543@obermui.de> | 2021-01-21 20:33:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 20:33:58 +0100 |
commit | 81c833d92d04e0a5579e7168aba548dad7e17451 (patch) | |
tree | c928f1b43fc6e2f27603193f0eed657f0760c96d /vendor/github.com/gogs/go-gogs-client/user_follow.go | |
parent | b5570d3e680570343c1552bfc972b19b161209cd (diff) | |
download | gitea-81c833d92d04e0a5579e7168aba548dad7e17451.tar.gz gitea-81c833d92d04e0a5579e7168aba548dad7e17451.zip |
Add support to migrate from gogs (#14342)
Add support to migrate gogs:
* issues
* comments
* labels
* milestones
* wiki
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'vendor/github.com/gogs/go-gogs-client/user_follow.go')
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/user_follow.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/github.com/gogs/go-gogs-client/user_follow.go b/vendor/github.com/gogs/go-gogs-client/user_follow.go new file mode 100644 index 0000000000..5ba20cc084 --- /dev/null +++ b/vendor/github.com/gogs/go-gogs-client/user_follow.go @@ -0,0 +1,47 @@ +// Copyright 2015 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package gogs + +import "fmt" + +func (c *Client) ListMyFollowers(page int) ([]*User, error) { + users := make([]*User, 0, 10) + return users, c.getParsedResponse("GET", fmt.Sprintf("/user/followers?page=%d", page), nil, nil, &users) +} + +func (c *Client) ListFollowers(user string, page int) ([]*User, error) { + users := make([]*User, 0, 10) + return users, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/followers?page=%d", user, page), nil, nil, &users) +} + +func (c *Client) ListMyFollowing(page int) ([]*User, error) { + users := make([]*User, 0, 10) + return users, c.getParsedResponse("GET", fmt.Sprintf("/user/following?page=%d", page), nil, nil, &users) +} + +func (c *Client) ListFollowing(user string, page int) ([]*User, error) { + users := make([]*User, 0, 10) + return users, c.getParsedResponse("GET", fmt.Sprintf("/users/%s/following?page=%d", user, page), nil, nil, &users) +} + +func (c *Client) IsFollowing(target string) bool { + _, err := c.getResponse("GET", fmt.Sprintf("/user/following/%s", target), nil, nil) + return err == nil +} + +func (c *Client) IsUserFollowing(user, target string) bool { + _, err := c.getResponse("GET", fmt.Sprintf("/users/%s/following/%s", user, target), nil, nil) + return err == nil +} + +func (c *Client) Follow(target string) error { + _, err := c.getResponse("PUT", fmt.Sprintf("/user/following/%s", target), jsonHeader, nil) + return err +} + +func (c *Client) Unfollow(target string) error { + _, err := c.getResponse("DELETE", fmt.Sprintf("/user/following/%s", target), nil, nil) + return err +} |