Commit 5f7b1261 authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

[Nearby] Update ListContactPeople protos and add GetDeviceState protos

- The |parent| field was removed from ListContactPeople because contacts
  are associated with an account and not a device.
- The GetDeviceState request/response protos were added to support the
  newly added RPC that checks if the user's contacts have changed since
  the device last uploaded contacts.

Bug: b/154861518
Change-Id: Ie573d84dfbb02b755c26fcc1e603c0a1dcb4b15e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2370923Reviewed-by: default avatarJames Vecore <vecore@google.com>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801804}
parent 04683f6e
...@@ -36,10 +36,8 @@ const char kDefaultNearbyShareV1HTTPHost[] = ...@@ -36,10 +36,8 @@ const char kDefaultNearbyShareV1HTTPHost[] =
const char kNearbyShareV1Path[] = "v1/"; const char kNearbyShareV1Path[] = "v1/";
const char kCheckContactsReachabilityPath[] = "contactsReachability:check"; const char kCheckContactsReachabilityPath[] = "contactsReachability:check";
const char kListContactPeoplePathSeg1[] = "users/me/devices/"; const char kListContactPeoplePath[] = "contactRecords";
const char kListContactPeoplePathSeg2[] = "/contactRecords"; const char kListPublicCertificatesPath[] = "publicCertificates";
const char kListPublicCertificatesPathSeg1[] = "users/me/devices/";
const char kListPublicCertificatesPathSeg2[] = "/publicCertificates";
const char kPageSize[] = "page_size"; const char kPageSize[] = "page_size";
const char kPageToken[] = "page_token"; const char kPageToken[] = "page_token";
...@@ -259,10 +257,8 @@ void NearbyShareClientImpl::ListContactPeople( ...@@ -259,10 +257,8 @@ void NearbyShareClientImpl::ListContactPeople(
ListContactPeopleCallback&& callback, ListContactPeopleCallback&& callback,
ErrorCallback&& error_callback) { ErrorCallback&& error_callback) {
notifier_->NotifyOfRequest(request); notifier_->NotifyOfRequest(request);
// TODO(cclem): Use correct identifier in URL MakeApiCall(CreateV1RequestUrl(kListContactPeoplePath), RequestType::kGet,
MakeApiCall(CreateV1RequestUrl(kListContactPeoplePathSeg1 + request.parent() + /*serialized_request=*/base::nullopt,
kListContactPeoplePathSeg2),
RequestType::kGet, /*serialized_request=*/base::nullopt,
ListContactPeopleRequestToQueryParameters(request), ListContactPeopleRequestToQueryParameters(request),
std::move(callback), std::move(error_callback), std::move(callback), std::move(error_callback),
GetContactsAnnotation()); GetContactsAnnotation());
...@@ -273,10 +269,8 @@ void NearbyShareClientImpl::ListPublicCertificates( ...@@ -273,10 +269,8 @@ void NearbyShareClientImpl::ListPublicCertificates(
ListPublicCertificatesCallback&& callback, ListPublicCertificatesCallback&& callback,
ErrorCallback&& error_callback) { ErrorCallback&& error_callback) {
notifier_->NotifyOfRequest(request); notifier_->NotifyOfRequest(request);
// TODO(cclem): Use correct identifier in URL
MakeApiCall( MakeApiCall(
CreateV1RequestUrl(kListPublicCertificatesPathSeg1 + request.parent() + CreateV1RequestUrl(request.parent() + "/" + kListPublicCertificatesPath),
kListPublicCertificatesPathSeg2),
RequestType::kGet, /*serialized_request=*/base::nullopt, RequestType::kGet, /*serialized_request=*/base::nullopt,
ListPublicCertificatesRequestToQueryParameters(request), ListPublicCertificatesRequestToQueryParameters(request),
std::move(callback), std::move(error_callback), std::move(callback), std::move(error_callback),
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "url/gurl.h" #include "url/gurl.h"
namespace { namespace {
const char kGet[] = "GET"; const char kGet[] = "GET";
const char kPost[] = "POST"; const char kPost[] = "POST";
const char kPatch[] = "PATCH"; const char kPatch[] = "PATCH";
...@@ -37,8 +38,7 @@ const char kAccessToken[] = "access_token"; ...@@ -37,8 +38,7 @@ const char kAccessToken[] = "access_token";
const char kAccountName1[] = "accountname1"; const char kAccountName1[] = "accountname1";
const char kContactId1[] = "contactid1"; const char kContactId1[] = "contactid1";
const char kContactId2[] = "contactid2"; const char kContactId2[] = "contactid2";
const char kDeviceName1[] = "users/me/devices/devicename1"; const char kDeviceIdPath[] = "users/me/devices/deviceid";
const char kDeviceParent1[] = "kdeviceparent1";
const char kEmail[] = "test@gmail.com"; const char kEmail[] = "test@gmail.com";
const char kEncryptedMetadataBytes1[] = "encryptedmetadatabytes1"; const char kEncryptedMetadataBytes1[] = "encryptedmetadatabytes1";
const char kImageUrl1[] = "https://example.com/image.jpg"; const char kImageUrl1[] = "https://example.com/image.jpg";
...@@ -53,8 +53,7 @@ const char kPublicKey1[] = "publickey1"; ...@@ -53,8 +53,7 @@ const char kPublicKey1[] = "publickey1";
const char kSecretId1[] = "secretid1"; const char kSecretId1[] = "secretid1";
const char kSecretId2[] = "secretid2"; const char kSecretId2[] = "secretid2";
const char kSecretKey1[] = "secretkey1"; const char kSecretKey1[] = "secretkey1";
const char kTestGoogleApisUrl[] = const char kTestGoogleApisUrl[] = "https://nearbysharing-pa.testgoogleapis.com";
"https://www.nearbysharing-pa.testgoogleapis.com";
const int32_t kNanos1 = 123123123; const int32_t kNanos1 = 123123123;
const int32_t kNanos2 = 321321321; const int32_t kNanos2 = 321321321;
const int32_t kPageSize1 = 1000; const int32_t kPageSize1 = 1000;
...@@ -367,7 +366,7 @@ class NearbyShareClientImplTest : public testing::Test, ...@@ -367,7 +366,7 @@ class NearbyShareClientImplTest : public testing::Test,
TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) { TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) {
nearbyshare::proto::UpdateDeviceResponse result_proto; nearbyshare::proto::UpdateDeviceResponse result_proto;
nearbyshare::proto::UpdateDeviceRequest request_proto; nearbyshare::proto::UpdateDeviceRequest request_proto;
request_proto.mutable_device()->set_name(kDeviceName1); request_proto.mutable_device()->set_name(kDeviceIdPath);
client_->UpdateDevice( client_->UpdateDevice(
request_proto, request_proto,
base::BindOnce( base::BindOnce(
...@@ -382,16 +381,16 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) { ...@@ -382,16 +381,16 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), GURL(std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), GURL(std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1))); std::string(kDeviceIdPath)));
nearbyshare::proto::UpdateDeviceRequest expected_request; nearbyshare::proto::UpdateDeviceRequest expected_request;
EXPECT_TRUE(expected_request.ParseFromString(serialized_request())); EXPECT_TRUE(expected_request.ParseFromString(serialized_request()));
EXPECT_EQ(kDeviceName1, expected_request.device().name()); EXPECT_EQ(kDeviceIdPath, expected_request.device().name());
nearbyshare::proto::UpdateDeviceResponse response_proto; nearbyshare::proto::UpdateDeviceResponse response_proto;
nearbyshare::proto::Device& device = *response_proto.mutable_device(); nearbyshare::proto::Device& device = *response_proto.mutable_device();
device.set_name(kDeviceName1); device.set_name(kDeviceIdPath);
device.add_contacts(); device.add_contacts();
device.mutable_contacts(0)->mutable_identifier()->set_phone_number( device.mutable_contacts(0)->mutable_identifier()->set_phone_number(
kPhoneNumber1); kPhoneNumber1);
...@@ -426,7 +425,7 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) { ...@@ -426,7 +425,7 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceSuccess) {
TEST_F(NearbyShareClientImplTest, UpdateDeviceFailure) { TEST_F(NearbyShareClientImplTest, UpdateDeviceFailure) {
nearbyshare::proto::UpdateDeviceRequest request; nearbyshare::proto::UpdateDeviceRequest request;
request.mutable_device()->set_name(kDeviceName1); request.mutable_device()->set_name(kDeviceIdPath);
NearbyShareHttpError error; NearbyShareHttpError error;
client_->UpdateDevice( client_->UpdateDevice(
...@@ -440,7 +439,7 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceFailure) { ...@@ -440,7 +439,7 @@ TEST_F(NearbyShareClientImplTest, UpdateDeviceFailure) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), GURL(std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), GURL(std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1))); std::string(kDeviceIdPath)));
FailApiCallFlow(NearbyShareHttpError::kInternalServerError); FailApiCallFlow(NearbyShareHttpError::kInternalServerError);
EXPECT_EQ(NearbyShareHttpError::kInternalServerError, error); EXPECT_EQ(NearbyShareHttpError::kInternalServerError, error);
...@@ -519,7 +518,6 @@ TEST_F(NearbyShareClientImplTest, CheckContactsReachabilityFailure) { ...@@ -519,7 +518,6 @@ TEST_F(NearbyShareClientImplTest, CheckContactsReachabilityFailure) {
TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) { TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) {
nearbyshare::proto::ListContactPeopleResponse result_proto; nearbyshare::proto::ListContactPeopleResponse result_proto;
nearbyshare::proto::ListContactPeopleRequest request_proto; nearbyshare::proto::ListContactPeopleRequest request_proto;
request_proto.set_parent(kDeviceParent1);
request_proto.set_page_size(kPageSize1); request_proto.set_page_size(kPageSize1);
request_proto.set_page_token(kPageToken1); request_proto.set_page_token(kPageToken1);
...@@ -536,9 +534,8 @@ TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) { ...@@ -536,9 +534,8 @@ TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) {
VerifyRequestNotification(request_proto); VerifyRequestNotification(request_proto);
EXPECT_EQ(kGet, http_method()); EXPECT_EQ(kGet, http_method());
EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + EXPECT_EQ(request_url(),
"/v1/users/me/devices/" + std::string(kTestGoogleApisUrl) + "/v1/contactRecords");
std::string(kDeviceParent1) + "/contactRecords");
EXPECT_EQ( EXPECT_EQ(
std::vector<std::string>{base::NumberToString(kPageSize1)}, std::vector<std::string>{base::NumberToString(kPageSize1)},
...@@ -575,7 +572,7 @@ TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) { ...@@ -575,7 +572,7 @@ TEST_F(NearbyShareClientImplTest, ListContactPeopleSuccess) {
TEST_F(NearbyShareClientImplTest, ListPublicCertificatesSuccess) { TEST_F(NearbyShareClientImplTest, ListPublicCertificatesSuccess) {
nearbyshare::proto::ListPublicCertificatesResponse result_proto; nearbyshare::proto::ListPublicCertificatesResponse result_proto;
nearbyshare::proto::ListPublicCertificatesRequest request_proto; nearbyshare::proto::ListPublicCertificatesRequest request_proto;
request_proto.set_parent(kDeviceParent1); request_proto.set_parent(kDeviceIdPath);
request_proto.set_page_size(kPageSize1); request_proto.set_page_size(kPageSize1);
request_proto.set_page_token(kPageToken1); request_proto.set_page_token(kPageToken1);
request_proto.add_secret_ids(); request_proto.add_secret_ids();
...@@ -596,9 +593,9 @@ TEST_F(NearbyShareClientImplTest, ListPublicCertificatesSuccess) { ...@@ -596,9 +593,9 @@ TEST_F(NearbyShareClientImplTest, ListPublicCertificatesSuccess) {
VerifyRequestNotification(request_proto); VerifyRequestNotification(request_proto);
EXPECT_EQ(kGet, http_method()); EXPECT_EQ(kGet, http_method());
EXPECT_EQ(request_url(), EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kTestGoogleApisUrl) + "/v1/users/me/devices/" + std::string(kDeviceIdPath) +
std::string(kDeviceParent1) + "/publicCertificates"); "/publicCertificates");
EXPECT_EQ( EXPECT_EQ(
std::vector<std::string>{base::NumberToString(kPageSize1)}, std::vector<std::string>{base::NumberToString(kPageSize1)},
...@@ -673,7 +670,7 @@ TEST_F(NearbyShareClientImplTest, FetchAccessTokenFailure) { ...@@ -673,7 +670,7 @@ TEST_F(NearbyShareClientImplTest, FetchAccessTokenFailure) {
TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) { TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) {
nearbyshare::proto::UpdateDeviceRequest request_proto; nearbyshare::proto::UpdateDeviceRequest request_proto;
request_proto.mutable_device()->set_name(kDeviceName1); request_proto.mutable_device()->set_name(kDeviceIdPath);
NearbyShareHttpError error; NearbyShareHttpError error;
client_->UpdateDevice( client_->UpdateDevice(
...@@ -687,7 +684,7 @@ TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) { ...@@ -687,7 +684,7 @@ TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1)); std::string(kDeviceIdPath));
FinishApiCallFlowRaw("Not a valid serialized response message."); FinishApiCallFlowRaw("Not a valid serialized response message.");
EXPECT_EQ(NearbyShareHttpError::kResponseMalformed, error); EXPECT_EQ(NearbyShareHttpError::kResponseMalformed, error);
...@@ -695,7 +692,7 @@ TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) { ...@@ -695,7 +692,7 @@ TEST_F(NearbyShareClientImplTest, ParseResponseProtoFailure) {
TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) { TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) {
nearbyshare::proto::UpdateDeviceRequest request_proto; nearbyshare::proto::UpdateDeviceRequest request_proto;
request_proto.mutable_device()->set_name(kDeviceName1); request_proto.mutable_device()->set_name(kDeviceIdPath);
// Make first request. // Make first request.
nearbyshare::proto::UpdateDeviceResponse result_proto; nearbyshare::proto::UpdateDeviceResponse result_proto;
...@@ -711,7 +708,7 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) { ...@@ -711,7 +708,7 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1)); std::string(kDeviceIdPath));
// With request pending, make second request. // With request pending, make second request.
{ {
...@@ -726,11 +723,11 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) { ...@@ -726,11 +723,11 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestBeforeFirstRequestSucceeds) {
// Complete first request. // Complete first request.
{ {
nearbyshare::proto::UpdateDeviceResponse response_proto; nearbyshare::proto::UpdateDeviceResponse response_proto;
response_proto.mutable_device()->set_name(kDeviceName1); response_proto.mutable_device()->set_name(kDeviceIdPath);
FinishApiCallFlow(&response_proto); FinishApiCallFlow(&response_proto);
} }
EXPECT_EQ(kDeviceName1, result_proto.device().name()); EXPECT_EQ(kDeviceIdPath, result_proto.device().name());
} }
TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) { TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) {
...@@ -738,7 +735,7 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) { ...@@ -738,7 +735,7 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) {
{ {
nearbyshare::proto::UpdateDeviceResponse result_proto; nearbyshare::proto::UpdateDeviceResponse result_proto;
nearbyshare::proto::UpdateDeviceRequest request_proto; nearbyshare::proto::UpdateDeviceRequest request_proto;
request_proto.mutable_device()->set_name(kDeviceName1); request_proto.mutable_device()->set_name(kDeviceIdPath);
client_->UpdateDevice( client_->UpdateDevice(
request_proto, request_proto,
...@@ -752,12 +749,12 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) { ...@@ -752,12 +749,12 @@ TEST_F(NearbyShareClientImplTest, MakeSecondRequestAfterFirstRequestSucceeds) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1)); std::string(kDeviceIdPath));
nearbyshare::proto::UpdateDeviceResponse response_proto; nearbyshare::proto::UpdateDeviceResponse response_proto;
response_proto.mutable_device()->set_name(kDeviceName1); response_proto.mutable_device()->set_name(kDeviceIdPath);
FinishApiCallFlow(&response_proto); FinishApiCallFlow(&response_proto);
EXPECT_EQ(kDeviceName1, result_proto.device().name()); EXPECT_EQ(kDeviceIdPath, result_proto.device().name());
} }
// Second request fails. // Second request fails.
...@@ -776,7 +773,7 @@ TEST_F(NearbyShareClientImplTest, GetAccessTokenUsed) { ...@@ -776,7 +773,7 @@ TEST_F(NearbyShareClientImplTest, GetAccessTokenUsed) {
nearbyshare::proto::UpdateDeviceResponse result_proto; nearbyshare::proto::UpdateDeviceResponse result_proto;
nearbyshare::proto::UpdateDeviceRequest request_proto; nearbyshare::proto::UpdateDeviceRequest request_proto;
request_proto.mutable_device()->set_name(kDeviceName1); request_proto.mutable_device()->set_name(kDeviceIdPath);
client_->UpdateDevice( client_->UpdateDevice(
request_proto, request_proto,
...@@ -790,7 +787,7 @@ TEST_F(NearbyShareClientImplTest, GetAccessTokenUsed) { ...@@ -790,7 +787,7 @@ TEST_F(NearbyShareClientImplTest, GetAccessTokenUsed) {
EXPECT_EQ(kPatch, http_method()); EXPECT_EQ(kPatch, http_method());
EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" + EXPECT_EQ(request_url(), std::string(kTestGoogleApisUrl) + "/v1/" +
std::string(kDeviceName1)); std::string(kDeviceIdPath));
EXPECT_EQ(kAccessToken, client_->GetAccessTokenUsed()); EXPECT_EQ(kAccessToken, client_->GetAccessTokenUsed());
} }
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
namespace { namespace {
const char kDeviceIdPrefix[] = "users/me/devices/";
void RecordContactChangeCheckResultMetrics(NearbyShareHttpResult result) { void RecordContactChangeCheckResultMetrics(NearbyShareHttpResult result) {
// TODO(https://crbug.com/1105579): Record a histogram value for each result. // TODO(https://crbug.com/1105579): Record a histogram value for each result.
} }
...@@ -149,7 +147,6 @@ void NearbyShareContactDownloaderImpl::CallListContactPeople( ...@@ -149,7 +147,6 @@ void NearbyShareContactDownloaderImpl::CallListContactPeople(
base::Unretained(this))); base::Unretained(this)));
nearbyshare::proto::ListContactPeopleRequest request; nearbyshare::proto::ListContactPeopleRequest request;
request.set_parent(kDeviceIdPrefix + device_id());
if (next_page_token) if (next_page_token)
request.set_page_token(*next_page_token); request.set_page_token(*next_page_token);
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
namespace { namespace {
const char kDeviceIdPrefix[] = "users/me/devices/";
const char kTestDeviceId[] = "test_device_id"; const char kTestDeviceId[] = "test_device_id";
const char kTestContactRecordId1[] = "contact_id_1"; const char kTestContactRecordId1[] = "contact_id_1";
const char kTestContactRecordId2[] = "contact_id_2"; const char kTestContactRecordId2[] = "contact_id_2";
...@@ -150,7 +149,6 @@ class NearbyShareContactDownloaderImplTest : public ::testing::Test { ...@@ -150,7 +149,6 @@ class NearbyShareContactDownloaderImplTest : public ::testing::Test {
const nearbyshare::proto::ListContactPeopleRequest& request = const nearbyshare::proto::ListContactPeopleRequest& request =
client->list_contact_people_requests()[0].request; client->list_contact_people_requests()[0].request;
EXPECT_EQ(std::string(kDeviceIdPrefix) + kTestDeviceId, request.parent());
EXPECT_EQ(expected_page_token.value_or(std::string()), EXPECT_EQ(expected_page_token.value_or(std::string()),
request.page_token()); request.page_token());
} }
......
// Copyright 2020 The Chromium Authors.All rights reserved. // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -142,7 +142,6 @@ base::Value ResultToReadableDictionary( ...@@ -142,7 +142,6 @@ base::Value ResultToReadableDictionary(
base::Value ListContactPeopleRequestToReadableDictionary( base::Value ListContactPeopleRequestToReadableDictionary(
const nearbyshare::proto::ListContactPeopleRequest& request) { const nearbyshare::proto::ListContactPeopleRequest& request) {
base::Value dict(base::Value::Type::DICTIONARY); base::Value dict(base::Value::Type::DICTIONARY);
dict.SetStringKey("parent", request.parent());
dict.SetIntKey("page_size", request.page_size()); dict.SetIntKey("page_size", request.page_size());
dict.SetStringKey("page_token", request.page_token()); dict.SetStringKey("page_token", request.page_token());
return dict; return dict;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Keep in sync with // Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/rpcs/contacts.proto // http://google3/google/internal/location/nearby/sharing/v1/rpcs/contacts.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987. // Messages not used in Chrome have been omitted. Last copied at cl/324307508.
syntax = "proto3"; syntax = "proto3";
...@@ -18,12 +18,9 @@ import "rpc_resources.proto"; ...@@ -18,12 +18,9 @@ import "rpc_resources.proto";
message CheckContactsReachabilityRequest { message CheckContactsReachabilityRequest {
message ReachableContact { message ReachableContact {
string contact_id = 1; string contact_id = 1;
repeated string phone_numbers = 2; repeated string phone_numbers = 2;
repeated string emails = 3; repeated string emails = 3;
} }
repeated ReachableContact contacts = 1; repeated ReachableContact contacts = 1;
} }
...@@ -38,18 +35,13 @@ message CheckContactsReachabilityResponse { ...@@ -38,18 +35,13 @@ message CheckContactsReachabilityResponse {
// Request to list ContactRecord of a user. // Request to list ContactRecord of a user.
message ListContactPeopleRequest { message ListContactPeopleRequest {
// Required. The resource name determines which contact records to list.
// The special prefix "users/me" lists the requester's own contacts. This
// is of the format "users/*/devices/*".
string parent = 1;
// Optional limit on the number of ContactRecord in // Optional limit on the number of ContactRecord in
// [ListContactPeopleResponse.contact_records]. Defaults to 2000 if not set. // [ListContactPeopleResponse.contact_records]. Defaults to 500 if not set.
int32 page_size = 2; int32 page_size = 1;
// Optional pagination token, returned earlier via // Optional pagination token, returned earlier via
// [ListContactPeopleResponse.next_page_token] // [ListContactPeopleResponse.next_page_token]
string page_token = 3; string page_token = 2;
} }
// Response from a ListContactPeopleRequest. // Response from a ListContactPeopleRequest.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Keep in sync with // Keep in sync with
// http://google3/google/internal/location/nearby/sharing/v1/rpcs/devices.proto // http://google3/google/internal/location/nearby/sharing/v1/rpcs/devices.proto
// Messages not used in Chrome have been omitted. Last copied at cl/2228987. // Messages not used in Chrome have been omitted. Last copied at cl/325953873.
syntax = "proto3"; syntax = "proto3";
...@@ -40,3 +40,18 @@ message UpdateDeviceResponse { ...@@ -40,3 +40,18 @@ message UpdateDeviceResponse {
// share target. // share target.
string image_url = 3; string image_url = 3;
} }
// Request to get a device's state.
message GetDeviceStateRequest {
// Required. The resource name determines which device's contact change
// history to check. The special prefix "users/me" lists the requester's own
// contacts. This is of the format "users/*/devices/*".
string parent = 1;
}
// Response from a GetDeviceStateRequest.
message GetDeviceStateResponse {
// True if the device's contacts have changed (out of sync) since last
// UpdateDevice call with contacts path.
bool are_contacts_changed = 1;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment