# Copyright 2018 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. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Drive.V3.Api.Permissions do @moduledoc """ API calls for all endpoints tagged `Permissions`. """ alias GoogleApi.Drive.V3.Connection import GoogleApi.Drive.V3.RequestBuilder @doc """ Creates a permission for a file or Team Drive. ## Parameters - connection (GoogleApi.Drive.V3.Connection): Connection to server - file_id (String.t): The ID of the file or Team Drive. - opts (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (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 (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. - :userIp (String.t): IP address of the site where the request originates. Use this if you want to enforce per-user limits. - :emailMessage (String.t): A plain text custom message to include in the notification email. - :sendNotificationEmail (boolean()): Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers. - :supportsTeamDrives (boolean()): Whether the requesting application supports Team Drives. - :transferOwnership (boolean()): Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. - :useDomainAdminAccess (boolean()): Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs. - :body (Permission): ## Returns {:ok, %GoogleApi.Drive.V3.Model.Permission{}} on success {:error, info} on failure """ @spec drive_permissions_create(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Drive.V3.Model.Permission.t()} | {:error, Tesla.Env.t()} def drive_permissions_create(connection, file_id, opts \\ []) do optional_params = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :emailMessage => :query, :sendNotificationEmail => :query, :supportsTeamDrives => :query, :transferOwnership => :query, :useDomainAdminAccess => :query, :body => :body } %{} |> method(:post) |> url("/drive/v3/files/{fileId}/permissions", %{ "fileId" => URI.encode_www_form(file_id) }) |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%GoogleApi.Drive.V3.Model.Permission{}) end @doc """ Deletes a permission. ## Parameters - connection (GoogleApi.Drive.V3.Connection): Connection to server - file_id (String.t): The ID of the file or Team Drive. - permission_id (String.t): The ID of the permission. - opts (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (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 (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. - :userIp (String.t): IP address of the site where the request originates. Use this if you want to enforce per-user limits. - :supportsTeamDrives (boolean()): Whether the requesting application supports Team Drives. - :useDomainAdminAccess (boolean()): Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs. ## Returns {:ok, %{}} on success {:error, info} on failure """ @spec drive_permissions_delete(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t()} def drive_permissions_delete(connection, file_id, permission_id, opts \\ []) do optional_params = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :supportsTeamDrives => :query, :useDomainAdminAccess => :query } %{} |> method(:delete) |> url("/drive/v3/files/{fileId}/permissions/{permissionId}", %{ "fileId" => URI.encode_www_form(file_id), "permissionId" => URI.encode_www_form(permission_id) }) |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(false) end @doc """ Gets a permission by ID. ## Parameters - connection (GoogleApi.Drive.V3.Connection): Connection to server - file_id (String.t): The ID of the file. - permission_id (String.t): The ID of the permission. - opts (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (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 (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. - :userIp (String.t): IP address of the site where the request originates. Use this if you want to enforce per-user limits. - :supportsTeamDrives (boolean()): Whether the requesting application supports Team Drives. - :useDomainAdminAccess (boolean()): Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs. ## Returns {:ok, %GoogleApi.Drive.V3.Model.Permission{}} on success {:error, info} on failure """ @spec drive_permissions_get(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Drive.V3.Model.Permission.t()} | {:error, Tesla.Env.t()} def drive_permissions_get(connection, file_id, permission_id, opts \\ []) do optional_params = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :supportsTeamDrives => :query, :useDomainAdminAccess => :query } %{} |> method(:get) |> url("/drive/v3/files/{fileId}/permissions/{permissionId}", %{ "fileId" => URI.encode_www_form(file_id), "permissionId" => URI.encode_www_form(permission_id) }) |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%GoogleApi.Drive.V3.Model.Permission{}) end @doc """ Lists a file's or Team Drive's permissions. ## Parameters - connection (GoogleApi.Drive.V3.Connection): Connection to server - file_id (String.t): The ID of the file or Team Drive. - opts (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (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 (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. - :userIp (String.t): IP address of the site where the request originates. Use this if you want to enforce per-user limits. - :pageSize (integer()): The maximum number of permissions to return per page. When not set for files in a Team Drive, at most 100 results will be returned. When not set for files that are not in a Team Drive, the entire list will be returned. - :pageToken (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. - :supportsTeamDrives (boolean()): Whether the requesting application supports Team Drives. - :useDomainAdminAccess (boolean()): Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs. ## Returns {:ok, %GoogleApi.Drive.V3.Model.PermissionList{}} on success {:error, info} on failure """ @spec drive_permissions_list(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Drive.V3.Model.PermissionList.t()} | {:error, Tesla.Env.t()} def drive_permissions_list(connection, file_id, opts \\ []) do optional_params = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :pageSize => :query, :pageToken => :query, :supportsTeamDrives => :query, :useDomainAdminAccess => :query } %{} |> method(:get) |> url("/drive/v3/files/{fileId}/permissions", %{ "fileId" => URI.encode_www_form(file_id) }) |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%GoogleApi.Drive.V3.Model.PermissionList{}) end @doc """ Updates a permission with patch semantics. ## Parameters - connection (GoogleApi.Drive.V3.Connection): Connection to server - file_id (String.t): The ID of the file or Team Drive. - permission_id (String.t): The ID of the permission. - opts (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (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 (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided. - :userIp (String.t): IP address of the site where the request originates. Use this if you want to enforce per-user limits. - :removeExpiration (boolean()): Whether to remove the expiration date. - :supportsTeamDrives (boolean()): Whether the requesting application supports Team Drives. - :transferOwnership (boolean()): Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect. - :useDomainAdminAccess (boolean()): Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs. - :body (Permission): ## Returns {:ok, %GoogleApi.Drive.V3.Model.Permission{}} on success {:error, info} on failure """ @spec drive_permissions_update(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Drive.V3.Model.Permission.t()} | {:error, Tesla.Env.t()} def drive_permissions_update(connection, file_id, permission_id, opts \\ []) do optional_params = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :removeExpiration => :query, :supportsTeamDrives => :query, :transferOwnership => :query, :useDomainAdminAccess => :query, :body => :body } %{} |> method(:patch) |> url("/drive/v3/files/{fileId}/permissions/{permissionId}", %{ "fileId" => URI.encode_www_form(file_id), "permissionId" => URI.encode_www_form(permission_id) }) |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%GoogleApi.Drive.V3.Model.Permission{}) end end