/// <summary> /// Returns a list of users and communities banned from the current user's newsfeed. /// </summary> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a mixed list of <see cref="User"/> and <see cref="Group"/> objects.</returns> public async Task <Response <MixedProfilesList> > GetBanned(List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <MixedProfilesList>("getBanned", new MethodParams { { "extended", true }, { "fields", fields }, { "name_case", ToEnumString(nameCase) } });
/// <summary> /// Returns detailed information on users. /// </summary> /// <param name="userIds">User IDs or screen names (screen_name). By default, current user ID.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<List<User>>> Get(List<object> userIds = null, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<List<User>>("get", new MethodParams { {"user_ids", userIds?.Where(uid => uid is int || uid is string).ToList(), false, 1000}, {"fields", fields}, {"name_case", nameCase} }, true);
/// <summary> /// Returns detailed information on users. /// </summary> /// <param name="userIds">User IDs or screen names (screen_name). By default, current user ID.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <List <User> > > Get(List <object> userIds = null, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <List <User> >("get", new MethodParams { { "user_ids", userIds?.Where(uid => uid is int || uid is string).ToList(), false, 1000 }, { "fields", fields }, { "name_case", nameCase } }, true);
/// <summary> /// Gets the list of user Ids that can be called using <c>callUser</c> method of <c>JS API</c>. /// </summary> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > GetAvailableForCall(List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("getAvailableForCall", new MethodParams { { "name_case", Utils.ToEnumString(nameCase) }, { "fields", fields != null && fields.Any() ? fields : new List <UserProfileFields> { UserProfileFields.Sex } } });
/// <summary> /// Returns a list of profiles of users whom the current user may know. /// </summary> /// <param name="filter">Types of potential friends to return.</param> /// <param name="count">Number of suggestions to return.</param> /// <param name="offset">Offset needed to return a specific subset of suggestions.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > GetSuggestions( FriendSuggestionsTypes filter = FriendSuggestionsTypes.All, int count = 500, int offset = 0, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("getSuggestions", new MethodParams { { "filter", filter == FriendSuggestionsTypes.All ? null : Utils.ToEnumString(filter) }, { "count", count, false, new[] { 0, 500 } }, { "offset", offset }, { "fields", fields }, { "name_case", Utils.ToEnumString(nameCase) } });
/// <summary> /// Returns a list of IDs of users participating in a chat. /// </summary> /// <param name="chatId">Chat ID.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <List <User> > > GetChatUsers(int chatId, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <List <User> >("getChatUsers", new MethodParams { { "chat_id", chatId, true }, { "fields", fields == null || !fields.Any() ? new List <UserProfileFields> { UserProfileFields.Nickname } : fields }, { "name_case", Utils.ToEnumString(nameCase) } });
/// <summary> /// Returns a list of user IDs or detailed information about a user's friends. /// </summary> /// <param name="userId">User ID. By default, the current user ID.</param> /// <param name="order">Sort order.</param> /// <param name="listId">ID of the friend list returned by the <see cref="GetLists"/> method to be used as the source. This parameter is taken into account only when the uid parameter is set to the current user ID. </param> /// <param name="count">Number of friends to return.</param> /// <param name="offset">Offset needed to return a specific subset of friends.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> Get(int? userId = null, FriendsOrder order = FriendsOrder.Hints, int? listId = null, int? count = null, int offset = 0, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<ItemsList<User>>("get", new MethodParams { {"user_id", userId}, {"order", Utils.ToEnumString(order)}, {"list_id", listId}, {"count", count}, {"offset", offset}, { "fields", fields == null || !fields.Any() ? new List<UserProfileFields> {UserProfileFields.Nickname} : fields }, {"name_case", Utils.ToEnumString(nameCase)} }, true);
/// <summary> /// Returns a list of user IDs or detailed information about a user's friends. /// </summary> /// <param name="userId">User ID. By default, the current user ID.</param> /// <param name="order">Sort order.</param> /// <param name="listId">ID of the friend list returned by the <see cref="GetLists"/> method to be used as the source. This parameter is taken into account only when the uid parameter is set to the current user ID. </param> /// <param name="count">Number of friends to return.</param> /// <param name="offset">Offset needed to return a specific subset of friends.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > Get(int?userId = null, FriendsOrder order = FriendsOrder.Hints, int?listId = null, int?count = null, int offset = 0, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("get", new MethodParams { { "user_id", userId }, { "order", Utils.ToEnumString(order) }, { "list_id", listId }, { "count", count }, { "offset", offset }, { "fields", fields == null || !fields.Any() ? new List <UserProfileFields> { UserProfileFields.Nickname } : fields }, { "name_case", Utils.ToEnumString(nameCase) } }, true);
/// <summary> /// Indexes user's current location and returns a list of users who are located near. /// </summary> /// <param name="coords">Geographical coordinates including <see cref="Coordinates.Radius"/> and <see cref="Coordinates.Accuracy"/>.</param> /// <param name="timeout">Time when a user disappears from location search results, in seconds.</param> /// <param name="fields">List of additional fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > GetNearby(Coordinates coords, int timeout = 7200, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("getNearby", new MethodParams { { "latitude", coords?.Latitude, true }, { "longitude", coords?.Longitude, true }, { "radius", coords?.Radius }, { "accuracy", coords?.Accuracy }, { "timeout", timeout }, { "name_case", ToEnumString(nameCase) }, { "fields", fields } });
/// <summary> /// Returns a list of IDs of followers of the user in question, sorted by date added, most recent first. /// </summary> /// <param name="userId">User ID.</param> /// <param name="offset">Offset needed to return a specific subset of followers.</param> /// <param name="count">Number of followers to return. </param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > GetFollowers(int?userId = null, int?offset = 0, int?count = 100, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await GetFollowers(new UsersGetFollowersParams { UserId = userId, Offset = offset, Count = count, NameCase = nameCase, Fields = fields });
public RelationshipItem(UserData profileData) : base(ProfileInfoItemType.RichText) { this.Title = CommonResources.ProfilePage_Info_RelStatus; string str1 = ""; User relationPartner = profileData.user.relation_partner; long num = relationPartner == null ? 0L : relationPartner.id; string str2 = ""; RelationshipStatus relationshipStatus = (RelationshipStatus)profileData.user.relation; NameCases partnerNameCases = profileData.relPartnerNameCases; bool flag = profileData.user.sex == 2; switch (relationshipStatus) { case RelationshipStatus.NotMarried: str1 = flag ? CommonResources.ProfilePage_Info_NotMarriedMale : CommonResources.ProfilePage_Info_NotMarriedFemale; break; case RelationshipStatus.InARelationship: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_InARelationshipMaleWith : CommonResources.ProfilePage_Info_InARelationshipFemaleWith; str2 = partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_InARelationshipMale : CommonResources.ProfilePage_Info_InARelationshipFemale; break; case RelationshipStatus.Engaged: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_EngagedMaleWith : CommonResources.ProfilePage_Info_EngagedFemaleWith; str2 = partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_EngagedMale : CommonResources.ProfilePage_Info_EngagedFemale; break; case RelationshipStatus.Married: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_MarriedMaleWith : CommonResources.ProfilePage_Info_MarriedFemaleWith; str2 = flag ? partnerNameCases.abl : partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_MarriedMale : CommonResources.ProfilePage_Info_MarriedFemale; break; case RelationshipStatus.ItIsComplicated: if (num > 0L) { str1 = CommonResources.ProfilePage_Info_ItIsComplicatedWith; str2 = partnerNameCases.ins; break; } str1 = CommonResources.ProfilePage_Info_ItIsComplicated; break; case RelationshipStatus.ActivelySearching: str1 = CommonResources.ProfilePage_Info_ActivelySearching; break; case RelationshipStatus.InLove: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_InLoveMaleWith : CommonResources.ProfilePage_Info_InLoveFemaleWith; str2 = partnerNameCases.acc; break; } str1 = flag ? CommonResources.ProfilePage_Info_InLoveMale : CommonResources.ProfilePage_Info_InLoveFemale; break; } this.Data = num > 0L ? (object)string.Format("{0} [id{1}|{2}]", (object)str1, (object)num, (object)str2) : (object)str1; }
/// <summary> /// Indexes user's current location and returns a list of users who are located near. /// </summary> /// <param name="coords">Geographical coordinates including <see cref="Coordinates.Radius"/> and <see cref="Coordinates.Accuracy"/>.</param> /// <param name="timeout">Time when a user disappears from location search results, in seconds.</param> /// <param name="fields">List of additional fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> GetNearby(Coordinates coords, int timeout = 7200, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<ItemsList<User>>("getNearby", new MethodParams { {"latitude", coords?.Latitude, true}, {"longitude", coords?.Longitude, true}, {"radius", coords?.Radius}, {"accuracy", coords?.Accuracy}, {"timeout", timeout}, {"name_case", ToEnumString(nameCase)}, {"fields", fields} });
/// <summary> /// Allows to search through the list of user's friends. /// For advanced search through the list of friends, you can use a method <see cref="UsersMethods.Search(UsersSearchParams)"/> with a parameter from_list = friends. /// </summary> /// <param name="userId">User ID.</param> /// <param name="q">Query string.</param> /// <param name="count">Number of users to return.</param> /// <param name="offset">Offset needed to return a specific subset of users.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> Search(int? userId = null, string q = null, int count = 20, int offset = 0, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<ItemsList<User>>("search", new MethodParams { {"user_id", userId}, {"q", q}, {"count", count, false, new[] {0, 1000}}, {"offset", offset}, {"fields", fields}, {"name_case", Utils.ToEnumString(nameCase)} });
/// <summary> /// Gets the list of user Ids that can be called using <c>callUser</c> method of <c>JS API</c>. /// </summary> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> GetAvailableForCall(List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<ItemsList<User>>("getAvailableForCall", new MethodParams { {"name_case", Utils.ToEnumString(nameCase)}, { "fields", fields != null && fields.Any() ? fields : new List<UserProfileFields> {UserProfileFields.Sex} } });
/// <summary> /// Returns a list of profiles of users whom the current user may know. /// </summary> /// <param name="filter">Types of potential friends to return.</param> /// <param name="count">Number of suggestions to return.</param> /// <param name="offset">Offset needed to return a specific subset of suggestions.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> GetSuggestions( FriendSuggestionsTypes filter = FriendSuggestionsTypes.All, int count = 500, int offset = 0, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request<ItemsList<User>>("getSuggestions", new MethodParams { {"filter", filter == FriendSuggestionsTypes.All ? null : Utils.ToEnumString(filter)}, {"count", count, false, new[] {0, 500}}, {"offset", offset}, {"fields", fields}, {"name_case", Utils.ToEnumString(nameCase)} });
/// <summary> /// Allows to search through the list of user's friends. /// For advanced search through the list of friends, you can use a method <see cref="UsersMethods.Search(UsersSearchParams)"/> with a parameter from_list = friends. /// </summary> /// <param name="userId">User ID.</param> /// <param name="q">Query string.</param> /// <param name="count">Number of users to return.</param> /// <param name="offset">Offset needed to return a specific subset of users.</param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > Search(int?userId = null, string q = null, int count = 20, int offset = 0, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("search", new MethodParams { { "user_id", userId }, { "q", q }, { "count", count, false, new[] { 0, 1000 } }, { "offset", offset }, { "fields", fields }, { "name_case", Utils.ToEnumString(nameCase) } });
/// <summary> /// Returns invited users list of a community. /// </summary> /// <param name="groupId">Group id to return invited users for.</param> /// <param name="count">Count of users to return.</param> /// <param name="offset">Offset to select a certain subset of users.</param> /// <param name="fields">Additional fields list to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task <Response <ItemsList <User> > > GetInvitedUsers(int groupId, int count = 20, int offset = 0, List <UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await Request <ItemsList <User> >("getInvitedUsers", new MethodParams { { "group_id", groupId, true }, { "offset", offset }, { "count", count }, { "fields", fields }, { "name_case", nameCase } });
/// <summary> /// Returns a list of IDs of followers of the user in question, sorted by date added, most recent first. /// </summary> /// <param name="userId">User ID.</param> /// <param name="offset">Offset needed to return a specific subset of followers.</param> /// <param name="count">Number of followers to return. </param> /// <param name="fields">Profile fields to return.</param> /// <param name="nameCase">Case for declension of user name and surname.</param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="User"/> objects.</returns> public async Task<Response<ItemsList<User>>> GetFollowers(int? userId = null, int? offset = 0, int? count = 100, List<UserProfileFields> fields = null, NameCases nameCase = NameCases.Nominative) => await GetFollowers(new UsersGetFollowersParams { UserId = userId, Offset = offset, Count = count, NameCase = nameCase, Fields = fields });