com.google.api.services.drive.Drive Maven / Gradle / Ivy
/*
* 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.4.2 (build: 2013-08-21 15:27:30 UTC)
* on 2013-08-21 at 21:17:41 UTC
*/
package com.google.api.services.drive;
import com.google.api.client.googleapis.GoogleUtils;
import com.google.api.client.googleapis.services.AbstractGoogleClientRequest;
import com.google.api.client.googleapis.services.GoogleClientRequestInitializer;
import com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.JsonObjectParser;
import com.google.common.base.Preconditions;
/**
* Service definition for Drive (v1).
*
*
* The API to interact with Drive.
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link DriveRequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
*
* Upgrade warning: this class now extends {@link AbstractGoogleJsonClient}, whereas in prior
* version 1.8 it extended {@link com.google.api.client.googleapis.services.GoogleClient}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class Drive extends AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
Preconditions.checkState(GoogleUtils.VERSION.equals("1.13.2-beta"),
"You are currently running with version %s of google-api-client. " +
"You need version 1.13.2-beta of google-api-client to run version " +
"1.13.2-beta of the Drive API library.", GoogleUtils.VERSION);
}
/**
* 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 = "drive/v1/";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
* @deprecated (scheduled to be removed in 1.13)
*/
@Deprecated
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
*
* Use {@link Builder} if you need to specify any of the optional parameters.
*
*
* @param transport HTTP transport
* @param jsonFactory JSON factory
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Drive(HttpTransport transport, JsonFactory jsonFactory,
HttpRequestInitializer httpRequestInitializer) {
super(transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
}
/**
* @param transport HTTP transport
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @param rootUrl root URL of the service
* @param servicePath service path
* @param jsonObjectParser JSON object parser
* @param googleClientRequestInitializer Google request initializer or {@code null} for none
* @param applicationName application name to be sent in the User-Agent header of requests or
* {@code null} for none
* @param suppressPatternChecks whether discovery pattern checks should be suppressed on required
* parameters
*/
Drive(HttpTransport transport,
HttpRequestInitializer httpRequestInitializer,
String rootUrl,
String servicePath,
JsonObjectParser jsonObjectParser,
GoogleClientRequestInitializer googleClientRequestInitializer,
String applicationName,
boolean suppressPatternChecks) {
super(transport,
httpRequestInitializer,
rootUrl,
servicePath,
jsonObjectParser,
googleClientRequestInitializer,
applicationName,
suppressPatternChecks);
}
@Override
protected void initialize(AbstractGoogleClientRequest> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Files collection.
*
* The typical use is:
*
* {@code Drive drive = new Drive(...);}
* {@code Drive.Files.List request = drive.files().list(parameters ...)}
*
*
* @return the resource collection
*/
public Files files() {
return new Files();
}
/**
* The "files" collection of methods.
*/
public class Files {
/**
* Gets a file's metadata by id.
*
* Create a request for the method "files.get".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param id The id for the file in question.
* @return the request
*/
public Get get(String id) throws java.io.IOException {
Get result = new Get(id);
initialize(result);
return result;
}
public class Get extends DriveRequest {
private static final String REST_PATH = "files/{id}";
/**
* Gets a file's metadata by id.
*
* Create a request for the method "files.get".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation. {@link
* Get#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
* @param id The id for the file in question.
* @since 1.13
*/
protected Get(String id) {
super(Drive.this, "GET", REST_PATH, null, com.google.api.services.drive.model.File.class);
this.id = Preconditions.checkNotNull(id, "Required parameter id must be specified.");
initializeMediaDownload();
}
/** Upgrade warning: in prior version 1.8 this method was called {@code download}. */
@Override
public void executeMediaAndDownloadTo(java.io.OutputStream outputStream) throws java.io.IOException {
super.executeMediaAndDownloadTo(outputStream);
}
@Override
public java.io.InputStream executeMediaAsInputStream() throws java.io.IOException {
return super.executeMediaAsInputStream();
}
@Override
public com.google.api.client.http.HttpResponse executeMedia() throws java.io.IOException {
return super.executeMedia();
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(String userIp) {
return (Get) super.setUserIp(userIp);
}
/** The id for the file in question. */
@com.google.api.client.util.Key
private String id;
/** The id for the file in question.
*/
public String getId() {
return id;
}
/** The id for the file in question. */
public Get setId(String id) {
this.id = id;
return this;
}
/** Whether to update the view date after successfully retrieving the file. */
@com.google.api.client.util.Key
private Boolean updateViewedDate;
/** Whether to update the view date after successfully retrieving the file. [default: true]
*/
public Boolean getUpdateViewedDate() {
return updateViewedDate;
}
/** Whether to update the view date after successfully retrieving the file. */
public Get setUpdateViewedDate(Boolean updateViewedDate) {
this.updateViewedDate = updateViewedDate;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether to update the view date after successfully retrieving the file.
*
*/
public boolean isUpdateViewedDate() {
if (updateViewedDate == null || updateViewedDate == com.google.api.client.util.Data.NULL_BOOLEAN) {
return true;
}
return updateViewedDate;
}
/** This parameter is deprecated and has no function. */
@com.google.api.client.util.Key
private String projection;
/** This parameter is deprecated and has no function.
*/
public String getProjection() {
return projection;
}
/** This parameter is deprecated and has no function. */
public Get setProjection(String projection) {
this.projection = projection;
return this;
}
}
/**
* Inserts a file, and any settable metadata or blob content sent with the request.
*
* Create a request for the method "files.insert".
*
* This request holds the parameters needed by the the drive 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.drive.model.File}
* @return the request
*/
public Insert insert(com.google.api.services.drive.model.File content) throws java.io.IOException {
Insert result = new Insert(content);
initialize(result);
return result;
}
/**
* Inserts a file, and any settable metadata or blob content sent with the request.
*
* Create a request for the method "files.insert".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation.
*
*
* This method should be used for uploading media content.
*
*
*
* @param content the {@link com.google.api.services.drive.model.File} media metadata or {@code null} if none
* @param mediaContent The media HTTP content or {@code null} if none.
* @return the request
* @throws java.io.IOException if the initialization of the request fails
*/
public Insert insert(com.google.api.services.drive.model.File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent) throws java.io.IOException {
Insert result = new Insert(content, mediaContent);
initialize(result);
return result;
}
public class Insert extends DriveRequest {
private static final String REST_PATH = "files";
/**
* Inserts a file, and any settable metadata or blob content sent with the request.
*
* Create a request for the method "files.insert".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation. {@link
* Insert#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
* @param content the {@link com.google.api.services.drive.model.File}
* @since 1.13
*/
protected Insert(com.google.api.services.drive.model.File content) {
super(Drive.this, "POST", REST_PATH, content, com.google.api.services.drive.model.File.class);
}
/**
* Inserts a file, and any settable metadata or blob content sent with the request.
*
* Create a request for the method "files.insert".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Insert#execute()} method to invoke the remote operation. {@link
* Insert#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
*
* This constructor should be used for uploading media content.
*
*
*
* @param content the {@link com.google.api.services.drive.model.File} media metadata or {@code null} if none
* @param mediaContent The media HTTP content or {@code null} if none.
* @since 1.13
*/
protected Insert(com.google.api.services.drive.model.File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent) {
super(Drive.this, "POST", "/upload/" + getServicePath() + REST_PATH, content, com.google.api.services.drive.model.File.class);
initializeMediaUpload(mediaContent);
}
@Override
public Insert setAlt(String alt) {
return (Insert) super.setAlt(alt);
}
@Override
public Insert setFields(String fields) {
return (Insert) super.setFields(fields);
}
@Override
public Insert setKey(String key) {
return (Insert) super.setKey(key);
}
@Override
public Insert setOauthToken(String oauthToken) {
return (Insert) super.setOauthToken(oauthToken);
}
@Override
public Insert setPrettyPrint(Boolean prettyPrint) {
return (Insert) super.setPrettyPrint(prettyPrint);
}
@Override
public Insert setQuotaUser(String quotaUser) {
return (Insert) super.setQuotaUser(quotaUser);
}
@Override
public Insert setUserIp(String userIp) {
return (Insert) super.setUserIp(userIp);
}
}
/**
* Updates file metadata and/or content. This method supports patch semantics.
*
* Create a request for the method "files.patch".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File}
* @return the request
*/
public Patch patch(String id, com.google.api.services.drive.model.File content) throws java.io.IOException {
Patch result = new Patch(id, content);
initialize(result);
return result;
}
public class Patch extends DriveRequest {
private static final String REST_PATH = "files/{id}";
/**
* Updates file metadata and/or content. This method supports patch semantics.
*
* Create a request for the method "files.patch".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Patch#execute()} method to invoke the remote operation. {@link
* Patch#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File}
* @since 1.13
*/
protected Patch(String id, com.google.api.services.drive.model.File content) {
super(Drive.this, "PATCH", REST_PATH, content, com.google.api.services.drive.model.File.class);
this.id = Preconditions.checkNotNull(id, "Required parameter id must be specified.");
}
@Override
public Patch setAlt(String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setFields(String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUserIp(String userIp) {
return (Patch) super.setUserIp(userIp);
}
/** The id for the file in question. */
@com.google.api.client.util.Key
private String id;
/** The id for the file in question.
*/
public String getId() {
return id;
}
/** The id for the file in question. */
public Patch setId(String id) {
this.id = id;
return this;
}
/** Whether to update the view date after successfully updating the file. */
@com.google.api.client.util.Key
private Boolean updateViewedDate;
/** Whether to update the view date after successfully updating the file. [default: true]
*/
public Boolean getUpdateViewedDate() {
return updateViewedDate;
}
/** Whether to update the view date after successfully updating the file. */
public Patch setUpdateViewedDate(Boolean updateViewedDate) {
this.updateViewedDate = updateViewedDate;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether to update the view date after successfully updating the file.
*
*/
public boolean isUpdateViewedDate() {
if (updateViewedDate == null || updateViewedDate == com.google.api.client.util.Data.NULL_BOOLEAN) {
return true;
}
return updateViewedDate;
}
/**
* Controls updating the modified date of the file. If true, the modified date will be updated
* to the current time, regardless of whether other changes are being made. If false, the
* modified date will only be updated to the current time if other changes are also being made
* (changing the title, for example).
*/
@com.google.api.client.util.Key
private Boolean updateModifiedDate;
/** Controls updating the modified date of the file. If true, the modified date will be updated to the
current time, regardless of whether other changes are being made. If false, the modified date will
only be updated to the current time if other changes are also being made (changing the title, for
example). [default: false]
*/
public Boolean getUpdateModifiedDate() {
return updateModifiedDate;
}
/**
* Controls updating the modified date of the file. If true, the modified date will be updated
* to the current time, regardless of whether other changes are being made. If false, the
* modified date will only be updated to the current time if other changes are also being made
* (changing the title, for example).
*/
public Patch setUpdateModifiedDate(Boolean updateModifiedDate) {
this.updateModifiedDate = updateModifiedDate;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Controls updating the modified date of the file. If true, the modified date will be updated to the
current time, regardless of whether other changes are being made. If false, the modified date will
only be updated to the current time if other changes are also being made (changing the title, for
example).
*
*/
public boolean isUpdateModifiedDate() {
if (updateModifiedDate == null || updateModifiedDate == com.google.api.client.util.Data.NULL_BOOLEAN) {
return false;
}
return updateModifiedDate;
}
/**
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
* current head revision will be replaced.
*/
@com.google.api.client.util.Key
private Boolean newRevision;
/** Whether a blob upload should create a new revision. If not set or false, the blob data in the
current head revision will be replaced. [default: true]
*/
public Boolean getNewRevision() {
return newRevision;
}
/**
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
* current head revision will be replaced.
*/
public Patch setNewRevision(Boolean newRevision) {
this.newRevision = newRevision;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
current head revision will be replaced.
*
*/
public boolean isNewRevision() {
if (newRevision == null || newRevision == com.google.api.client.util.Data.NULL_BOOLEAN) {
return true;
}
return newRevision;
}
}
/**
* Updates file metadata and/or content
*
* Create a request for the method "files.update".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File}
* @return the request
*/
public Update update(String id, com.google.api.services.drive.model.File content) throws java.io.IOException {
Update result = new Update(id, content);
initialize(result);
return result;
}
/**
* Updates file metadata and/or content
*
* Create a request for the method "files.update".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
*
* This method should be used for uploading media content.
*
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File} media metadata or {@code null} if none
* @param mediaContent The media HTTP content or {@code null} if none.
* @return the request
* @throws java.io.IOException if the initialization of the request fails
*/
public Update update(String id, com.google.api.services.drive.model.File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent) throws java.io.IOException {
Update result = new Update(id, content, mediaContent);
initialize(result);
return result;
}
public class Update extends DriveRequest {
private static final String REST_PATH = "files/{id}";
/**
* Updates file metadata and/or content
*
* Create a request for the method "files.update".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation. {@link
* Update#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File}
* @since 1.13
*/
protected Update(String id, com.google.api.services.drive.model.File content) {
super(Drive.this, "PUT", REST_PATH, content, com.google.api.services.drive.model.File.class);
this.id = Preconditions.checkNotNull(id, "Required parameter id must be specified.");
}
/**
* Updates file metadata and/or content
*
* Create a request for the method "files.update".
*
* This request holds the parameters needed by the the drive server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation. {@link
* Update#initialize(AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor.
*
*
* This constructor should be used for uploading media content.
*
*
* @param id The id for the file in question.
* @param content the {@link com.google.api.services.drive.model.File} media metadata or {@code null} if none
* @param mediaContent The media HTTP content or {@code null} if none.
* @since 1.13
*/
protected Update(String id, com.google.api.services.drive.model.File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent) {
super(Drive.this, "PUT", "/upload/" + getServicePath() + REST_PATH, content, com.google.api.services.drive.model.File.class);
this.id = Preconditions.checkNotNull(id, "Required parameter id must be specified.");
initializeMediaUpload(mediaContent);
}
@Override
public Update setAlt(String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(String userIp) {
return (Update) super.setUserIp(userIp);
}
/** The id for the file in question. */
@com.google.api.client.util.Key
private String id;
/** The id for the file in question.
*/
public String getId() {
return id;
}
/** The id for the file in question. */
public Update setId(String id) {
this.id = id;
return this;
}
/** Whether to update the view date after successfully updating the file. */
@com.google.api.client.util.Key
private Boolean updateViewedDate;
/** Whether to update the view date after successfully updating the file. [default: true]
*/
public Boolean getUpdateViewedDate() {
return updateViewedDate;
}
/** Whether to update the view date after successfully updating the file. */
public Update setUpdateViewedDate(Boolean updateViewedDate) {
this.updateViewedDate = updateViewedDate;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether to update the view date after successfully updating the file.
*
*/
public boolean isUpdateViewedDate() {
if (updateViewedDate == null || updateViewedDate == com.google.api.client.util.Data.NULL_BOOLEAN) {
return true;
}
return updateViewedDate;
}
/**
* Controls updating the modified date of the file. If true, the modified date will be updated
* to the current time, regardless of whether other changes are being made. If false, the
* modified date will only be updated to the current time if other changes are also being made
* (changing the title, for example).
*/
@com.google.api.client.util.Key
private Boolean updateModifiedDate;
/** Controls updating the modified date of the file. If true, the modified date will be updated to the
current time, regardless of whether other changes are being made. If false, the modified date will
only be updated to the current time if other changes are also being made (changing the title, for
example). [default: false]
*/
public Boolean getUpdateModifiedDate() {
return updateModifiedDate;
}
/**
* Controls updating the modified date of the file. If true, the modified date will be updated
* to the current time, regardless of whether other changes are being made. If false, the
* modified date will only be updated to the current time if other changes are also being made
* (changing the title, for example).
*/
public Update setUpdateModifiedDate(Boolean updateModifiedDate) {
this.updateModifiedDate = updateModifiedDate;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Controls updating the modified date of the file. If true, the modified date will be updated to the
current time, regardless of whether other changes are being made. If false, the modified date will
only be updated to the current time if other changes are also being made (changing the title, for
example).
*
*/
public boolean isUpdateModifiedDate() {
if (updateModifiedDate == null || updateModifiedDate == com.google.api.client.util.Data.NULL_BOOLEAN) {
return false;
}
return updateModifiedDate;
}
/**
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
* current head revision will be replaced.
*/
@com.google.api.client.util.Key
private Boolean newRevision;
/** Whether a blob upload should create a new revision. If not set or false, the blob data in the
current head revision will be replaced. [default: true]
*/
public Boolean getNewRevision() {
return newRevision;
}
/**
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
* current head revision will be replaced.
*/
public Update setNewRevision(Boolean newRevision) {
this.newRevision = newRevision;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether a blob upload should create a new revision. If not set or false, the blob data in the
current head revision will be replaced.
*
*/
public boolean isNewRevision() {
if (newRevision == null || newRevision == com.google.api.client.util.Data.NULL_BOOLEAN) {
return true;
}
return newRevision;
}
}
}
/**
* Builder for {@link Drive}.
*
*
* Implementation is not thread-safe.
*
*
* @since 1.3.0
*/
public static final class Builder extends AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport
* @param jsonFactory JSON factory
* @param httpRequestInitializer 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,
false);
}
/** Builds a new instance of {@link Drive}. */
@Override
public Drive build() {
return new Drive(getTransport(),
getHttpRequestInitializer(),
getRootUrl(),
getServicePath(),
getObjectParser(),
getGoogleClientRequestInitializer(),
getApplicationName(),
getSuppressPatternChecks());
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setHttpRequestInitializer(HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
/**
* Set the {@link DriveRequestInitializer}.
*
* @since 1.12
*/
public Builder setDriveRequestInitializer(
DriveRequestInitializer driveRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(driveRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}