public void GetSelfInfo() { GetSelfInfoRequest request = new GetSelfInfoRequest() { request_header = RequestHeaderBody }; HttpResponseMessage message = _client.PostProtoJson(_api_key, "contacts/getselfinfo", request); if (UserInformationReceived != null) { GetSelfInfoResponse response = message.Content.ReadAsProtoJson<GetSelfInfoResponse>(); CurrentUser = response.self_entity; UserInformationReceived(this,CurrentUser); } }
public async Task GetSelfInfoAsync() { GetSelfInfoRequest request = new GetSelfInfoRequest() { request_header = RequestHeaderBody, }; using (HttpResponseMessage message = await _client.PostProtoJson("contacts/getselfinfo", _api_key, request)) { if (UserInformationReceived != null) { GetSelfInfoResponse response = await message.Content.ReadAsProtoJson<GetSelfInfoResponse>(); CurrentUser = new User(response.self_entity); UserInformationReceived(this, CurrentUser); } } }