Exemplo n.º 1
0
		public static void SendMessage(string uid, string textmessage, Action sendMessageCompleteAction,
		                        Action<Error> errorAction)
		{
			var requestBuilder = new RequestBuilder(Context);
			requestBuilder.SetMethod("messages.send");
			requestBuilder.AddParam("uid", uid);
			requestBuilder.AddParam("message", textmessage);
			requestBuilder.SendRequest<SendMessageResult>(result => sendMessageCompleteAction.Invoke(), errorAction);
		}
Exemplo n.º 2
0
		public static void GetProfiles(string[] profileUids, Action<List<User>> getProfilesAction, Action<Error> errorAction)
		{
			var requestBuilder = new RequestBuilder(Context);
			requestBuilder.SetMethod("getProfiles");
			requestBuilder.AddParam("uids", String.Join(",", profileUids));
			requestBuilder.AddParam("fields",
			                        "uid, first_name, last_name, nickname, domain, sex, " +
			                        "bdate, city, country, timezone, photo, photo_medium, " +
			                        "photo_big, has_mobile, rate, contacts, education, online");

			requestBuilder.SendRequest<GetProfiles>(
				getProfilesResponse => getProfilesAction.Invoke(getProfilesResponse.Result.GetUserItems()), errorAction);
		}
Exemplo n.º 3
0
		public static void GetMessages(Action<List<Message>> getMessagesAction, Action<Error> errorAction)
		{
			var requestBuilder = new RequestBuilder(Context);
			requestBuilder.SetMethod("messages.getDialogs");
			requestBuilder.AddParam("count", "100");
			requestBuilder.SendRequest<GetMessages>(
				getMessagesResult => getMessagesAction.Invoke(getMessagesResult.Messages.ToList().GetMessageItems()), errorAction);
		}
Exemplo n.º 4
0
		public static void GetFriends(Action<List<User>> getFriendsAction, Action<Error> errorAction)
		{
			var requestBuilder = new RequestBuilder(Context);
			requestBuilder.SetMethod("friends.get");
			requestBuilder.AddParam("uid", Context.CurrentUserId);
			requestBuilder.SendRequest<GetFriends>(
				getFriendsResponse => GetProfiles(getFriendsResponse.Result, getFriendsAction, errorAction), errorAction);
		}
Exemplo n.º 5
0
		public static void GetMessageConversation(string uid, Action<List<Message>> getMessagesAction, Action<Error> errorAction)
		{
			var requestBuilder = new RequestBuilder(Context);
			requestBuilder.SetMethod("messages.getHistory");
			requestBuilder.AddParam("uid", uid);
			requestBuilder.SendRequest<GetMessagesHistory>(
				getMessagesResult =>
				getMessagesAction.Invoke(getMessagesResult.Messages.ToList().GetMessageItems(Context.CurrentUserId)),
				errorAction);
		}