chromium/google_apis/calendar/calendar_api_requests.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_requests.h"

#include <stddef.h>

#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/memory/weak_ptr.h"
#include "base/strings/strcat.h"
#include "base/values.h"
#include "google_apis/calendar/calendar_api_response_types.h"
#include "google_apis/common/api_error_codes.h"
#include "google_apis/common/base_requests.h"
#include "google_apis/common/request_sender.h"
#include "net/base/url_util.h"

namespace google_apis {

namespace calendar {

namespace {

// For events without an event color, fill the colorId field with the color ID
// provided by the calendar.
void FillEmptyColorFields(EventList* events, const std::string& color) {}

constexpr char kFieldsParameterName[] =;

// According to the docs
// (https://developers.google.com/calendar/api/v3/reference/events/list), it
// should return the participant/requester only as an attendee.
constexpr int kMaxAttendees =;

// Requested maximum number of calendars returned. The default value is 100.
// Although the events shown to the user will be limited to a fixed number
// of selected calendars, it is best to be thorough here and filter later.
constexpr int kMaxCalendars =;

// Requested number of events returned on one result page.
// The default value on the Calendar API side is 250 events per page and some
// users have >250 events per month.
// As a short term solution increasing the number of events per page to the
// maximum allowed number (2500 / 30 = 80+ events per day should be more than
// enough).
// TODO(crbug.com/40862361): Implement pagination using `nextPageToken` from the
// response.
constexpr int kMaxResults =;

// Requested fields to be returned in the CalendarList result.
constexpr char kCalendarListFields[] =;

// Requested fields to be returned in the Event list result.
std::string GetCalendarEventListFields(bool include_attachments) {}

}  // namespace

CalendarApiGetRequest::CalendarApiGetRequest(RequestSender* sender,
                                             const std::string& fields)
    :{}

CalendarApiGetRequest::~CalendarApiGetRequest() = default;

GURL CalendarApiGetRequest::GetURL() const {}

// Maps calendar api error reason to code. See
// https://developers.google.com/calendar/api/guides/errors.
ApiErrorCode CalendarApiGetRequest::MapReasonToError(
    ApiErrorCode code,
    const std::string& reason) {}

bool CalendarApiGetRequest::IsSuccessfulErrorCode(ApiErrorCode error) {}

CalendarApiCalendarListRequest::CalendarApiCalendarListRequest(
    RequestSender* sender,
    const CalendarApiUrlGenerator& url_generator,
    CalendarListCallback callback)
    :{}

CalendarApiCalendarListRequest::~CalendarApiCalendarListRequest() = default;

GURL CalendarApiCalendarListRequest::GetURLInternal() const {}

void CalendarApiCalendarListRequest::ProcessURLFetchResults(
    const network::mojom::URLResponseHead* response_head,
    base::FilePath response_file,
    std::string response_body) {}

void CalendarApiCalendarListRequest::RunCallbackOnPrematureFailure(
    ApiErrorCode error) {}

// static
std::unique_ptr<CalendarList> CalendarApiCalendarListRequest::Parse(
    std::string json) {}

void CalendarApiCalendarListRequest::OnDataParsed(
    ApiErrorCode error,
    std::unique_ptr<CalendarList> calendars) {}

CalendarApiEventsRequest::CalendarApiEventsRequest(
    RequestSender* sender,
    const CalendarApiUrlGenerator& url_generator,
    CalendarEventListCallback callback,
    const base::Time& start_time,
    const base::Time& end_time,
    const std::string& calendar_id,
    const std::string& calendar_color_id)
    :{}

CalendarApiEventsRequest::CalendarApiEventsRequest(
    RequestSender* sender,
    const CalendarApiUrlGenerator& url_generator,
    CalendarEventListCallback callback,
    const base::Time& start_time,
    const base::Time& end_time,
    bool include_attachments)
    :{}

CalendarApiEventsRequest::CalendarApiEventsRequest(
    RequestSender* sender,
    const CalendarApiUrlGenerator& url_generator,
    CalendarEventListCallback callback,
    const base::Time& start_time,
    const base::Time& end_time,
    const std::vector<EventType>& event_types,
    const std::string& experiment,
    const std::string& order_by,
    bool include_attachments)
    :{}

CalendarApiEventsRequest::~CalendarApiEventsRequest() = default;

GURL CalendarApiEventsRequest::GetURLInternal() const {}

void CalendarApiEventsRequest::ProcessURLFetchResults(
    const network::mojom::URLResponseHead* response_head,
    base::FilePath response_file,
    std::string response_body) {}

void CalendarApiEventsRequest::RunCallbackOnPrematureFailure(
    ApiErrorCode error) {}

// static
std::unique_ptr<EventList> CalendarApiEventsRequest::Parse(std::string json) {}

void CalendarApiEventsRequest::OnDataParsed(ApiErrorCode error,
                                            std::unique_ptr<EventList> events) {}

}  // namespace calendar
}  // namespace google_apis