chromium/google_apis/calendar/calendar_api_response_types.cc

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

#include "google_apis/calendar/calendar_api_response_types.h"

#include <stddef.h>

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <vector>

#include "base/containers/fixed_flat_map.h"
#include "base/json/json_value_converter.h"
#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "google_apis/common/parser_util.h"
#include "google_apis/common/time_util.h"

namespace google_apis {

namespace calendar {

namespace {
// CalendarList
constexpr char kCalendarListKind[] =;

// SingleCalendar
constexpr char kCalendarColorId[] =;
constexpr char kPrimary[] =;
constexpr char kSelected[] =;
constexpr char kSingleCalendarKind[] =;

// EventList
constexpr char kCalendarEventListKind[] =;
constexpr char kTimeZone[] =;

// DateTime
constexpr char kDateTime[] =;

// Date
constexpr char kDate[] =;

// CalendarEvent
constexpr char kAttendees[] =;
constexpr char kAttendeesOmitted[] =;
constexpr char kAttendeesResource[] =;
constexpr char kAttendeesResponseStatus[] =;
constexpr char kAttendeesSelf[] =;
constexpr char kCalendarEventKind[] =;
constexpr char kColorId[] =;
constexpr char kEnd[] =;
constexpr char kHtmlLink[] =;
constexpr char kLocation[] =;
constexpr char kStart[] =;
constexpr char kStatus[] =;
constexpr char kSummary[] =;

// Attachment
constexpr char kAttachments[] =;
constexpr char kAttachmentTitle[] =;
constexpr char kAttachmentFileUrl[] =;
constexpr char kAttachmentIconLink[] =;
constexpr char kAttachmentFileId[] =;

constexpr auto kEventStatuses =;

constexpr auto kAttendeesResponseStatuses =;

// ConferenceData
constexpr char kConferenceDataEntryPoints[] =;
constexpr char kEntryPointType[] =;
constexpr char kVideoConferenceValue[] =;
constexpr char kEntryPointUri[] =;

// Converts the event status to `EventStatus`. Returns false when it fails
// (e.g. the value is structurally different from expected).
bool ConvertEventStatus(const base::Value* value,
                        CalendarEvent::EventStatus* result) {}

// Returns user's self response status on the event, or `std::nullopt` in case
// the passed value is structurally different from expected.
std::optional<CalendarEvent::ResponseStatus> CalculateSelfResponseStatus(
    const base::Value& value) {}

// Returns true if there is another attendee other than the user that has
// not declined the meeting.
bool CalculateHasOtherAttendee(const base::Value& value) {}

// Pulls the video conference URI out of the conferenceData field, if there is
// one on the event. Returns the first one it finds or an empty GURL if there is
// none.
GURL GetConferenceDataUri(const base::Value::Dict& dict) {}

// Pulls the attachments out of the attachments field, if there is one on the
// event. Returns all attachments or an empty vector if there is none.
std::vector<Attachment> GetAttachments(const base::Value::Dict& dict) {}

// Converts the `items` field from the response. This method helps to use the
// custom conversion entrypoint `CalendarEvent::CreateFrom`.
// Returns false when the conversion fails (e.g. the value is structurally
// different from expected).
// Returns true otherwise.
bool ConvertResponseItems(const base::Value* value, CalendarEvent* event) {}

bool IsAllDayEvent(const base::Value* value, bool* result) {}

bool ConvertCalendarListResponseItems(const base::Value* value,
                                      SingleCalendar* calendar) {}

}  // namespace

DateTime::DateTime() = default;

DateTime::DateTime(const DateTime& src) = default;

DateTime& DateTime::operator=(const DateTime& src) = default;

DateTime::~DateTime() = default;

// static
void DateTime::RegisterJSONConverter(
    base::JSONValueConverter<DateTime>* converter) {}

// static
bool DateTime::CreateDateTimeFromValue(const base::Value* value,
                                       DateTime* time) {}

Attachment::Attachment() = default;

Attachment::Attachment(const Attachment&) = default;

Attachment& Attachment::operator=(const Attachment&) = default;

Attachment::Attachment(Attachment&&) noexcept = default;

Attachment& Attachment::operator=(Attachment&&) noexcept = default;

Attachment::~Attachment() = default;

CalendarEvent::CalendarEvent() = default;

CalendarEvent::~CalendarEvent() = default;

CalendarEvent::CalendarEvent(const CalendarEvent&) = default;

CalendarEvent& CalendarEvent::operator=(const CalendarEvent&) = default;

// static
void CalendarEvent::RegisterJSONConverter(
    base::JSONValueConverter<CalendarEvent>* converter) {}

int CalendarEvent::GetApproximateSizeInBytes() const {}

EventList::EventList() = default;

EventList::~EventList() = default;

// static
void EventList::RegisterJSONConverter(
    base::JSONValueConverter<EventList>* converter) {}

// static
std::unique_ptr<EventList> EventList::CreateFrom(const base::Value& value) {}

void EventList::InjectItemForTesting(std::unique_ptr<CalendarEvent> item) {}

SingleCalendar::SingleCalendar() = default;

SingleCalendar::~SingleCalendar() = default;

SingleCalendar::SingleCalendar(const SingleCalendar&) = default;

SingleCalendar& SingleCalendar::operator=(const SingleCalendar&) = default;

// static
void SingleCalendar::RegisterJSONConverter(
    base::JSONValueConverter<SingleCalendar>* converter) {}

int SingleCalendar::GetApproximateSizeInBytes() const {}

CalendarList::CalendarList() = default;

CalendarList::~CalendarList() = default;

// static
void CalendarList::RegisterJSONConverter(
    base::JSONValueConverter<CalendarList>* converter) {}

// static
std::unique_ptr<CalendarList> CalendarList::CreateFrom(
    const base::Value& value) {}

void CalendarList::InjectItemForTesting(std::unique_ptr<SingleCalendar> item) {}

}  // namespace calendar
}  // namespace google_apis