-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow uploading files via direct upload, which can be faster
- Loading branch information
Showing
1 changed file
with
7 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,7 +247,7 @@ | |
:file-id - specifies the file for file-specific models and actions" | ||
[google-ctx query] | ||
(let [drive (build-drive-service google-ctx) | ||
{:keys [model action fields]} query | ||
{:keys [model action fields direct-upload]} query | ||
This comment has been minimized.
Sorry, something went wrong. |
||
;; TODO more rigorous support for nesting, e.g. permissions(role,type) | ||
fields (when (seq fields) (string/join "," (map name fields))) | ||
items? (= :list action) | ||
|
@@ -295,6 +295,12 @@ | |
(doto (.insert (.files drive) file stream) | ||
(.setConvert convert)) | ||
(.insert (.files drive) file))] | ||
;Allow direct upload, which is more efficient for tiny files | ||
;https://developers.google.com/api-client-library/java/google-api-java-client/media-upload#direct | ||
(when direct-upload | ||
(when-let [uploader (.getMediaHttpUploader request)] | ||
This comment has been minimized.
Sorry, something went wrong.
dball
Contributor
|
||
(.setDirectUploadEnabled uploader true))) | ||
;Allow requesting specific fields only in response, which can be more efficient | ||
(cond-doto ^DriveRequest request | ||
fields (.setFields fields)))) | ||
:permissions | ||
|
👍 tho my general inclination is for boolean fields to have a trailing ? symbol