status.go
changeset 155 0c581e0108da
parent 149 5f922977d7c7
child 159 408aa794d9bb
equal deleted inserted replaced
154:eb83fd052cc5 155:0c581e0108da
    46 		}
    46 		}
    47 
    47 
    48 		endPoint += "/" + op
    48 		endPoint += "/" + op
    49 	}
    49 	}
    50 
    50 
    51 	return mc.apiCall(endPoint, rest.Get, nil, nil, data)
    51 	return mc.apiCall(endPoint, rest.Get, nil, nil, nil, data)
    52 }
    52 }
    53 
    53 
    54 // updateStatusData updates the statuses
    54 // updateStatusData updates the statuses
    55 // The operation 'op' can be empty or "status" (to post a status), "delete"
    55 // The operation 'op' can be empty or "status" (to post a status), "delete"
    56 // (for deleting a status), "reblog", "unreblog", "favourite", "unfavourite".
    56 // (for deleting a status), "reblog", "unreblog", "favourite", "unfavourite".
   112 		if opts.Visibility != "" {
   112 		if opts.Visibility != "" {
   113 			params["visibility"] = opts.Visibility
   113 			params["visibility"] = opts.Visibility
   114 		}
   114 		}
   115 	}
   115 	}
   116 
   116 
   117 	return mc.apiCall(endPoint, method, params, nil, data)
   117 	return mc.apiCall(endPoint, method, params, nil, nil, data)
   118 }
   118 }
   119 
   119 
   120 // GetStatus returns a status
   120 // GetStatus returns a status
   121 // The returned status can be nil if there is an error or if the
   121 // The returned status can be nil if there is an error or if the
   122 // requested ID does not exist.
   122 // requested ID does not exist.
   150 	return &card, nil
   150 	return &card, nil
   151 }
   151 }
   152 
   152 
   153 // GetStatusRebloggedBy returns a list of the accounts who reblogged a status
   153 // GetStatusRebloggedBy returns a list of the accounts who reblogged a status
   154 func (mc *Client) GetStatusRebloggedBy(statusID int, lopt *LimitParams) ([]Account, error) {
   154 func (mc *Client) GetStatusRebloggedBy(statusID int, lopt *LimitParams) ([]Account, error) {
   155 	var accounts []Account
   155 	o := &getAccountsOptions{ID: statusID, Limit: lopt}
   156 	err := mc.queryStatusData(statusID, "reblogged_by", &accounts)
   156 	return mc.getMultipleAccounts("reblogged_by", o)
   157 	return accounts, err
       
   158 }
   157 }
   159 
   158 
   160 // GetStatusFavouritedBy returns a list of the accounts who favourited a status
   159 // GetStatusFavouritedBy returns a list of the accounts who favourited a status
   161 func (mc *Client) GetStatusFavouritedBy(statusID int, lopt *LimitParams) ([]Account, error) {
   160 func (mc *Client) GetStatusFavouritedBy(statusID int, lopt *LimitParams) ([]Account, error) {
   162 	var accounts []Account
   161 	o := &getAccountsOptions{ID: statusID, Limit: lopt}
   163 	err := mc.queryStatusData(statusID, "favourited_by", &accounts)
   162 	return mc.getMultipleAccounts("favourited_by", o)
   164 	return accounts, err
       
   165 }
   163 }
   166 
   164 
   167 // PostStatus posts a new "toot"
   165 // PostStatus posts a new "toot"
   168 // All parameters but "text" can be empty.
   166 // All parameters but "text" can be empty.
   169 // Visibility must be empty, or one of "direct", "private", "unlisted" and "public".
   167 // Visibility must be empty, or one of "direct", "private", "unlisted" and "public".