chromium/components/commerce/core/compare/cluster_server_proxy.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/commerce/core/compare/cluster_server_proxy.h"

#include <utility>

#include "base/json/json_reader.h"
#include "base/json/values_util.h"
#include "base/strings/string_number_conversions.h"
#include "components/commerce/core/commerce_constants.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/compare/compare_utils.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"

namespace commerce {
namespace {
// RPC timeout duration.
const int kTimeoutMs =;

// URL to get compare result.
const char kDefaultServiceBaseUrl[] =;
const char kBaseUrlParam[] =;
constexpr base::FeatureParam<std::string> kServiceBaseUrl{};

// lowerCamelCase JSON proto message keys.
const char kProductIdsKey[] =;
const char kTypeKey[] =;
const char kGPCTypeName[] =;
const char kIdentifierKey[] =;

constexpr net::NetworkTrafficAnnotationTag
    kGetComparableProductsTrafficAnnotation =;

// Deserializes a product cluster ID from JSON.
std::optional<uint64_t> Deserialize(const base::Value& value) {}

}  // namespace

ClusterServerProxy::ClusterServerProxy(
    signin::IdentityManager* identity_manager,
    const scoped_refptr<network::SharedURLLoaderFactory>& url_loader_factory)
    :{}

ClusterServerProxy::~ClusterServerProxy() = default;

void ClusterServerProxy::GetComparableProducts(
    const std::vector<uint64_t>& product_cluster_ids,
    GetComparableProductsCallback callback) {}

std::unique_ptr<EndpointFetcher> ClusterServerProxy::CreateEndpointFetcher(
    const GURL& url,
    const std::string& post_data) {}

void ClusterServerProxy::HandleCompareResponse(
    GetComparableProductsCallback callback,
    std::unique_ptr<EndpointFetcher> endpoint_fetcher,
    std::unique_ptr<EndpointResponse> response) {}

void ClusterServerProxy::OnResponseJsonParsed(
    GetComparableProductsCallback callback,
    data_decoder::DataDecoder::ValueOrError result) {}

}  // namespace commerce