account.go
changeset 184 546db8bb5867
parent 183 cd5aa242c01f
child 193 f4ac09bc2964
equal deleted inserted replaced
183:cd5aa242c01f 184:546db8bb5867
   191 	o := &getAccountsOptions{ID: accountID, Limit: lopt}
   191 	o := &getAccountsOptions{ID: accountID, Limit: lopt}
   192 	return mc.getMultipleAccountsHelper("following", o)
   192 	return mc.getMultipleAccountsHelper("following", o)
   193 }
   193 }
   194 
   194 
   195 // FollowAccount follows an account
   195 // FollowAccount follows an account
   196 func (mc *Client) FollowAccount(accountID int64) error {
   196 func (mc *Client) FollowAccount(accountID int64) (*Relationship, error) {
   197 	rel, err := mc.updateRelationship("follow", accountID)
   197 	rel, err := mc.updateRelationship("follow", accountID)
   198 	if err != nil {
   198 	if err != nil {
   199 		return err
   199 		return nil, err
   200 	}
   200 	}
   201 	if rel == nil {
   201 	if rel == nil {
   202 		return ErrEntityNotFound
   202 		return nil, ErrEntityNotFound
   203 	}
   203 	}
   204 	return nil
   204 	return rel, nil
   205 }
   205 }
   206 
   206 
   207 // UnfollowAccount unfollows an account
   207 // UnfollowAccount unfollows an account
   208 func (mc *Client) UnfollowAccount(accountID int64) error {
   208 func (mc *Client) UnfollowAccount(accountID int64) (*Relationship, error) {
   209 	rel, err := mc.updateRelationship("unfollow", accountID)
   209 	rel, err := mc.updateRelationship("unfollow", accountID)
   210 	if err != nil {
   210 	if err != nil {
   211 		return err
   211 		return nil, err
   212 	}
   212 	}
   213 	if rel == nil {
   213 	if rel == nil {
   214 		return ErrEntityNotFound
   214 		return nil, ErrEntityNotFound
   215 	}
   215 	}
   216 	return nil
   216 	return rel, nil
   217 }
   217 }
   218 
   218 
   219 // FollowRemoteAccount follows a remote account
   219 // FollowRemoteAccount follows a remote account
   220 // The parameter 'uri' is a URI (e.mc. "username@domain").
   220 // The parameter 'uri' is a URI (e.mc. "username@domain").
   221 func (mc *Client) FollowRemoteAccount(uri string) (*Account, error) {
   221 func (mc *Client) FollowRemoteAccount(uri string) (*Account, error) {
   235 	}
   235 	}
   236 	return &account, nil
   236 	return &account, nil
   237 }
   237 }
   238 
   238 
   239 // BlockAccount blocks an account
   239 // BlockAccount blocks an account
   240 func (mc *Client) BlockAccount(accountID int64) error {
   240 func (mc *Client) BlockAccount(accountID int64) (*Relationship, error) {
   241 	rel, err := mc.updateRelationship("block", accountID)
   241 	rel, err := mc.updateRelationship("block", accountID)
   242 	if err != nil {
   242 	if err != nil {
   243 		return err
   243 		return nil, err
   244 	}
   244 	}
   245 	if rel == nil {
   245 	if rel == nil {
   246 		return ErrEntityNotFound
   246 		return nil, ErrEntityNotFound
   247 	}
   247 	}
   248 	return nil
   248 	return rel, nil
   249 }
   249 }
   250 
   250 
   251 // UnblockAccount unblocks an account
   251 // UnblockAccount unblocks an account
   252 func (mc *Client) UnblockAccount(accountID int64) error {
   252 func (mc *Client) UnblockAccount(accountID int64) (*Relationship, error) {
   253 	rel, err := mc.updateRelationship("unblock", accountID)
   253 	rel, err := mc.updateRelationship("unblock", accountID)
   254 	if err != nil {
   254 	if err != nil {
   255 		return err
   255 		return nil, err
   256 	}
   256 	}
   257 	if rel == nil {
   257 	if rel == nil {
   258 		return ErrEntityNotFound
   258 		return nil, ErrEntityNotFound
   259 	}
   259 	}
   260 	return nil
   260 	return rel, nil
   261 }
   261 }
   262 
   262 
   263 // MuteAccount mutes an account
   263 // MuteAccount mutes an account
   264 func (mc *Client) MuteAccount(accountID int64) error {
   264 func (mc *Client) MuteAccount(accountID int64) (*Relationship, error) {
   265 	rel, err := mc.updateRelationship("mute", accountID)
   265 	rel, err := mc.updateRelationship("mute", accountID)
   266 	if err != nil {
   266 	if err != nil {
   267 		return err
   267 		return nil, err
   268 	}
   268 	}
   269 	if rel == nil {
   269 	if rel == nil {
   270 		return ErrEntityNotFound
   270 		return nil, ErrEntityNotFound
   271 	}
   271 	}
   272 	return nil
   272 	return rel, nil
   273 }
   273 }
   274 
   274 
   275 // UnmuteAccount unmutes an account
   275 // UnmuteAccount unmutes an account
   276 func (mc *Client) UnmuteAccount(accountID int64) error {
   276 func (mc *Client) UnmuteAccount(accountID int64) (*Relationship, error) {
   277 	rel, err := mc.updateRelationship("unmute", accountID)
   277 	rel, err := mc.updateRelationship("unmute", accountID)
   278 	if err != nil {
   278 	if err != nil {
   279 		return err
   279 		return nil, err
   280 	}
   280 	}
   281 	if rel == nil {
   281 	if rel == nil {
   282 		return ErrEntityNotFound
   282 		return nil, ErrEntityNotFound
   283 	}
   283 	}
   284 	return nil
   284 	return rel, nil
   285 }
   285 }
   286 
   286 
   287 // SearchAccounts returns a list of accounts matching the query string
   287 // SearchAccounts returns a list of accounts matching the query string
   288 // The lopt parameter is optional (can be nil) or can be used to set a limit.
   288 // The lopt parameter is optional (can be nil) or can be used to set a limit.
   289 func (mc *Client) SearchAccounts(query string, lopt *LimitParams) ([]Account, error) {
   289 func (mc *Client) SearchAccounts(query string, lopt *LimitParams) ([]Account, error) {