public static NameValueCollection AddMembershipParams(MembershipParameters groupParams) { MembershipParameters.Parameters = new NameValueCollection(); PropertyInfo[] pic = groupParams.GetType().GetProperties(); foreach (PropertyInfo pi in pic) { object value = pi.GetValue(groupParams, null); bool include = false; if (value != null) { string typeName = value.GetType().Name; switch (typeName) { case "Int32": if ((int)value > 0) include = true; break; case "SortBy": if ((SortBy)value != SortBy.NONE) include = true; break; default: include = true; break; } if (include) { MembershipParameterAttribute name = (MembershipParameterAttribute)MembershipParameterAttribute.GetCustomAttribute(pi, typeof(MembershipParameterAttribute)); if(name != null) Parameters.Add(name.Name, pi.GetValue(groupParams, null).ToString()); } } } return MembershipParameters.Parameters; }
public static string GetAllUsers(MembershipParameters membershipParams) { NameValueCollection parameters = Yammer.APIWrapper.MembershipParameters.AddMembershipParams(membershipParams); return Yammer.APIWrapper.HttpUtility.Get(Resources.Users.All, parameters); }
public static List<User> GetAllUsers(MembershipParameters membershipParams) { string response = Json.GetAllUsers(membershipParams); return JsonConvert.DeserializeObject<List<User>>(response); }
public static List<Group> GetAllGroups(MembershipParameters groupParams) { return JsonConvert.DeserializeObject<List<Group>>(Json.GetAllGroups(groupParams)); }
public static string GetAllGroups(MembershipParameters groupParams) { MembershipParameters.AddMembershipParams(groupParams); string response = Yammer.APIWrapper.HttpUtility.Get(Resources.Groups.All, MembershipParameters.Parameters); return response; }