Package com.google.api.services.calendar

Source Code of com.google.api.services.calendar.Calendar$Freebusy$Query

/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This file was generated.
*  with google-apis-code-generator 1.2.0 (build: 2012-10-03 02:48:15 UTC)
*  on 2012-10-22 at 05:11:13 UTC
*/

package com.google.api.services.calendar;

import com.google.api.client.googleapis.services.GoogleClient;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpMethod;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.json.JsonHttpRequest;
import com.google.api.client.http.json.JsonHttpRequestInitializer;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.util.DateTime;
import com.google.common.base.Preconditions;

import java.io.IOException;

/**
* Service definition for Calendar (v3).
*
* <p>
* Lets you manipulate events and other calendar data.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="https://developers.google.com/google-apps/calendar/firstapp" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link JsonHttpRequestInitializer} to initialize global parameters via its
* {@link Builder}. Sample usage:
* </p>
*
* <pre>
  public class CalendarRequestInitializer implements JsonHttpRequestInitializer {
      public void initialize(JsonHttpRequest request) {
        CalendarRequest calendarRequest = (CalendarRequest)request;
        calendarRequest.setPrettyPrint(true);
        calendarRequest.setKey(ClientCredentials.KEY);
    }
  }
* </pre>
*
* @since 1.3.0
* @author Google, Inc.
*/
public class Calendar extends GoogleClient {

  /**
   * The default encoded base path of the service. This is determined when the library is generated
   * and normally should not be changed.
   * @deprecated (scheduled to be removed in 1.8) Use "/" + {@link #DEFAULT_SERVICE_PATH}.
   */
  @Deprecated
  public static final String DEFAULT_BASE_PATH = "/calendar/v3/";

  /**
   * The default encoded root URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";

  /**
   * The default encoded service path of the service. This is determined when the library is
   * generated and normally should not be changed.
   *
   * @since 1.7
   */
  public static final String DEFAULT_SERVICE_PATH = "calendar/v3/";

  /**
   * The default encoded base URL of the service. This is determined when the library is generated
   * and normally should not be changed.
   */
  public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;

  /**
   * Construct a Calendar instance to connect to the Calendar service.
   *
   * <p>
   * Use {@link Builder} if you need to specify any of the optional parameters.
   * </p>
   *
   * @param transport The transport to use for requests
   * @param jsonFactory A factory for creating JSON parsers and serializers
   * @deprecated (scheduled to be removed in 1.8) Use
   *             {@link #Calendar(HttpTransport, JsonFactory, HttpRequestInitializer)}.
   */
  @Deprecated
  public Calendar(HttpTransport transport, JsonFactory jsonFactory) {
    super(transport, jsonFactory, DEFAULT_BASE_URL);
  }

  /**
   * Construct a Calendar instance to connect to the Calendar service.
   *
   * <p>
   * Use {@link Builder} if you need to specify any of the optional parameters.
   * </p>
   *
   * @param transport The transport to use for requests
   * @param jsonFactory A factory for creating JSON parsers and serializers
   * @param httpRequestInitializer The HTTP request initializer or {@code null} for none
   * @since 1.7
   */
  public Calendar(HttpTransport transport, JsonFactory jsonFactory,
      HttpRequestInitializer httpRequestInitializer) {
    super(transport, jsonFactory, DEFAULT_ROOT_URL, DEFAULT_SERVICE_PATH, httpRequestInitializer);
  }

  /**
   * Construct a Calendar instance to connect to the Calendar service.
   *
   * @param transport The transport to use for requests
   * @param jsonHttpRequestInitializer The initializer to use when creating an JSON HTTP request
   * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest}
   * @param jsonFactory A factory for creating JSON parsers and serializers
   * @param jsonObjectParser JSON parser to use or {@code null} if unused
   * @param baseUrl The base URL of the service on the server
   * @param applicationName The application name to be sent in the User-Agent header of requests
   */
  @Deprecated
  Calendar(
      HttpTransport transport,
      JsonHttpRequestInitializer jsonHttpRequestInitializer,
      HttpRequestInitializer httpRequestInitializer,
      JsonFactory jsonFactory,
      JsonObjectParser jsonObjectParser,
      String baseUrl,
      String applicationName) {
      super(transport,
          jsonHttpRequestInitializer,
          httpRequestInitializer,
          jsonFactory,
          jsonObjectParser,
          baseUrl,
          applicationName);
  }

  /**
   * Construct a Calendar instance to connect to the Calendar service.
   *
   * @param transport The transport to use for requests
   * @param jsonHttpRequestInitializer The initializer to use when creating an JSON HTTP request
   * @param httpRequestInitializer The initializer to use when creating an {@link HttpRequest}
   * @param jsonFactory A factory for creating JSON parsers and serializers
   * @param jsonObjectParser JSON parser to use or {@code null} if unused
   * @param rootUrl The root URL of the service on the server
   * @param servicePath The service path of the service on the server
   * @param applicationName The application name to be sent in the User-Agent header of requests
   * @param suppressPatternChecks whether discovery pattern checks should be suppressed on required
   *        parameters
   */
  Calendar(
      HttpTransport transport,
      JsonHttpRequestInitializer jsonHttpRequestInitializer,
      HttpRequestInitializer httpRequestInitializer,
      JsonFactory jsonFactory,
      JsonObjectParser jsonObjectParser,
      String rootUrl,
      String servicePath,
      String applicationName,
      boolean suppressPatternChecks) {
      super(transport,
          jsonHttpRequestInitializer,
          httpRequestInitializer,
          jsonFactory,
          jsonObjectParser,
          rootUrl,
          servicePath,
          applicationName,
          suppressPatternChecks);
  }

  @Override
  protected void initialize(JsonHttpRequest jsonHttpRequest) throws IOException {
    super.initialize(jsonHttpRequest);
  }

  /**
   * Returns an instance of a new builder.
   *
   * @param transport The transport to use for requests
   * @param jsonFactory A factory for creating JSON parsers and serializers
   * @deprecated (scheduled to removed in 1.8) Use
   *             {@link Builder#Builder(HttpTransport, JsonFactory, HttpRequestInitializer)}.
   */
   @Deprecated
   public static Builder builder(HttpTransport transport, JsonFactory jsonFactory) {
     return new Builder(transport, jsonFactory, new GenericUrl(DEFAULT_BASE_URL));
   }

  /**
   * An accessor for creating requests from the Freebusy collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Freebusy.List request = calendar.freebusy().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Freebusy freebusy() {
    return new Freebusy();
  }

  /**
   * The "freebusy" collection of methods.
   */
  public class Freebusy {

    /**
     * Returns free/busy information for a set of calendars.
     *
     * Create a request for the method "freebusy.query".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Query#execute()} method to invoke the remote operation.
     *
     * @param content the {@link com.google.api.services.calendar.model.FreeBusyRequest}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Query query(com.google.api.services.calendar.model.FreeBusyRequest content) throws IOException {
      Query result = new Query(content);
      initialize(result);
      return result;
    }

    public class Query extends CalendarRequest {

      private static final String REST_PATH = "freeBusy";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Query(com.google.api.services.calendar.model.FreeBusyRequest content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "query" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.FreeBusyResponse} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.FreeBusyResponse execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.FreeBusyResponse result = response.parseAs(
            com.google.api.services.calendar.model.FreeBusyResponse.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "query" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;FreeBusyResponse&gt;() {

           public void onSuccess(FreeBusyResponse content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.FreeBusyResponse> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.FreeBusyResponse.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Query setFields(String fields) {
        super.setFields(fields);
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the Settings collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Settings.List request = calendar.settings().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Settings settings() {
    return new Settings();
  }

  /**
   * The "settings" collection of methods.
   */
  public class Settings {

    /**
     * Returns all user settings for the authenticated user.
     *
     * Create a request for the method "settings.list".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link List#execute()} method to invoke the remote operation.
     *
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public List list() throws IOException {
      List result = new List();
      initialize(result);
      return result;
    }

    public class List extends CalendarRequest {

      private static final String REST_PATH = "users/me/settings";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      List() {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
      }

      /**
       * Sends the "list" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Settings} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Settings execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Settings result = response.parseAs(
            com.google.api.services.calendar.model.Settings.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "list" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Settings&gt;() {

           public void onSuccess(Settings content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Settings> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Settings.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public List setFields(String fields) {
        super.setFields(fields);
        return this;
      }

    }
    /**
     * Returns a single user setting.
     *
     * Create a request for the method "settings.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @param setting Name of the user setting.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get(String setting) throws IOException {
      Get result = new Get(setting);
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "users/me/settings/{setting}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get(String setting) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.setting = Preconditions.checkNotNull(setting, "Required parameter setting must be specified.");
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Setting} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Setting execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Setting result = response.parseAs(
            com.google.api.services.calendar.model.Setting.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Setting&gt;() {

           public void onSuccess(Setting content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Setting> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Setting.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Name of the user setting. */
      @com.google.api.client.util.Key
      private String setting;

      /** Name of the user setting.
       */
      public String getSetting() {
        return setting;
      }

      /** Name of the user setting. */
      public Get setSetting(String setting) {
        this.setting = setting;
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the CalendarList collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.CalendarList.List request = calendar.calendarList().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public CalendarList calendarList() {
    return new CalendarList();
  }

  /**
   * The "calendarList" collection of methods.
   */
  public class CalendarList {

    /**
     * Adds an entry to the user's calendar list.
     *
     * Create a request for the method "calendarList.insert".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Insert#execute()} method to invoke the remote operation.
     *
     * @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Insert insert(com.google.api.services.calendar.model.CalendarListEntry content) throws IOException {
      Insert result = new Insert(content);
      initialize(result);
      return result;
    }

    public class Insert extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Insert(com.google.api.services.calendar.model.CalendarListEntry content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "insert" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.CalendarListEntry} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.CalendarListEntry execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.CalendarListEntry result = response.parseAs(
            com.google.api.services.calendar.model.CalendarListEntry.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "insert" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;CalendarListEntry&gt;() {

           public void onSuccess(CalendarListEntry content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.CalendarListEntry> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.CalendarListEntry.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Insert setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean colorRgbFormat;

      /** Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors (RGB).
     If this feature is used, the index-based 'color' field will be set to the best matching option
     automatically. Optional. The default is False.
       */
      public Boolean getColorRgbFormat() {
        return colorRgbFormat;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      public Insert setColorRgbFormat(Boolean colorRgbFormat) {
        this.colorRgbFormat = colorRgbFormat;
        return this;
      }

    }
    /**
     * Returns an entry on the user's calendar list.
     *
     * Create a request for the method "calendarList.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get(String calendarId) throws IOException {
      Get result = new Get(calendarId);
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get(String calendarId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.CalendarListEntry} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.CalendarListEntry execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.CalendarListEntry result = response.parseAs(
            com.google.api.services.calendar.model.CalendarListEntry.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;CalendarListEntry&gt;() {

           public void onSuccess(CalendarListEntry content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.CalendarListEntry> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.CalendarListEntry.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Get setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Returns entries on the user's calendar list.
     *
     * Create a request for the method "calendarList.list".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link List#execute()} method to invoke the remote operation.
     *
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public List list() throws IOException {
      List result = new List();
      initialize(result);
      return result;
    }

    public class List extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      List() {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
      }

      /**
       * Sends the "list" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.CalendarList} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.CalendarList execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.CalendarList result = response.parseAs(
            com.google.api.services.calendar.model.CalendarList.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "list" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;CalendarList&gt;() {

           public void onSuccess(CalendarList content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.CalendarList> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.CalendarList.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public List setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Token specifying which result page to return. Optional. */
      @com.google.api.client.util.Key
      private String pageToken;

      /** Token specifying which result page to return. Optional.
       */
      public String getPageToken() {
        return pageToken;
      }

      /** Token specifying which result page to return. Optional. */
      public List setPageToken(String pageToken) {
        this.pageToken = pageToken;
        return this;
      }

      /** Whether to show hidden entries. Optional. The default is False. */
      @com.google.api.client.util.Key
      private Boolean showHidden;

      /** Whether to show hidden entries. Optional. The default is False.
       */
      public Boolean getShowHidden() {
        return showHidden;
      }

      /** Whether to show hidden entries. Optional. The default is False. */
      public List setShowHidden(Boolean showHidden) {
        this.showHidden = showHidden;
        return this;
      }

      /** Maximum number of entries returned on one result page. Optional. */
      @com.google.api.client.util.Key
      private Integer maxResults;

      /** Maximum number of entries returned on one result page. Optional.

     [minimum: 1]
       */
      public Integer getMaxResults() {
        return maxResults;
      }

      /** Maximum number of entries returned on one result page. Optional. */
      public List setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
        return this;
      }

      /**
     * The minimum access role for the user in the returned entires. Optional. The default is no
     * restriction.
     */
      @com.google.api.client.util.Key
      private String minAccessRole;

      /** The minimum access role for the user in the returned entires. Optional. The default is no
     restriction.
       */
      public String getMinAccessRole() {
        return minAccessRole;
      }

      /**
     * The minimum access role for the user in the returned entires. Optional. The default is no
     * restriction.
     */
      public List setMinAccessRole(String minAccessRole) {
        this.minAccessRole = minAccessRole;
        return this;
      }

    }
    /**
     * Updates an entry on the user's calendar list.
     *
     * Create a request for the method "calendarList.update".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Update#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Update update(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws IOException {
      Update result = new Update(calendarId, content);
      initialize(result);
      return result;
    }

    public class Update extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Update(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
        super(Calendar.this, HttpMethod.PUT, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "update" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.CalendarListEntry} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.CalendarListEntry execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.CalendarListEntry result = response.parseAs(
            com.google.api.services.calendar.model.CalendarListEntry.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "update" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;CalendarListEntry&gt;() {

           public void onSuccess(CalendarListEntry content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.CalendarListEntry> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.CalendarListEntry.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Update setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Update setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean colorRgbFormat;

      /** Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors (RGB).
     If this feature is used, the index-based 'color' field will be set to the best matching option
     automatically. Optional. The default is False.
       */
      public Boolean getColorRgbFormat() {
        return colorRgbFormat;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      public Update setColorRgbFormat(Boolean colorRgbFormat) {
        this.colorRgbFormat = colorRgbFormat;
        return this;
      }

    }
    /**
     * Updates an entry on the user's calendar list. This method supports patch semantics.
     *
     * Create a request for the method "calendarList.patch".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Patch#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.CalendarListEntry}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Patch patch(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) throws IOException {
      Patch result = new Patch(calendarId, content);
      initialize(result);
      return result;
    }

    public class Patch extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Patch(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content) {
        super(Calendar.this, HttpMethod.PATCH, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "patch" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.CalendarListEntry} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.CalendarListEntry execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.CalendarListEntry result = response.parseAs(
            com.google.api.services.calendar.model.CalendarListEntry.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "patch" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;CalendarListEntry&gt;() {

           public void onSuccess(CalendarListEntry content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.CalendarListEntry> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.CalendarListEntry.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Patch setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Patch setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean colorRgbFormat;

      /** Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors (RGB).
     If this feature is used, the index-based 'color' field will be set to the best matching option
     automatically. Optional. The default is False.
       */
      public Boolean getColorRgbFormat() {
        return colorRgbFormat;
      }

      /**
     * Whether to use the 'frontendColor' and 'backgroundColor' fields to write the calendar colors
     * (RGB). If this feature is used, the index-based 'color' field will be set to the best
     * matching option automatically. Optional. The default is False.
     */
      public Patch setColorRgbFormat(Boolean colorRgbFormat) {
        this.colorRgbFormat = colorRgbFormat;
        return this;
      }

    }
    /**
     * Deletes an entry on the user's calendar list.
     *
     * Create a request for the method "calendarList.delete".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Delete delete(String calendarId) throws IOException {
      Delete result = new Delete(calendarId);
      initialize(result);
      return result;
    }

    public class Delete extends CalendarRequest {

      private static final String REST_PATH = "users/me/calendarList/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Delete(String calendarId) {
        super(Calendar.this, HttpMethod.DELETE, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "delete" request to the Calendar server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }

      /**
       * Queues the "delete" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Void&gt;() {

           public void onSuccess(Void content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<Void> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), Void.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Delete setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Delete setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the Calendars collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Calendars.List request = calendar.calendars().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Calendars calendars() {
    return new Calendars();
  }

  /**
   * The "calendars" collection of methods.
   */
  public class Calendars {

    /**
     * Creates a secondary calendar.
     *
     * Create a request for the method "calendars.insert".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Insert#execute()} method to invoke the remote operation.
     *
     * @param content the {@link com.google.api.services.calendar.model.Calendar}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Insert insert(com.google.api.services.calendar.model.Calendar content) throws IOException {
      Insert result = new Insert(content);
      initialize(result);
      return result;
    }

    public class Insert extends CalendarRequest {

      private static final String REST_PATH = "calendars";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Insert(com.google.api.services.calendar.model.Calendar content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "insert" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Calendar} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Calendar execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Calendar result = response.parseAs(
            com.google.api.services.calendar.model.Calendar.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "insert" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Calendar&gt;() {

           public void onSuccess(Calendar content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Calendar> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Calendar.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Insert setFields(String fields) {
        super.setFields(fields);
        return this;
      }

    }
    /**
     * Returns metadata for a calendar.
     *
     * Create a request for the method "calendars.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get(String calendarId) throws IOException {
      Get result = new Get(calendarId);
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get(String calendarId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Calendar} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Calendar execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Calendar result = response.parseAs(
            com.google.api.services.calendar.model.Calendar.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Calendar&gt;() {

           public void onSuccess(Calendar content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Calendar> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Calendar.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Get setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Clears a primary calendar. This operation deletes all data associated with the primary calendar
     * of an account and cannot be undone.
     *
     * Create a request for the method "calendars.clear".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Clear#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Clear clear(String calendarId) throws IOException {
      Clear result = new Clear(calendarId);
      initialize(result);
      return result;
    }

    public class Clear extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/clear";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Clear(String calendarId) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "clear" request to the Calendar server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }

      /**
       * Queues the "clear" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Void&gt;() {

           public void onSuccess(Void content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<Void> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), Void.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Clear setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Clear setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Updates metadata for a calendar.
     *
     * Create a request for the method "calendars.update".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Update#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.Calendar}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Update update(String calendarId, com.google.api.services.calendar.model.Calendar content) throws IOException {
      Update result = new Update(calendarId, content);
      initialize(result);
      return result;
    }

    public class Update extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Update(String calendarId, com.google.api.services.calendar.model.Calendar content) {
        super(Calendar.this, HttpMethod.PUT, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "update" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Calendar} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Calendar execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Calendar result = response.parseAs(
            com.google.api.services.calendar.model.Calendar.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "update" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Calendar&gt;() {

           public void onSuccess(Calendar content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Calendar> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Calendar.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Update setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Update setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Updates metadata for a calendar. This method supports patch semantics.
     *
     * Create a request for the method "calendars.patch".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Patch#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.Calendar}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Patch patch(String calendarId, com.google.api.services.calendar.model.Calendar content) throws IOException {
      Patch result = new Patch(calendarId, content);
      initialize(result);
      return result;
    }

    public class Patch extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Patch(String calendarId, com.google.api.services.calendar.model.Calendar content) {
        super(Calendar.this, HttpMethod.PATCH, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "patch" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Calendar} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Calendar execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Calendar result = response.parseAs(
            com.google.api.services.calendar.model.Calendar.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "patch" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Calendar&gt;() {

           public void onSuccess(Calendar content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Calendar> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Calendar.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Patch setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Patch setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Deletes a secondary calendar.
     *
     * Create a request for the method "calendars.delete".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Delete delete(String calendarId) throws IOException {
      Delete result = new Delete(calendarId);
      initialize(result);
      return result;
    }

    public class Delete extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Delete(String calendarId) {
        super(Calendar.this, HttpMethod.DELETE, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "delete" request to the Calendar server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }

      /**
       * Queues the "delete" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Void&gt;() {

           public void onSuccess(Void content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<Void> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), Void.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Delete setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Delete setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the Acl collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Acl.List request = calendar.acl().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Acl acl() {
    return new Acl();
  }

  /**
   * The "acl" collection of methods.
   */
  public class Acl {

    /**
     * Creates an access control rule.
     *
     * Create a request for the method "acl.insert".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Insert#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.AclRule}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Insert insert(String calendarId, com.google.api.services.calendar.model.AclRule content) throws IOException {
      Insert result = new Insert(calendarId, content);
      initialize(result);
      return result;
    }

    public class Insert extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Insert(String calendarId, com.google.api.services.calendar.model.AclRule content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "insert" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.AclRule} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.AclRule execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.AclRule result = response.parseAs(
            com.google.api.services.calendar.model.AclRule.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "insert" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;AclRule&gt;() {

           public void onSuccess(AclRule content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.AclRule> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.AclRule.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Insert setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Insert setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Returns an access control rule.
     *
     * Create a request for the method "acl.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param ruleId ACL rule identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get(String calendarId, String ruleId) throws IOException {
      Get result = new Get(calendarId, ruleId);
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get(String calendarId, String ruleId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.ruleId = Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.AclRule} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.AclRule execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.AclRule result = response.parseAs(
            com.google.api.services.calendar.model.AclRule.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;AclRule&gt;() {

           public void onSuccess(AclRule content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.AclRule> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.AclRule.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Get setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** ACL rule identifier. */
      @com.google.api.client.util.Key
      private String ruleId;

      /** ACL rule identifier.
       */
      public String getRuleId() {
        return ruleId;
      }

      /** ACL rule identifier. */
      public Get setRuleId(String ruleId) {
        this.ruleId = ruleId;
        return this;
      }

    }
    /**
     * Returns the rules in the access control list for the calendar.
     *
     * Create a request for the method "acl.list".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link List#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public List list(String calendarId) throws IOException {
      List result = new List(calendarId);
      initialize(result);
      return result;
    }

    public class List extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      List(String calendarId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "list" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Acl} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Acl execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Acl result = response.parseAs(
            com.google.api.services.calendar.model.Acl.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "list" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Acl&gt;() {

           public void onSuccess(Acl content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Acl> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Acl.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public List setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public List setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Updates an access control rule.
     *
     * Create a request for the method "acl.update".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Update#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param ruleId ACL rule identifier.
     * @param content the {@link com.google.api.services.calendar.model.AclRule}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Update update(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content) throws IOException {
      Update result = new Update(calendarId, ruleId, content);
      initialize(result);
      return result;
    }

    public class Update extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Update(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content) {
        super(Calendar.this, HttpMethod.PUT, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.ruleId = Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "update" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.AclRule} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.AclRule execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.AclRule result = response.parseAs(
            com.google.api.services.calendar.model.AclRule.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "update" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;AclRule&gt;() {

           public void onSuccess(AclRule content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.AclRule> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.AclRule.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Update setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Update setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** ACL rule identifier. */
      @com.google.api.client.util.Key
      private String ruleId;

      /** ACL rule identifier.
       */
      public String getRuleId() {
        return ruleId;
      }

      /** ACL rule identifier. */
      public Update setRuleId(String ruleId) {
        this.ruleId = ruleId;
        return this;
      }

    }
    /**
     * Updates an access control rule. This method supports patch semantics.
     *
     * Create a request for the method "acl.patch".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Patch#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param ruleId ACL rule identifier.
     * @param content the {@link com.google.api.services.calendar.model.AclRule}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Patch patch(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content) throws IOException {
      Patch result = new Patch(calendarId, ruleId, content);
      initialize(result);
      return result;
    }

    public class Patch extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Patch(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content) {
        super(Calendar.this, HttpMethod.PATCH, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.ruleId = Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "patch" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.AclRule} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.AclRule execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.AclRule result = response.parseAs(
            com.google.api.services.calendar.model.AclRule.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "patch" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;AclRule&gt;() {

           public void onSuccess(AclRule content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.AclRule> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.AclRule.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Patch setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Patch setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** ACL rule identifier. */
      @com.google.api.client.util.Key
      private String ruleId;

      /** ACL rule identifier.
       */
      public String getRuleId() {
        return ruleId;
      }

      /** ACL rule identifier. */
      public Patch setRuleId(String ruleId) {
        this.ruleId = ruleId;
        return this;
      }

    }
    /**
     * Deletes an access control rule.
     *
     * Create a request for the method "acl.delete".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param ruleId ACL rule identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Delete delete(String calendarId, String ruleId) throws IOException {
      Delete result = new Delete(calendarId, ruleId);
      initialize(result);
      return result;
    }

    public class Delete extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/acl/{ruleId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Delete(String calendarId, String ruleId) {
        super(Calendar.this, HttpMethod.DELETE, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.ruleId = Preconditions.checkNotNull(ruleId, "Required parameter ruleId must be specified.");
      }

      /**
       * Sends the "delete" request to the Calendar server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }

      /**
       * Queues the "delete" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Void&gt;() {

           public void onSuccess(Void content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<Void> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), Void.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Delete setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Delete setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** ACL rule identifier. */
      @com.google.api.client.util.Key
      private String ruleId;

      /** ACL rule identifier.
       */
      public String getRuleId() {
        return ruleId;
      }

      /** ACL rule identifier. */
      public Delete setRuleId(String ruleId) {
        this.ruleId = ruleId;
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the Colors collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Colors.List request = calendar.colors().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Colors colors() {
    return new Colors();
  }

  /**
   * The "colors" collection of methods.
   */
  public class Colors {

    /**
     * Returns the color definitions for calendars and events.
     *
     * Create a request for the method "colors.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get() throws IOException {
      Get result = new Get();
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "colors";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get() {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Colors} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Colors execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Colors result = response.parseAs(
            com.google.api.services.calendar.model.Colors.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Colors&gt;() {

           public void onSuccess(Colors content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Colors> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Colors.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

    }

  }

  /**
   * An accessor for creating requests from the Events collection.
   *
   * The typical use is:<pre>
   *   {@code Calendar calendar = new Calendar(...);}
   *   {@code Calendar.Events.List request = calendar.events().list(parameters ...)}</pre>
   *
   * @return the resource collection
   */
  public Events events() {
    return new Events();
  }

  /**
   * The "events" collection of methods.
   */
  public class Events {

    /**
     * Creates an event.
     *
     * Create a request for the method "events.insert".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Insert#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.Event}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Insert insert(String calendarId, com.google.api.services.calendar.model.Event content) throws IOException {
      Insert result = new Insert(calendarId, content);
      initialize(result);
      return result;
    }

    public class Insert extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Insert(String calendarId, com.google.api.services.calendar.model.Event content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "insert" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "insert" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Insert setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Insert setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /**
     * Whether to send notifications about the creation of the new event. Optional. The default is
     * False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the creation of the new event. Optional. The default is False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the creation of the new event. Optional. The default is
     * False.
     */
      public Insert setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }
    /**
     * Returns an event.
     *
     * Create a request for the method "events.get".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Get#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param eventId Event identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Get get(String calendarId, String eventId) throws IOException {
      Get result = new Get(calendarId, eventId);
      initialize(result);
      return result;
    }

    public class Get extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Get(String calendarId, String eventId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
      }

      /**
       * Sends the "get" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "get" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Get setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Get setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Event identifier. */
      public Get setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      @com.google.api.client.util.Key
      private String timeZone;

      /** Time zone used in the response. Optional. The default is the time zone of the calendar.
       */
      public String getTimeZone() {
        return timeZone;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      public Get setTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean alwaysIncludeEmail;

      /** Whether to always include a value in the "email" field for the organizer, creator and attendees,
     even if no real email is available (i.e. a generated, non-working value will be provided). The use
     of this option is discouraged and should only be used by clients which cannot handle the absence of
     an email address value in the mentioned places. Optional. The default is False.
       */
      public Boolean getAlwaysIncludeEmail() {
        return alwaysIncludeEmail;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      public Get setAlwaysIncludeEmail(Boolean alwaysIncludeEmail) {
        this.alwaysIncludeEmail = alwaysIncludeEmail;
        return this;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      @com.google.api.client.util.Key
      private Integer maxAttendees;

      /** The maximum number of attendees to include in the response. If there are more than the specified
     number of attendees, only the participant is returned. Optional.

     [minimum: 1]
       */
      public Integer getMaxAttendees() {
        return maxAttendees;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      public Get setMaxAttendees(Integer maxAttendees) {
        this.maxAttendees = maxAttendees;
        return this;
      }

    }
    /**
     * Moves an event to another calendar, i.e. changes an event's organizer.
     *
     * Create a request for the method "events.move".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Move#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier of the source calendar where the event currently is on.
     * @param eventId Event identifier.
     * @param destination Calendar identifier of the target calendar where the event is to be moved to.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Move move(String calendarId, String eventId, String destination) throws IOException {
      Move result = new Move(calendarId, eventId, destination);
      initialize(result);
      return result;
    }

    public class Move extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/move";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Move(String calendarId, String eventId, String destination) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
        this.destination = Preconditions.checkNotNull(destination, "Required parameter destination must be specified.");
      }

      /**
       * Sends the "move" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "move" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Move setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier of the source calendar where the event currently is on. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier of the source calendar where the event currently is on.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier of the source calendar where the event currently is on. */
      public Move setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Event identifier. */
      public Move setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /** Calendar identifier of the target calendar where the event is to be moved to. */
      @com.google.api.client.util.Key
      private String destination;

      /** Calendar identifier of the target calendar where the event is to be moved to.
       */
      public String getDestination() {
        return destination;
      }

      /** Calendar identifier of the target calendar where the event is to be moved to. */
      public Move setDestination(String destination) {
        this.destination = destination;
        return this;
      }

      /**
     * Whether to send notifications about the change of the event's organizer. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the change of the event's organizer. Optional. The default is
     False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the change of the event's organizer. Optional. The
     * default is False.
     */
      public Move setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }
    /**
     * Returns events on the specified calendar.
     *
     * Create a request for the method "events.list".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link List#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public List list(String calendarId) throws IOException {
      List result = new List(calendarId);
      initialize(result);
      return result;
    }

    public class List extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      List(String calendarId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
      }

      /**
       * Sends the "list" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Events} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Events execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Events result = response.parseAs(
            com.google.api.services.calendar.model.Events.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "list" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Events&gt;() {

           public void onSuccess(Events content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Events> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Events.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public List setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public List setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /**
     * The order of the events returned in the result. Optional. The default is an unspecified,
     * stable order.
     */
      @com.google.api.client.util.Key
      private String orderBy;

      /** The order of the events returned in the result. Optional. The default is an unspecified, stable
     order.
       */
      public String getOrderBy() {
        return orderBy;
      }

      /**
     * The order of the events returned in the result. Optional. The default is an unspecified,
     * stable order.
     */
      public List setOrderBy(String orderBy) {
        this.orderBy = orderBy;
        return this;
      }

      /** Whether to include hidden invitations in the result. Optional. The default is False. */
      @com.google.api.client.util.Key
      private Boolean showHiddenInvitations;

      /** Whether to include hidden invitations in the result. Optional. The default is False.
       */
      public Boolean getShowHiddenInvitations() {
        return showHiddenInvitations;
      }

      /** Whether to include hidden invitations in the result. Optional. The default is False. */
      public List setShowHiddenInvitations(Boolean showHiddenInvitations) {
        this.showHiddenInvitations = showHiddenInvitations;
        return this;
      }

      /**
     * Whether to include deleted single events (with 'status' equals 'cancelled') in the result.
     * Cancelled instances of recurring events will still be included if 'singleEvents' is False.
     * Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean showDeleted;

      /** Whether to include deleted single events (with 'status' equals 'cancelled') in the result.
     Cancelled instances of recurring events will still be included if 'singleEvents' is False.
     Optional. The default is False.
       */
      public Boolean getShowDeleted() {
        return showDeleted;
      }

      /**
     * Whether to include deleted single events (with 'status' equals 'cancelled') in the result.
     * Cancelled instances of recurring events will still be included if 'singleEvents' is False.
     * Optional. The default is False.
     */
      public List setShowDeleted(Boolean showDeleted) {
        this.showDeleted = showDeleted;
        return this;
      }

      /** Specifies iCalendar UID (iCalUID) of events to be included in the response. Optional. */
      @com.google.api.client.util.Key
      private String iCalUID;

      /** Specifies iCalendar UID (iCalUID) of events to be included in the response. Optional.
       */
      public String getICalUID() {
        return iCalUID;
      }

      /** Specifies iCalendar UID (iCalUID) of events to be included in the response. Optional. */
      public List setICalUID(String iCalUID) {
        this.iCalUID = iCalUID;
        return this;
      }

      /**
     * Lower bound for an event's last modification time (as a RFC 3339 timestamp) to filter by.
     * Optional. The default is not to filter by last modification time.
     */
      @com.google.api.client.util.Key
      private DateTime updatedMin;

      /** Lower bound for an event's last modification time (as a RFC 3339 timestamp) to filter by. Optional.
     The default is not to filter by last modification time.
       */
      public DateTime getUpdatedMin() {
        return updatedMin;
      }

      /**
     * Lower bound for an event's last modification time (as a RFC 3339 timestamp) to filter by.
     * Optional. The default is not to filter by last modification time.
     */
      public List setUpdatedMin(DateTime updatedMin) {
        this.updatedMin = updatedMin;
        return this;
      }

      /**
     * Whether to expand recurring events into instances and only return single one-off events and
     * instances of recurring events, but not the underlying recurring events themselves. Optional.
     * The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean singleEvents;

      /** Whether to expand recurring events into instances and only return single one-off events and
     instances of recurring events, but not the underlying recurring events themselves. Optional. The
     default is False.
       */
      public Boolean getSingleEvents() {
        return singleEvents;
      }

      /**
     * Whether to expand recurring events into instances and only return single one-off events and
     * instances of recurring events, but not the underlying recurring events themselves. Optional.
     * The default is False.
     */
      public List setSingleEvents(Boolean singleEvents) {
        this.singleEvents = singleEvents;
        return this;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean alwaysIncludeEmail;

      /** Whether to always include a value in the "email" field for the organizer, creator and attendees,
     even if no real email is available (i.e. a generated, non-working value will be provided). The use
     of this option is discouraged and should only be used by clients which cannot handle the absence of
     an email address value in the mentioned places. Optional. The default is False.
       */
      public Boolean getAlwaysIncludeEmail() {
        return alwaysIncludeEmail;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      public List setAlwaysIncludeEmail(Boolean alwaysIncludeEmail) {
        this.alwaysIncludeEmail = alwaysIncludeEmail;
        return this;
      }

      /** Maximum number of events returned on one result page. Optional. */
      @com.google.api.client.util.Key
      private Integer maxResults;

      /** Maximum number of events returned on one result page. Optional.

     [minimum: 1]
       */
      public Integer getMaxResults() {
        return maxResults;
      }

      /** Maximum number of events returned on one result page. Optional. */
      public List setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
        return this;
      }

      /**
     * Free text search terms to find events that match these terms in any field, except for
     * extended properties. Optional.
     */
      @com.google.api.client.util.Key
      private String q;

      /** Free text search terms to find events that match these terms in any field, except for extended
     properties. Optional.
       */
      public String getQ() {
        return q;
      }

      /**
     * Free text search terms to find events that match these terms in any field, except for
     * extended properties. Optional.
     */
      public List setQ(String q) {
        this.q = q;
        return this;
      }

      /** Token specifying which result page to return. Optional. */
      @com.google.api.client.util.Key
      private String pageToken;

      /** Token specifying which result page to return. Optional.
       */
      public String getPageToken() {
        return pageToken;
      }

      /** Token specifying which result page to return. Optional. */
      public List setPageToken(String pageToken) {
        this.pageToken = pageToken;
        return this;
      }

      /**
     * Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to
     * filter by end time.
     */
      @com.google.api.client.util.Key
      private DateTime timeMin;

      /** Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to
     filter by end time.
       */
      public DateTime getTimeMin() {
        return timeMin;
      }

      /**
     * Lower bound (inclusive) for an event's end time to filter by. Optional. The default is not to
     * filter by end time.
     */
      public List setTimeMin(DateTime timeMin) {
        this.timeMin = timeMin;
        return this;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      @com.google.api.client.util.Key
      private String timeZone;

      /** Time zone used in the response. Optional. The default is the time zone of the calendar.
       */
      public String getTimeZone() {
        return timeZone;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      public List setTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
      }

      /**
     * Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not
     * to filter by start time.
     */
      @com.google.api.client.util.Key
      private DateTime timeMax;

      /** Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not to
     filter by start time.
       */
      public DateTime getTimeMax() {
        return timeMax;
      }

      /**
     * Upper bound (exclusive) for an event's start time to filter by. Optional. The default is not
     * to filter by start time.
     */
      public List setTimeMax(DateTime timeMax) {
        this.timeMax = timeMax;
        return this;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      @com.google.api.client.util.Key
      private Integer maxAttendees;

      /** The maximum number of attendees to include in the response. If there are more than the specified
     number of attendees, only the participant is returned. Optional.

     [minimum: 1]
       */
      public Integer getMaxAttendees() {
        return maxAttendees;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      public List setMaxAttendees(Integer maxAttendees) {
        this.maxAttendees = maxAttendees;
        return this;
      }

    }
    /**
     * Updates an event.
     *
     * Create a request for the method "events.update".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Update#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param eventId Event identifier.
     * @param content the {@link com.google.api.services.calendar.model.Event}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Update update(String calendarId, String eventId, com.google.api.services.calendar.model.Event content) throws IOException {
      Update result = new Update(calendarId, eventId, content);
      initialize(result);
      return result;
    }

    public class Update extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Update(String calendarId, String eventId, com.google.api.services.calendar.model.Event content) {
        super(Calendar.this, HttpMethod.PUT, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "update" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "update" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Update setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Update setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Event identifier. */
      public Update setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean alwaysIncludeEmail;

      /** Whether to always include a value in the "email" field for the organizer, creator and attendees,
     even if no real email is available (i.e. a generated, non-working value will be provided). The use
     of this option is discouraged and should only be used by clients which cannot handle the absence of
     an email address value in the mentioned places. Optional. The default is False.
       */
      public Boolean getAlwaysIncludeEmail() {
        return alwaysIncludeEmail;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      public Update setAlwaysIncludeEmail(Boolean alwaysIncludeEmail) {
        this.alwaysIncludeEmail = alwaysIncludeEmail;
        return this;
      }

      /**
     * Whether to send notifications about the event update (e.g. attendee's responses, title
     * changes, etc.). Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the event update (e.g. attendee's responses, title changes,
     etc.). Optional. The default is False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the event update (e.g. attendee's responses, title
     * changes, etc.). Optional. The default is False.
     */
      public Update setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }
    /**
     * Updates an event. This method supports patch semantics.
     *
     * Create a request for the method "events.patch".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Patch#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param eventId Event identifier.
     * @param content the {@link com.google.api.services.calendar.model.Event}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Patch patch(String calendarId, String eventId, com.google.api.services.calendar.model.Event content) throws IOException {
      Patch result = new Patch(calendarId, eventId, content);
      initialize(result);
      return result;
    }

    public class Patch extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Patch(String calendarId, String eventId, com.google.api.services.calendar.model.Event content) {
        super(Calendar.this, HttpMethod.PATCH, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "patch" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "patch" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Patch setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Patch setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Event identifier. */
      public Patch setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean alwaysIncludeEmail;

      /** Whether to always include a value in the "email" field for the organizer, creator and attendees,
     even if no real email is available (i.e. a generated, non-working value will be provided). The use
     of this option is discouraged and should only be used by clients which cannot handle the absence of
     an email address value in the mentioned places. Optional. The default is False.
       */
      public Boolean getAlwaysIncludeEmail() {
        return alwaysIncludeEmail;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      public Patch setAlwaysIncludeEmail(Boolean alwaysIncludeEmail) {
        this.alwaysIncludeEmail = alwaysIncludeEmail;
        return this;
      }

      /**
     * Whether to send notifications about the event update (e.g. attendee's responses, title
     * changes, etc.). Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the event update (e.g. attendee's responses, title changes,
     etc.). Optional. The default is False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the event update (e.g. attendee's responses, title
     * changes, etc.). Optional. The default is False.
     */
      public Patch setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }
    /**
     * Returns instances of the specified recurring event.
     *
     * Create a request for the method "events.instances".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Instances#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param eventId Recurring event identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Instances instances(String calendarId, String eventId) throws IOException {
      Instances result = new Instances(calendarId, eventId);
      initialize(result);
      return result;
    }

    public class Instances extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}/instances";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Instances(String calendarId, String eventId) {
        super(Calendar.this, HttpMethod.GET, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
      }

      /**
       * Sends the "instances" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Events} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Events execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Events result = response.parseAs(
            com.google.api.services.calendar.model.Events.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "instances" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Events&gt;() {

           public void onSuccess(Events content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Events> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Events.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Instances setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Instances setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Recurring event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Recurring event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Recurring event identifier. */
      public Instances setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /**
     * Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result.
     * Optional. The default is False.
     */
      @com.google.api.client.util.Key
      private Boolean showDeleted;

      /** Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result. Optional.
     The default is False.
       */
      public Boolean getShowDeleted() {
        return showDeleted;
      }

      /**
     * Whether to include deleted events (with 'eventStatus' equals 'cancelled') in the result.
     * Optional. The default is False.
     */
      public Instances setShowDeleted(Boolean showDeleted) {
        this.showDeleted = showDeleted;
        return this;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      @com.google.api.client.util.Key
      private Boolean alwaysIncludeEmail;

      /** Whether to always include a value in the "email" field for the organizer, creator and attendees,
     even if no real email is available (i.e. a generated, non-working value will be provided). The use
     of this option is discouraged and should only be used by clients which cannot handle the absence of
     an email address value in the mentioned places. Optional. The default is False.
       */
      public Boolean getAlwaysIncludeEmail() {
        return alwaysIncludeEmail;
      }

      /**
     * Whether to always include a value in the "email" field for the organizer, creator and
     * attendees, even if no real email is available (i.e. a generated, non-working value will be
     * provided). The use of this option is discouraged and should only be used by clients which
     * cannot handle the absence of an email address value in the mentioned places. Optional. The
     * default is False.
     */
      public Instances setAlwaysIncludeEmail(Boolean alwaysIncludeEmail) {
        this.alwaysIncludeEmail = alwaysIncludeEmail;
        return this;
      }

      /** Maximum number of events returned on one result page. Optional. */
      @com.google.api.client.util.Key
      private Integer maxResults;

      /** Maximum number of events returned on one result page. Optional.

     [minimum: 1]
       */
      public Integer getMaxResults() {
        return maxResults;
      }

      /** Maximum number of events returned on one result page. Optional. */
      public Instances setMaxResults(Integer maxResults) {
        this.maxResults = maxResults;
        return this;
      }

      /** Token specifying which result page to return. Optional. */
      @com.google.api.client.util.Key
      private String pageToken;

      /** Token specifying which result page to return. Optional.
       */
      public String getPageToken() {
        return pageToken;
      }

      /** Token specifying which result page to return. Optional. */
      public Instances setPageToken(String pageToken) {
        this.pageToken = pageToken;
        return this;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      @com.google.api.client.util.Key
      private String timeZone;

      /** Time zone used in the response. Optional. The default is the time zone of the calendar.
       */
      public String getTimeZone() {
        return timeZone;
      }

      /** Time zone used in the response. Optional. The default is the time zone of the calendar. */
      public Instances setTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
      }

      /** The original start time of the instance in the result. Optional. */
      @com.google.api.client.util.Key
      private String originalStart;

      /** The original start time of the instance in the result. Optional.
       */
      public String getOriginalStart() {
        return originalStart;
      }

      /** The original start time of the instance in the result. Optional. */
      public Instances setOriginalStart(String originalStart) {
        this.originalStart = originalStart;
        return this;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      @com.google.api.client.util.Key
      private Integer maxAttendees;

      /** The maximum number of attendees to include in the response. If there are more than the specified
     number of attendees, only the participant is returned. Optional.

     [minimum: 1]
       */
      public Integer getMaxAttendees() {
        return maxAttendees;
      }

      /**
     * The maximum number of attendees to include in the response. If there are more than the
     * specified number of attendees, only the participant is returned. Optional.
     */
      public Instances setMaxAttendees(Integer maxAttendees) {
        this.maxAttendees = maxAttendees;
        return this;
      }

    }
    /**
     * Imports an event.
     *
     * Create a request for the method "events.import".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link CalendarImport#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param content the {@link com.google.api.services.calendar.model.Event}
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public CalendarImport calendarImport(String calendarId, com.google.api.services.calendar.model.Event content) throws IOException {
      CalendarImport result = new CalendarImport(calendarId, content);
      initialize(result);
      return result;
    }

    public class CalendarImport extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/import";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      CalendarImport(String calendarId, com.google.api.services.calendar.model.Event content) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, content);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        Preconditions.checkNotNull(content);
      }

      /**
       * Sends the "calendarImport" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "calendarImport" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public CalendarImport setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public CalendarImport setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

    }
    /**
     * Creates an event based on a simple text string.
     *
     * Create a request for the method "events.quickAdd".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link QuickAdd#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param text The text describing the event to be created.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public QuickAdd quickAdd(String calendarId, String text) throws IOException {
      QuickAdd result = new QuickAdd(calendarId, text);
      initialize(result);
      return result;
    }

    public class QuickAdd extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/quickAdd";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      QuickAdd(String calendarId, String text) {
        super(Calendar.this, HttpMethod.POST, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.text = Preconditions.checkNotNull(text, "Required parameter text must be specified.");
      }

      /**
       * Sends the "quickAdd" request to the Calendar server.
       *
       * @return the {@link com.google.api.services.calendar.model.Event} response
       * @throws IOException if the request fails
       */
      public com.google.api.services.calendar.model.Event execute() throws IOException {
        HttpResponse response = executeUnparsed();
        com.google.api.services.calendar.model.Event result = response.parseAs(
            com.google.api.services.calendar.model.Event.class);
        result.setResponseHeaders(response.getHeaders());
        return result;
      }

      /**
       * Queues the "quickAdd" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Event&gt;() {

           public void onSuccess(Event content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<com.google.api.services.calendar.model.Event> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), com.google.api.services.calendar.model.Event.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public QuickAdd setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public QuickAdd setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** The text describing the event to be created. */
      @com.google.api.client.util.Key
      private String text;

      /** The text describing the event to be created.
       */
      public String getText() {
        return text;
      }

      /** The text describing the event to be created. */
      public QuickAdd setText(String text) {
        this.text = text;
        return this;
      }

      /**
     * Whether to send notifications about the creation of the event. Optional. The default is
     * False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the creation of the event. Optional. The default is False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the creation of the event. Optional. The default is
     * False.
     */
      public QuickAdd setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }
    /**
     * Deletes an event.
     *
     * Create a request for the method "events.delete".
     *
     * This request holds the parameters needed by the the calendar server.  After setting any optional
     * parameters, call the {@link Delete#execute()} method to invoke the remote operation.
     *
     * @param calendarId Calendar identifier.
     * @param eventId Event identifier.
     * @return the request
     * @throws IOException if the initialization of the request fails
     */
    public Delete delete(String calendarId, String eventId) throws IOException {
      Delete result = new Delete(calendarId, eventId);
      initialize(result);
      return result;
    }

    public class Delete extends CalendarRequest {

      private static final String REST_PATH = "calendars/{calendarId}/events/{eventId}";

      /**
       * Internal constructor.  Use the convenience method instead.
       */
      Delete(String calendarId, String eventId) {
        super(Calendar.this, HttpMethod.DELETE, REST_PATH, null);
        this.calendarId = Preconditions.checkNotNull(calendarId, "Required parameter calendarId must be specified.");
        this.eventId = Preconditions.checkNotNull(eventId, "Required parameter eventId must be specified.");
      }

      /**
       * Sends the "delete" request to the Calendar server.
       *
       * @throws IOException if the request fails
       */
      public void execute() throws IOException {
        HttpResponse response = executeUnparsed();
        response.ignore();
      }

      /**
       * Queues the "delete" request to the Calendar server into the given batch request.
       *
       * <p>
       * Example usage:
       * </p>
       *
       * <pre>
         request.queue(batchRequest, new JsonBatchCallback&lt;Void&gt;() {

           public void onSuccess(Void content, GoogleHeaders responseHeaders) {
             log("Success");
           }

           public void onFailure(GoogleJsonError e, GoogleHeaders responseHeaders) {
             log(e.getMessage());
           }
         });
       * </pre>
       *
       * @param batch a single batch of requests
       * @param callback batch callback
       * @since 1.6
       */
      public void queue(com.google.api.client.googleapis.batch.BatchRequest batch,
          com.google.api.client.googleapis.batch.json.JsonBatchCallback<Void> callback)
          throws IOException {
        batch.queue(buildHttpRequest(), Void.class,
            com.google.api.client.googleapis.json.GoogleJsonErrorContainer.class, callback);
      }

      /**
       * @since 1.7
       */
      @Override
      public Delete setFields(String fields) {
        super.setFields(fields);
        return this;
      }

      /** Calendar identifier. */
      @com.google.api.client.util.Key
      private String calendarId;

      /** Calendar identifier.
       */
      public String getCalendarId() {
        return calendarId;
      }

      /** Calendar identifier. */
      public Delete setCalendarId(String calendarId) {
        this.calendarId = calendarId;
        return this;
      }

      /** Event identifier. */
      @com.google.api.client.util.Key
      private String eventId;

      /** Event identifier.
       */
      public String getEventId() {
        return eventId;
      }

      /** Event identifier. */
      public Delete setEventId(String eventId) {
        this.eventId = eventId;
        return this;
      }

      /**
     * Whether to send notifications about the deletion of the event. Optional. The default is
     * False.
     */
      @com.google.api.client.util.Key
      private Boolean sendNotifications;

      /** Whether to send notifications about the deletion of the event. Optional. The default is False.
       */
      public Boolean getSendNotifications() {
        return sendNotifications;
      }

      /**
     * Whether to send notifications about the deletion of the event. Optional. The default is
     * False.
     */
      public Delete setSendNotifications(Boolean sendNotifications) {
        this.sendNotifications = sendNotifications;
        return this;
      }

    }

  }

  /**
   * Builder for {@link Calendar}.
   *
   * <p>
   * Implementation is not thread-safe.
   * </p>
   *
   * @since 1.3.0
   */
  public static final class Builder extends GoogleClient.Builder {

    /**
     * Returns an instance of a new builder.
     *
     * @param transport The transport to use for requests
     * @param jsonFactory A factory for creating JSON parsers and serializers
     * @param baseUrl The base URL of the service. Must end with a "/"
     */
    @Deprecated
    Builder(HttpTransport transport, JsonFactory jsonFactory, GenericUrl baseUrl) {
      super(transport, jsonFactory, baseUrl);
    }

    /**
     * Returns an instance of a new builder.
     *
     * @param transport The transport to use for requests
     * @param jsonFactory A factory for creating JSON parsers and serializers
     * @param httpRequestInitializer The HTTP request initializer or {@code null} for none
     * @since 1.7
     */
    public Builder(HttpTransport transport, JsonFactory jsonFactory,
        HttpRequestInitializer httpRequestInitializer) {
      super(transport, jsonFactory, DEFAULT_ROOT_URL, DEFAULT_SERVICE_PATH, httpRequestInitializer);
    }

    /** Builds a new instance of {@link Calendar}. */
    @SuppressWarnings("deprecation")
    @Override
    public Calendar build() {
      if (isBaseUrlUsed()) {
        return new Calendar(
            getTransport(),
            getJsonHttpRequestInitializer(),
            getHttpRequestInitializer(),
            getJsonFactory(),
            getObjectParser(),
            getBaseUrl().build(),
            getApplicationName());
      }
      return new Calendar(
          getTransport(),
          getJsonHttpRequestInitializer(),
          getHttpRequestInitializer(),
          getJsonFactory(),
          getObjectParser(),
          getRootUrl(),
          getServicePath(),
          getApplicationName(),
          getSuppressPatternChecks());
    }

    @Override
    @Deprecated
    public Builder setBaseUrl(GenericUrl baseUrl) {
      super.setBaseUrl(baseUrl);
      return this;
    }

    @Override
    public Builder setRootUrl(String rootUrl) {
      super.setRootUrl(rootUrl);
      return this;
    }

    @Override
    public Builder setServicePath(String servicePath) {
      super.setServicePath(servicePath);
      return this;
    }

    @Override
    public Builder setJsonHttpRequestInitializer(
        JsonHttpRequestInitializer jsonHttpRequestInitializer) {
      super.setJsonHttpRequestInitializer(jsonHttpRequestInitializer);
      return this;
    }

    @Override
    public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) {
      super.setHttpRequestInitializer(httpRequestInitializer);
      return this;
    }

    @Override
    public Builder setApplicationName(String applicationName) {
      super.setApplicationName(applicationName);
      return this;
    }

    @Override
    public Builder setObjectParser(JsonObjectParser parser) {
      super.setObjectParser(parser);
      return this;
    }

    @Override
    public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
      super.setSuppressPatternChecks(suppressPatternChecks);
      return this;
    }
  }
}
TOP

Related Classes of com.google.api.services.calendar.Calendar$Freebusy$Query

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.