Packages
google_api_drive
0.17.0
0.32.0
0.31.1
0.31.0
0.30.1
0.30.0
0.29.3
0.29.2
0.29.1
0.29.0
0.28.0
0.27.1
0.27.0
0.26.0
0.25.1
0.25.0
0.24.0
0.23.4
0.23.3
0.23.2
0.23.1
0.23.0
0.22.1
0.22.0
0.21.1
0.21.0
0.20.4
0.20.3
0.20.2
0.20.1
0.20.0
0.19.1
0.19.0
0.18.0
0.17.0
0.16.0
0.15.0
0.14.2
0.14.1
0.14.0
0.13.1
0.13.0
0.12.0
0.11.0
0.10.0
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.2
0.2.1
0.1.0
0.0.1
Google Drive API client library. The Google Drive API allows clients to access resources from Google Drive.
Current section
Files
Jump to
Current section
Files
lib/google_api/drive/v3/api/files.ex
# Copyright 2019 Google LLC
#
# 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.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.Drive.V3.Api.Files do
@moduledoc """
API calls for all endpoints tagged `Files`.
"""
alias GoogleApi.Drive.V3.Connection
alias GoogleApi.Gax.{Request, Response}
@library_version Mix.Project.config() |> Keyword.get(:version, "")
@doc """
Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.
* `:ignoreDefaultVisibility` (*type:* `boolean()`) - 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.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.File.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_copy(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_copy(connection, file_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:enforceSingleParent => :query,
:ignoreDefaultVisibility => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/drive/v3/files/{fileId}/copy", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Creates a new file.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.
* `:ignoreDefaultVisibility` (*type:* `boolean()`) - 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.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.File.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_create(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_create(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:enforceSingleParent => :query,
:ignoreDefaultVisibility => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/drive/v3/files", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Creates a new file.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
* `metadata` (*type:* `GoogleApi.Drive.V3.Model.File.t`) - object metadata
* `data` (*type:* `iodata`) - Content to upload, as a string or iolist
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.
* `:ignoreDefaultVisibility` (*type:* `boolean()`) - 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.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_create_iodata(
Tesla.Env.client(),
String.t(),
GoogleApi.Drive.V3.Model.File.t(),
iodata,
keyword(),
keyword()
) :: {:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_create_iodata(
connection,
upload_type,
metadata,
data,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:enforceSingleParent => :query,
:ignoreDefaultVisibility => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/upload/drive/v3/files", %{})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_param(:body, :metadata, metadata)
|> Request.add_param(:body, :data, data)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Creates a new file.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `upload_type` (*type:* `String.t`) - Upload type. Must be "resumable".
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.
* `:ignoreDefaultVisibility` (*type:* `boolean()`) - 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.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.File.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_create_resumable(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, nil} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_create_resumable(connection, upload_type, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:enforceSingleParent => :query,
:ignoreDefaultVisibility => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/resumable/upload/drive/v3/files", %{})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Creates a new file.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
* `metadata` (*type:* `GoogleApi.Drive.V3.Model.File.t`) - object metadata
* `data` (*type:* `String.t`) - Path to file containing content to upload
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.
* `:ignoreDefaultVisibility` (*type:* `boolean()`) - 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.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_create_simple(
Tesla.Env.client(),
String.t(),
GoogleApi.Drive.V3.Model.File.t(),
String.t(),
keyword(),
keyword()
) :: {:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_create_simple(
connection,
upload_type,
metadata,
data,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:enforceSingleParent => :query,
:ignoreDefaultVisibility => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/upload/drive/v3/files", %{})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_param(:body, :metadata, metadata)
|> Request.add_param(:file, :data, data)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_delete(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, nil} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_delete(connection, file_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url("/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Permanently deletes all of the user's trashed files.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_empty_trash(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, nil} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_empty_trash(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query
}
request =
Request.new()
|> Request.method(:delete)
|> Request.url("/drive/v3/files/trash", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `mime_type` (*type:* `String.t`) - The MIME type of the format requested for this export.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_export(Tesla.Env.client(), String.t(), String.t(), keyword(), keyword()) ::
{:ok, nil} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_export(connection, file_id, mime_type, optional_params \\ [], opts \\ []) do
opts =
if Keyword.get(optional_params, :alt) == "media",
do: Keyword.put_new(opts, :decode, false),
else: opts
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/files/{fileId}/export", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_param(:query, :mimeType, mime_type)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Generates a set of file IDs which can be provided in create or copy requests.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:count` (*type:* `integer()`) - The number of IDs to return.
* `:space` (*type:* `String.t`) - The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.GeneratedIds{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_generate_ids(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.GeneratedIds.t()}
| {:ok, Tesla.Env.t()}
| {:error, any()}
def drive_files_generate_ids(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:count => :query,
:space => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/files/generateIds", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.GeneratedIds{}])
end
@doc """
Gets a file's metadata or content by ID.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:acknowledgeAbuse` (*type:* `boolean()`) - Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_get(connection, file_id, optional_params \\ [], opts \\ []) do
opts =
if Keyword.get(optional_params, :alt) == "media",
do: Keyword.put_new(opts, :decode, false),
else: opts
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:acknowledgeAbuse => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Lists or searches files.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:corpora` (*type:* `String.t`) - Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency.
* `:corpus` (*type:* `String.t`) - The source of files to list. Deprecated: use 'corpora' instead.
* `:driveId` (*type:* `String.t`) - ID of the shared drive to search.
* `:includeItemsFromAllDrives` (*type:* `boolean()`) - Whether both My Drive and shared drive items should be included in results.
* `:includeTeamDriveItems` (*type:* `boolean()`) - Deprecated use includeItemsFromAllDrives instead.
* `:orderBy` (*type:* `String.t`) - A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
* `:pageSize` (*type:* `integer()`) - The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.
* `:pageToken` (*type:* `String.t`) - The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.
* `:q` (*type:* `String.t`) - A query for filtering the file results. See the "Search for Files" guide for supported syntax.
* `:spaces` (*type:* `String.t`) - A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:teamDriveId` (*type:* `String.t`) - Deprecated use driveId instead.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.FileList{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_list(Tesla.Env.client(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.FileList.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_list(connection, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:corpora => :query,
:corpus => :query,
:driveId => :query,
:includeItemsFromAllDrives => :query,
:includeTeamDriveItems => :query,
:orderBy => :query,
:pageSize => :query,
:pageToken => :query,
:q => :query,
:spaces => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:teamDriveId => :query
}
request =
Request.new()
|> Request.method(:get)
|> Request.url("/drive/v3/files", %{})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.FileList{}])
end
@doc """
Updates a file's metadata and/or content. This method supports patch semantics.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:addParents` (*type:* `String.t`) - A comma-separated list of parent IDs to add.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's owner makes a request to add a single parent, the item is removed from all current folders and placed in the requested folder. Other requests that increase the number of parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:removeParents` (*type:* `String.t`) - A comma-separated list of parent IDs to remove.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.File.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_update(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_update(connection, file_id, optional_params \\ [], opts \\ []) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:addParents => :query,
:enforceSingleParent => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:removeParents => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Updates a file's metadata and/or content. This method supports patch semantics.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
* `metadata` (*type:* `GoogleApi.Drive.V3.Model.File.t`) - object metadata
* `data` (*type:* `iodata`) - Content to upload, as a string or iolist
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:addParents` (*type:* `String.t`) - A comma-separated list of parent IDs to add.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's owner makes a request to add a single parent, the item is removed from all current folders and placed in the requested folder. Other requests that increase the number of parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:removeParents` (*type:* `String.t`) - A comma-separated list of parent IDs to remove.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_update_iodata(
Tesla.Env.client(),
String.t(),
String.t(),
GoogleApi.Drive.V3.Model.File.t(),
iodata,
keyword(),
keyword()
) :: {:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_update_iodata(
connection,
file_id,
upload_type,
metadata,
data,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:addParents => :query,
:enforceSingleParent => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:removeParents => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/upload/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_param(:body, :metadata, metadata)
|> Request.add_param(:body, :data, data)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Updates a file's metadata and/or content. This method supports patch semantics.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `upload_type` (*type:* `String.t`) - Upload type. Must be "resumable".
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:addParents` (*type:* `String.t`) - A comma-separated list of parent IDs to add.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's owner makes a request to add a single parent, the item is removed from all current folders and placed in the requested folder. Other requests that increase the number of parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:removeParents` (*type:* `String.t`) - A comma-separated list of parent IDs to remove.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `:body` (*type:* `GoogleApi.Drive.V3.Model.File.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_update_resumable(
Tesla.Env.client(),
String.t(),
String.t(),
keyword(),
keyword()
) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_update_resumable(
connection,
file_id,
upload_type,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:addParents => :query,
:enforceSingleParent => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:removeParents => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query,
:body => :body
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/resumable/upload/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [decode: false])
end
@doc """
Updates a file's metadata and/or content. This method supports patch semantics.
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
* `metadata` (*type:* `GoogleApi.Drive.V3.Model.File.t`) - object metadata
* `data` (*type:* `String.t`) - Path to file containing content to upload
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:addParents` (*type:* `String.t`) - A comma-separated list of parent IDs to add.
* `:enforceSingleParent` (*type:* `boolean()`) - Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's owner makes a request to add a single parent, the item is removed from all current folders and placed in the requested folder. Other requests that increase the number of parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.
* `:keepRevisionForever` (*type:* `boolean()`) - Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.
* `:ocrLanguage` (*type:* `String.t`) - A language hint for OCR processing during image import (ISO 639-1 code).
* `:removeParents` (*type:* `String.t`) - A comma-separated list of parent IDs to remove.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:useContentAsIndexableText` (*type:* `boolean()`) - Whether to use the uploaded content as indexable text.
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.File{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_update_simple(
Tesla.Env.client(),
String.t(),
String.t(),
GoogleApi.Drive.V3.Model.File.t(),
String.t(),
keyword(),
keyword()
) :: {:ok, GoogleApi.Drive.V3.Model.File.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_update_simple(
connection,
file_id,
upload_type,
metadata,
data,
optional_params \\ [],
opts \\ []
) do
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:addParents => :query,
:enforceSingleParent => :query,
:keepRevisionForever => :query,
:ocrLanguage => :query,
:removeParents => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:useContentAsIndexableText => :query
}
request =
Request.new()
|> Request.method(:patch)
|> Request.url("/upload/drive/v3/files/{fileId}", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_param(:query, :uploadType, upload_type)
|> Request.add_param(:body, :metadata, metadata)
|> Request.add_param(:file, :data, data)
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.File{}])
end
@doc """
Subscribes to changes to a file
## Parameters
* `connection` (*type:* `GoogleApi.Drive.V3.Connection.t`) - Connection to server
* `file_id` (*type:* `String.t`) - The ID of the file.
* `optional_params` (*type:* `keyword()`) - Optional parameters
* `:alt` (*type:* `String.t`) - Data format for the response.
* `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
* `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
* `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
* `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
* `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
* `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
* `:acknowledgeAbuse` (*type:* `boolean()`) - Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
* `:supportsAllDrives` (*type:* `boolean()`) - Whether the requesting application supports both My Drives and shared drives.
* `:supportsTeamDrives` (*type:* `boolean()`) - Deprecated use supportsAllDrives instead.
* `:resource` (*type:* `GoogleApi.Drive.V3.Model.Channel.t`) -
* `opts` (*type:* `keyword()`) - Call options
## Returns
* `{:ok, %GoogleApi.Drive.V3.Model.Channel{}}` on success
* `{:error, info}` on failure
"""
@spec drive_files_watch(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
{:ok, GoogleApi.Drive.V3.Model.Channel.t()} | {:ok, Tesla.Env.t()} | {:error, any()}
def drive_files_watch(connection, file_id, optional_params \\ [], opts \\ []) do
opts =
if Keyword.get(optional_params, :alt) == "media",
do: Keyword.put_new(opts, :decode, false),
else: opts
optional_params_config = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:acknowledgeAbuse => :query,
:supportsAllDrives => :query,
:supportsTeamDrives => :query,
:resource => :body
}
request =
Request.new()
|> Request.method(:post)
|> Request.url("/drive/v3/files/{fileId}/watch", %{
"fileId" => URI.encode(file_id, &URI.char_unreserved?/1)
})
|> Request.add_optional_params(optional_params_config, optional_params)
|> Request.library_version(@library_version)
connection
|> Connection.execute(request)
|> Response.decode(opts ++ [struct: %GoogleApi.Drive.V3.Model.Channel{}])
end
end