Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Google Drive - Files - copy #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions lib/google/apis/drive/files.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
defmodule Google.Apis.Drive.Files do
use Google.Apis.Base, endpoint: "https://www.googleapis.com/drive/v3/files"

@doc """
Creates a copy of a file and applies any requested updates with patch semantics.

Usage:
Google.Apis.Drive.Files.copy(fileId: {"1234abcd"})

Available params:
fileId: "", keepRevisionForever: false, ignoreDefaultVisibility: false, ocrLanguage: ""

fileId: The ID of the file to copy. This can be obtained either via the API, or copying
the ID out of the Google Docs URL.

keepRevisionForever: Whether to set the 'keepForever' field in the new head revision.
This is only applicable to files with binary content in Drive. (Default: false)

ocrLanguage: A language hint for OCR processing during image import (ISO 639-1 code).

ignoreDefaultVisibility: Whether to ignore the domain's default visibility settings for the created file.
Domain administrators can choose to make all uploaded files visible to the domain by default;
this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.
(Default: false)

See https://developers.google.com/drive/v3/reference/files/copy
"""
def copy(params \\ [fileId: "", keepRevisionForever: false, ignoreDefaultVisibility: false], request_body \\ []) do
get!(URI.encode_query(params)).body
end
end