chromium/components/plus_addresses/plus_address_parsing_utils.cc

// Copyright 2023 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/plus_addresses/plus_address_parsing_utils.h"

#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "components/affiliations/core/browser/affiliation_utils.h"
#include "components/plus_addresses/plus_address_types.h"
#include "components/plus_addresses/webdata/plus_address_webdata_service.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "url/origin.h"

namespace plus_addresses {

namespace {

// Creates a PlusProfile for `dict` if it fits this schema (in TS notation):
// {
//   "ProfileId": string,
//   "facet": string,
//   "plusEmail": {
//     "plusAddress": string,
//     "plusMode": string,
//   }
// }
// Returns nullopt if none of the values are parsed.
std::optional<PlusProfile> ParsePlusProfileFromV1Dict(base::Value::Dict dict) {}

// Attempts to parse a string of format "[0-9]+s" into a `base::TimeDelta`.
std::optional<base::TimeDelta> ParseLifetime(std::string* str) {}

// Attempts to parse a `base::Value::Dict` into to a `PreallocatedPlusAddress`.
std::optional<PreallocatedPlusAddress> ParsePreallocatedPlusAddress(
    base::Value::Dict dict) {}

}  // namespace

std::optional<PlusProfile> ParsePlusProfileFromV1Create(
    data_decoder::DataDecoder::ValueOrError response) {}

std::optional<std::vector<PreallocatedPlusAddress>>
ParsePreallocatedPlusAddresses(
    data_decoder::DataDecoder::ValueOrError response) {}

}  // namespace plus_addresses