account.go
changeset 125 2bbb72b9ebf6
parent 120 579912e9d0ef
child 130 c450bb73f59a
equal deleted inserted replaced
124:5ee3f23205af 125:2bbb72b9ebf6
   242 func (g *Client) GetAccountFollowRequests() ([]Account, error) {
   242 func (g *Client) GetAccountFollowRequests() ([]Account, error) {
   243 	return g.getMultipleAccounts("follow_requests", nil)
   243 	return g.getMultipleAccounts("follow_requests", nil)
   244 }
   244 }
   245 
   245 
   246 // GetAccountRelationships returns a list of relationship entities for the given accounts
   246 // GetAccountRelationships returns a list of relationship entities for the given accounts
   247 // NOTE: Currently it doesn't seem to work with several items.
       
   248 func (g *Client) GetAccountRelationships(accountIDs []int) ([]Relationship, error) {
   247 func (g *Client) GetAccountRelationships(accountIDs []int) ([]Relationship, error) {
   249 	if len(accountIDs) < 1 {
   248 	if len(accountIDs) < 1 {
   250 		return nil, ErrInvalidID
   249 		return nil, ErrInvalidID
   251 	}
   250 	}
   252 
   251 
   253 	if len(accountIDs) > 1 { // XXX
   252 	params := make(apiCallParams)
   254 		return nil, fmt.Errorf("accounts/relationships currently does not work with more than 1 ID")
   253 	for i, id := range accountIDs {
   255 	}
   254 		qID := fmt.Sprintf("id[%d]", i+1)
   256 
   255 		params[qID] = strconv.Itoa(id)
   257 	params := make(apiCallParams)
   256 	}
   258 	params["id"] = strconv.Itoa(accountIDs[0])
       
   259 	/*
       
   260 		for i, id := range accountIDList {
       
   261 			qID := fmt.Sprintf("id[%d]", i+1)
       
   262 			params[qID] = strconv.Itoa(id)
       
   263 		}
       
   264 	*/
       
   265 
   257 
   266 	var rl []Relationship
   258 	var rl []Relationship
   267 	if err := g.apiCall("accounts/relationships", rest.Get, params, &rl); err != nil {
   259 	if err := g.apiCall("accounts/relationships", rest.Get, params, &rl); err != nil {
   268 		return nil, err
   260 		return nil, err
   269 	}
   261 	}