本文整理汇总了C#中ProfileFields类的典型用法代码示例。如果您正苦于以下问题:C# ProfileFields类的具体用法?C# ProfileFields怎么用?C# ProfileFields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProfileFields类属于命名空间,在下文中一共展示了ProfileFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public User Get(long userId, ProfileFields fields = null,
NameCase nameCase = null)
{
VkErrors.ThrowIfNumberIsNegative(() => userId);
var parameters = new VkParameters { { "fields", fields }, { "name_case", nameCase }, { "user_ids", userId } };
VkResponseArray response = _vk.Call("users.get", parameters, true);
return response[0];
}
示例2: Get
public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
{
if(listId != null && listId < 0)
throw new ArgumentOutOfRangeException("listId", "listId must be a positive number.");
var parameters = new VkParameters { { "user_id", uid }, { "fields", fields }, { "count", count }, { "offset", offset }, { "order", order }, {"list_id", listId} , {"name_case", nameCase}};
var response = _vk.Call("friends.get", parameters);
if (fields != null)
return response["items"].ToReadOnlyCollectionOf<User>(x => x);
return response.ToReadOnlyCollectionOf(id => new User { Id = id });
}
示例3: SearchAdvanced
public ReadOnlyCollection<User> SearchAdvanced(out int itemsCount, Sex sex, int age_from, ProfileFields fields = null, int count = 20, int offset = 0)
{
var parameters = new VkParameters { { "q", "" }, { "fields", fields }, { "count", count }, {"sort", 1}, {"country", 1}, {"sex",sex}
,{"age_from", age_from}, {"online", 1}, {"has_photo", 1}};
if (offset > 0)
parameters.Add("offset", offset);
VkResponseArray response = _vk.Call("users.search", parameters);
itemsCount = response[0];
return response.Skip(1).ToReadOnlyCollectionOf<User>(r => r);
}
示例4: GetAll
public ReadOnlyCollection<User> GetAll(long uid, ProfileFields fields = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
{
const int count = 50;
var i = 0;
var result = new List<User>();
do
{
var currentItems = _friends.Get(uid, fields, count, i * count, order, nameCase, listId);
if (currentItems != null) result.AddRange(currentItems);
} while (++i * count < (_vk.CountFromLastResponse ?? 0));
return result.ToReadOnlyCollection();
}
示例5: Get
public User Get(int userId, ProfileFields[] fields = null, NameCase nameCase = NameCase.nom)
{
NameValueCollection qs = new NameValueCollection();
qs["uids"] = userId.ToString();
if (fields != null)
qs["fields"] = String.Join(",", from field in fields select field.ToString());
qs["name_case"] = nameCase.ToString();
XmlDocument answer = VkResponse.ExecuteCommand("users.get", qs);
XmlNode usersNodes = answer.SelectSingleNode("response/user");
User user = new User(usersNodes);
return user;
}
示例6: GetAllFollowers
public ReadOnlyCollection<User> GetAllFollowers(long? userId = null, ProfileFields fields = null, NameCase nameCase = null)
{
const int count = 1000;
var i = 0;
var result = new List<User>();
do
{
var currentItems = _users.GetFollowers(userId, count, i * count, fields, nameCase);
if (currentItems != null) result.AddRange(currentItems);
} while (++i * count < (_vk.CountFromLastResponse ?? 0));
return result.ToReadOnlyCollection();
}
示例7: Search
public ReadOnlyCollection<User> Search([NotNull] string query, out int itemsCount, ProfileFields fields = null, int count = 20, int offset = 0)
{
if (string.IsNullOrEmpty(query))
throw new ArgumentException("Query can not be null or empty.");
var parameters = new VkParameters { { "q", query }, { "fields", fields }, { "count", count } };
if (offset > 0)
parameters.Add("offset", offset);
VkResponseArray response = _vk.Call("users.search", parameters);
itemsCount = response[0];
return response.Skip(1).ToReadOnlyCollectionOf<User>(r => r);
}
示例8: Get
public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null, NameCase nameCase = null, int? listId = null)
{
if (listId != null && listId < 0)
throw new ArgumentOutOfRangeException("listId", "listId must be a positive number.");
var parameters = new FriendsGetParams
{
UserId = uid,
Count = count,
Offset = offset,
Fields = fields,
NameCase = nameCase,
ListId = listId,
Order = order
};
return Get(parameters).ToReadOnlyCollection();
}
示例9: FriendsGet
public void FriendsGet(ProfileFields fields)
{
var wc = new WebClient();
wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e)
{
var ob = JObject.Parse(e.Result);
var list = ob["response"].Select(q => new Profile
{
uid = (int)q["uid"],
first_name = (string)q["first_name"],
last_name = (string)q["last_name"],
online = (int)q["online"] == 1,
photo = (string)q["photo"],
photo_big = (string)q["photo_big"],
photo_medium = (string)q["photo_medium"],
sex = q["sex"] != null ? (int)q["sex"] : 0 // и .т.д.
}).ToArray();
FriendsGetComplited(list);
};
wc.DownloadStringAsync(new Uri(string.Format("https://api.vk.com/method/friends.get?access_token={0}&fields={1}&order=hints", access_token, fields.ToString().Replace(" ", ""))));
}
示例10: get
/// <summary>Возвращает список идентификаторов друзей пользователя или расширенную информацию о друзьях пользователя (при использовании параметра</summary>
/// <param name="uid">идентификатор пользователя, для которого необходимо получить список друзей</param>
/// <param name="fields">перечисленные через запятую поля анкет, необходимые для получения</param>
/// <param name="name_case">падеж для склонения имени и фамилии пользователя</param>
/// <param name="count">количество друзей, которое нужно вернуть</param>
/// <param name="offset">смещение, необходимое для выборки определенного подмножества друзей</param>
/// <param name="lid">идентификатор списка друзей, полученный методом friends</param>
/// <param name="order">Порядок в котором нужно вернуть список друзей</param>
/// <returns>Ответ сервера в XML или JSON формате.</returns>
private VKResponseBase get(System.Int64? uid, ProfileFields? fields, NameCase? name_case, System.Int32? count, System.Int32? offset, System.Int64? lid, string order)
{
manager.AddValueByName("@uid", uid);
manager.AddValueByName("@fields", fields);
manager.AddValueByName("@name_case", name_case);
manager.AddValueByName("@count", count);
manager.AddValueByName("@offset", offset);
manager.AddValueByName("@lid", lid);
manager.AddValueByName("@order", order);
return new VKResponseBase(GetResponse("get"), IsXMLResponse);
}
示例11: Get
/// <summary>Возвращает список идентификаторов друзей пользователя или расширенную информацию о друзьях пользователя (при использовании параметра</summary>
/// <param name="fields">перечисленные через запятую поля анкет, необходимые для получения</param>
/// <param name="name_case">падеж для склонения имени и фамилии пользователя</param>
/// <param name="lid">идентификатор списка друзей, полученный методом friends</param>
/// <param name="count">количество друзей, которое нужно вернуть</param>
/// <param name="offset">смещение, необходимое для выборки определенного подмножества друзей</param>
/// <returns>Ответ сервера в XML или JSON формате.</returns>
public VKResponseBase Get(ProfileFields fields, NameCase name_case, System.Int64? lid = null, System.Int32? count = null, System.Int32? offset = null)
{
return get(null, fields, name_case, count, offset, lid, null);
}
示例12: Get
public ReadOnlyCollection<User> Get(long uid, ProfileFields fields = null, int? count = null, int? offset = null, FriendsOrder order = null)
{
var parameters = new VkParameters { { "uid", uid }, { "fields", fields }, { "count", count }, { "offset", offset }, { "order", order } };
var response = _vk.Call("friends.get", parameters);
if (fields != null)
return response.ToReadOnlyCollectionOf<User>(x => x);
return response.ToReadOnlyCollectionOf(id => new User { Id = id });
}
示例13: Get
public User Get(long userId, ProfileFields fields = null, NameCase nameCase = null)
{
VkErrors.ThrowIfNumberIsNegative(() => userId);
var users = Get(new[] {userId}, fields, nameCase);
return users.FirstOrDefault();
}
示例14: GetFollowers
public ReadOnlyCollection<User> GetFollowers(long? userId = null, int? count = null, int? offset = null, ProfileFields fields = null, NameCase nameCase = null)
{
VkErrors.ThrowIfNumberIsNegative(() => userId);
VkErrors.ThrowIfNumberIsNegative(() => count);
VkErrors.ThrowIfNumberIsNegative(() => offset);
var parameters = new VkParameters
{
{"user_id", userId},
{"offset", offset},
{"count", count},
{"fields", fields},
{"name_case", nameCase}
};
VkResponseArray response = _vk.Call("users.getFollowers", parameters);
// проверка: возвращается массив объектов или только идентификаторы пользователей
if (response.Count > 0 && response[0].ContainsKey("id"))
{
return response.ToReadOnlyCollectionOf<User>(x => x);
}
return response.ToReadOnlyCollectionOf(x => new User{Id = x});
}
示例15: GetAsync
public async Task<ReadOnlyCollection<User>> GetAsync([NotNull] IEnumerable<string> screenNames, ProfileFields fields = null, NameCase nameCase = null)
{
if (screenNames == null)
throw new ArgumentNullException("screenNames");
var parameters = new VkParameters
{
{ "user_ids", screenNames },
{ "fields", fields },
{ "name_case", nameCase }
};
VkResponseArray response = await _vk.CallAsync("users.get", parameters);
return response.ToReadOnlyCollectionOf<User>(x => x);
}