added fetch relation ship functions.
This commit is contained in:
14
client.go
14
client.go
@@ -268,3 +268,17 @@ func (c *Client) CreateGroup(name, description string, users []string) (*Channel
|
||||
err = json.Unmarshal(resp, groupChannel)
|
||||
return groupChannel, err
|
||||
}
|
||||
|
||||
// Fetch relationships.
|
||||
func (c Client) FetchRelationships() ([]*UserRelations, error) {
|
||||
relationshipDatas := []*UserRelations{}
|
||||
|
||||
resp, err := c.Request("GET", "/users/relationships", []byte{})
|
||||
|
||||
if err != nil {
|
||||
return relationshipDatas, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(resp, &relationshipDatas)
|
||||
return relationshipDatas, err
|
||||
}
|
||||
|
||||
15
user.go
15
user.go
@@ -86,3 +86,18 @@ func (u User) FetchDefaultAvatar() (*Binary, error) {
|
||||
avatarData.Data = resp
|
||||
return avatarData, nil
|
||||
}
|
||||
|
||||
// Fetch user relationship.
|
||||
func (u User) FetchRelationship() (*UserRelations, error) {
|
||||
relationshipData := &UserRelations{}
|
||||
relationshipData.Id = u.Id
|
||||
|
||||
resp, err := u.Client.Request("GET", "/users/"+u.Id+"/relationship", []byte{})
|
||||
|
||||
if err != nil {
|
||||
return relationshipData, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(resp, relationshipData)
|
||||
return relationshipData, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user