/// <summary> /// ユーザー情報を取得します。 /// </summary> public static IEnumerable <TwitterUser> LookupUsers(this CredentialProvider provider, string[] screenNames = null, long[] ids = null) { if (screenNames == null && ids == null) { throw new ArgumentNullException("screenNameとid,両方をnullに設定することはできません。"); } if (screenNames != null) { return(provider.GetUsers("users/lookup.json", new[] { new KeyValuePair <string, string>("screen_name", String.Join(",", screenNames)) })); } else { return(provider.GetUsers("users/lookup.json", new[] { new KeyValuePair <string, string>("user_id", String.Join(",", ids.Select(l => l.ToString()))) })); } }
/// <summary> /// Get users with use cursor params /// </summary> private static IEnumerable <TwitterUser> GetUsersAll(this CredentialProvider provider, string partialUri, IEnumerable <KeyValuePair <string, string> > para) { long n_cursor = -1; long c_cursor = -1; long p; var parac = para.ToArray(); while (n_cursor != 0) { var pc = parac.ToList(); pc.Add(new KeyValuePair <string, string>("cursor", c_cursor.ToString())); var users = provider.GetUsers(partialUri, pc, out p, out n_cursor); if (users != null) { foreach (var u in users) { yield return(u); } } c_cursor = n_cursor; } }