# coding: utf-8

"""
    Google Drive API

    The Google Drive API allows clients to access resources from Google Drive.

    The version of the OpenAPI document: v3
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictBool, StrictStr, field_validator
from typing import Optional
from typing_extensions import Annotated
from google_drive_ti.models.permission import Permission
from google_drive_ti.models.permission_list import PermissionList

from google_drive_ti.api_client import ApiClient, RequestSerialized
from google_drive_ti.api_response import ApiResponse
from google_drive_ti.rest import RESTResponseType


class PermissionsApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def drive_permissions_create(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        email_message: Annotated[Optional[StrictStr], Field(description="A plain text custom message to include in the notification email.")] = None,
        enforce_single_parent: Annotated[Optional[StrictBool], Field(description="Deprecated: See `moveToNewOwnersRoot` for details.")] = None,
        move_to_new_owners_root: Annotated[Optional[StrictBool], Field(description="This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.")] = None,
        send_notification_email: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> Permission:
        """drive_permissions_create

        Creates a permission for a file or shared drive. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param email_message: A plain text custom message to include in the notification email.
        :type email_message: str
        :param enforce_single_parent: Deprecated: See `moveToNewOwnersRoot` for details.
        :type enforce_single_parent: bool
        :param move_to_new_owners_root: This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.
        :type move_to_new_owners_root: bool
        :param send_notification_email: 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.
        :type send_notification_email: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_create_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            email_message=email_message,
            enforce_single_parent=enforce_single_parent,
            move_to_new_owners_root=move_to_new_owners_root,
            send_notification_email=send_notification_email,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def drive_permissions_create_with_http_info(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        email_message: Annotated[Optional[StrictStr], Field(description="A plain text custom message to include in the notification email.")] = None,
        enforce_single_parent: Annotated[Optional[StrictBool], Field(description="Deprecated: See `moveToNewOwnersRoot` for details.")] = None,
        move_to_new_owners_root: Annotated[Optional[StrictBool], Field(description="This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.")] = None,
        send_notification_email: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[Permission]:
        """drive_permissions_create

        Creates a permission for a file or shared drive. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param email_message: A plain text custom message to include in the notification email.
        :type email_message: str
        :param enforce_single_parent: Deprecated: See `moveToNewOwnersRoot` for details.
        :type enforce_single_parent: bool
        :param move_to_new_owners_root: This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.
        :type move_to_new_owners_root: bool
        :param send_notification_email: 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.
        :type send_notification_email: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_create_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            email_message=email_message,
            enforce_single_parent=enforce_single_parent,
            move_to_new_owners_root=move_to_new_owners_root,
            send_notification_email=send_notification_email,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def drive_permissions_create_without_preload_content(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        email_message: Annotated[Optional[StrictStr], Field(description="A plain text custom message to include in the notification email.")] = None,
        enforce_single_parent: Annotated[Optional[StrictBool], Field(description="Deprecated: See `moveToNewOwnersRoot` for details.")] = None,
        move_to_new_owners_root: Annotated[Optional[StrictBool], Field(description="This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.")] = None,
        send_notification_email: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """drive_permissions_create

        Creates a permission for a file or shared drive. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param email_message: A plain text custom message to include in the notification email.
        :type email_message: str
        :param enforce_single_parent: Deprecated: See `moveToNewOwnersRoot` for details.
        :type enforce_single_parent: bool
        :param move_to_new_owners_root: This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed.
        :type move_to_new_owners_root: bool
        :param send_notification_email: 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.
        :type send_notification_email: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_create_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            email_message=email_message,
            enforce_single_parent=enforce_single_parent,
            move_to_new_owners_root=move_to_new_owners_root,
            send_notification_email=send_notification_email,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _drive_permissions_create_serialize(
        self,
        file_id,
        access_token,
        alt,
        param_callback,
        fields,
        key,
        oauth_token,
        pretty_print,
        quota_user,
        upload_protocol,
        upload_type,
        xgafv,
        email_message,
        enforce_single_parent,
        move_to_new_owners_root,
        send_notification_email,
        supports_all_drives,
        supports_team_drives,
        transfer_ownership,
        use_domain_admin_access,
        permission,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if file_id is not None:
            _path_params['fileId'] = file_id
        # process the query parameters
        if access_token is not None:
            
            _query_params.append(('access_token', access_token))
            
        if alt is not None:
            
            _query_params.append(('alt', alt))
            
        if param_callback is not None:
            
            _query_params.append(('callback', param_callback))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if key is not None:
            
            _query_params.append(('key', key))
            
        if oauth_token is not None:
            
            _query_params.append(('oauth_token', oauth_token))
            
        if pretty_print is not None:
            
            _query_params.append(('prettyPrint', pretty_print))
            
        if quota_user is not None:
            
            _query_params.append(('quotaUser', quota_user))
            
        if upload_protocol is not None:
            
            _query_params.append(('upload_protocol', upload_protocol))
            
        if upload_type is not None:
            
            _query_params.append(('uploadType', upload_type))
            
        if xgafv is not None:
            
            _query_params.append(('$.xgafv', xgafv))
            
        if email_message is not None:
            
            _query_params.append(('emailMessage', email_message))
            
        if enforce_single_parent is not None:
            
            _query_params.append(('enforceSingleParent', enforce_single_parent))
            
        if move_to_new_owners_root is not None:
            
            _query_params.append(('moveToNewOwnersRoot', move_to_new_owners_root))
            
        if send_notification_email is not None:
            
            _query_params.append(('sendNotificationEmail', send_notification_email))
            
        if supports_all_drives is not None:
            
            _query_params.append(('supportsAllDrives', supports_all_drives))
            
        if supports_team_drives is not None:
            
            _query_params.append(('supportsTeamDrives', supports_team_drives))
            
        if transfer_ownership is not None:
            
            _query_params.append(('transferOwnership', transfer_ownership))
            
        if use_domain_admin_access is not None:
            
            _query_params.append(('useDomainAdminAccess', use_domain_admin_access))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if permission is not None:
            _body_params = permission


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    '*/*'
                ]
            )

        # set the HTTP header `Content-Type`
        if content_type__:
            _header_params['Content-Type'] = content_type__
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'Oauth2c', 
            'Oauth2'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/files/{fileId}/permissions',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def drive_permissions_delete(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> None:
        """drive_permissions_delete

        Deletes a permission. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_delete_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def drive_permissions_delete_with_http_info(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[None]:
        """drive_permissions_delete

        Deletes a permission. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_delete_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def drive_permissions_delete_without_preload_content(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """drive_permissions_delete

        Deletes a permission. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_delete_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': None,
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _drive_permissions_delete_serialize(
        self,
        file_id,
        permission_id,
        access_token,
        alt,
        param_callback,
        fields,
        key,
        oauth_token,
        pretty_print,
        quota_user,
        upload_protocol,
        upload_type,
        xgafv,
        supports_all_drives,
        supports_team_drives,
        use_domain_admin_access,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if file_id is not None:
            _path_params['fileId'] = file_id
        if permission_id is not None:
            _path_params['permissionId'] = permission_id
        # process the query parameters
        if access_token is not None:
            
            _query_params.append(('access_token', access_token))
            
        if alt is not None:
            
            _query_params.append(('alt', alt))
            
        if param_callback is not None:
            
            _query_params.append(('callback', param_callback))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if key is not None:
            
            _query_params.append(('key', key))
            
        if oauth_token is not None:
            
            _query_params.append(('oauth_token', oauth_token))
            
        if pretty_print is not None:
            
            _query_params.append(('prettyPrint', pretty_print))
            
        if quota_user is not None:
            
            _query_params.append(('quotaUser', quota_user))
            
        if upload_protocol is not None:
            
            _query_params.append(('upload_protocol', upload_protocol))
            
        if upload_type is not None:
            
            _query_params.append(('uploadType', upload_type))
            
        if xgafv is not None:
            
            _query_params.append(('$.xgafv', xgafv))
            
        if supports_all_drives is not None:
            
            _query_params.append(('supportsAllDrives', supports_all_drives))
            
        if supports_team_drives is not None:
            
            _query_params.append(('supportsTeamDrives', supports_team_drives))
            
        if use_domain_admin_access is not None:
            
            _query_params.append(('useDomainAdminAccess', use_domain_admin_access))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter




        # authentication setting
        _auth_settings: List[str] = [
            'Oauth2c', 
            'Oauth2'
        ]

        return self.api_client.param_serialize(
            method='DELETE',
            resource_path='/files/{fileId}/permissions/{permissionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def drive_permissions_get(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> Permission:
        """drive_permissions_get

        Gets a permission by ID.

        :param file_id: The ID of the file. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_get_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def drive_permissions_get_with_http_info(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[Permission]:
        """drive_permissions_get

        Gets a permission by ID.

        :param file_id: The ID of the file. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_get_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def drive_permissions_get_without_preload_content(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """drive_permissions_get

        Gets a permission by ID.

        :param file_id: The ID of the file. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_get_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _drive_permissions_get_serialize(
        self,
        file_id,
        permission_id,
        access_token,
        alt,
        param_callback,
        fields,
        key,
        oauth_token,
        pretty_print,
        quota_user,
        upload_protocol,
        upload_type,
        xgafv,
        supports_all_drives,
        supports_team_drives,
        use_domain_admin_access,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if file_id is not None:
            _path_params['fileId'] = file_id
        if permission_id is not None:
            _path_params['permissionId'] = permission_id
        # process the query parameters
        if access_token is not None:
            
            _query_params.append(('access_token', access_token))
            
        if alt is not None:
            
            _query_params.append(('alt', alt))
            
        if param_callback is not None:
            
            _query_params.append(('callback', param_callback))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if key is not None:
            
            _query_params.append(('key', key))
            
        if oauth_token is not None:
            
            _query_params.append(('oauth_token', oauth_token))
            
        if pretty_print is not None:
            
            _query_params.append(('prettyPrint', pretty_print))
            
        if quota_user is not None:
            
            _query_params.append(('quotaUser', quota_user))
            
        if upload_protocol is not None:
            
            _query_params.append(('upload_protocol', upload_protocol))
            
        if upload_type is not None:
            
            _query_params.append(('uploadType', upload_type))
            
        if xgafv is not None:
            
            _query_params.append(('$.xgafv', xgafv))
            
        if supports_all_drives is not None:
            
            _query_params.append(('supportsAllDrives', supports_all_drives))
            
        if supports_team_drives is not None:
            
            _query_params.append(('supportsTeamDrives', supports_team_drives))
            
        if use_domain_admin_access is not None:
            
            _query_params.append(('useDomainAdminAccess', use_domain_admin_access))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    '*/*'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'Oauth2c', 
            'Oauth2'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/files/{fileId}/permissions/{permissionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def drive_permissions_list(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        include_permissions_for_view: Annotated[Optional[StrictStr], Field(description="Specifies which additional view's permissions to include in the response. Only 'published' is supported.")] = None,
        page_size: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.")] = None,
        page_token: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> PermissionList:
        """drive_permissions_list

        Lists a file's or shared drive's permissions.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param include_permissions_for_view: Specifies which additional view's permissions to include in the response. Only 'published' is supported.
        :type include_permissions_for_view: str
        :param page_size: The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
        :type page_size: int
        :param page_token: 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.
        :type page_token: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_list_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            include_permissions_for_view=include_permissions_for_view,
            page_size=page_size,
            page_token=page_token,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PermissionList",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def drive_permissions_list_with_http_info(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        include_permissions_for_view: Annotated[Optional[StrictStr], Field(description="Specifies which additional view's permissions to include in the response. Only 'published' is supported.")] = None,
        page_size: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.")] = None,
        page_token: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[PermissionList]:
        """drive_permissions_list

        Lists a file's or shared drive's permissions.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param include_permissions_for_view: Specifies which additional view's permissions to include in the response. Only 'published' is supported.
        :type include_permissions_for_view: str
        :param page_size: The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
        :type page_size: int
        :param page_token: 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.
        :type page_token: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_list_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            include_permissions_for_view=include_permissions_for_view,
            page_size=page_size,
            page_token=page_token,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PermissionList",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def drive_permissions_list_without_preload_content(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        include_permissions_for_view: Annotated[Optional[StrictStr], Field(description="Specifies which additional view's permissions to include in the response. Only 'published' is supported.")] = None,
        page_size: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.")] = None,
        page_token: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """drive_permissions_list

        Lists a file's or shared drive's permissions.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param include_permissions_for_view: Specifies which additional view's permissions to include in the response. Only 'published' is supported.
        :type include_permissions_for_view: str
        :param page_size: The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.
        :type page_size: int
        :param page_token: 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.
        :type page_token: str
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_list_serialize(
            file_id=file_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            include_permissions_for_view=include_permissions_for_view,
            page_size=page_size,
            page_token=page_token,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            use_domain_admin_access=use_domain_admin_access,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PermissionList",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _drive_permissions_list_serialize(
        self,
        file_id,
        access_token,
        alt,
        param_callback,
        fields,
        key,
        oauth_token,
        pretty_print,
        quota_user,
        upload_protocol,
        upload_type,
        xgafv,
        include_permissions_for_view,
        page_size,
        page_token,
        supports_all_drives,
        supports_team_drives,
        use_domain_admin_access,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if file_id is not None:
            _path_params['fileId'] = file_id
        # process the query parameters
        if access_token is not None:
            
            _query_params.append(('access_token', access_token))
            
        if alt is not None:
            
            _query_params.append(('alt', alt))
            
        if param_callback is not None:
            
            _query_params.append(('callback', param_callback))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if key is not None:
            
            _query_params.append(('key', key))
            
        if oauth_token is not None:
            
            _query_params.append(('oauth_token', oauth_token))
            
        if pretty_print is not None:
            
            _query_params.append(('prettyPrint', pretty_print))
            
        if quota_user is not None:
            
            _query_params.append(('quotaUser', quota_user))
            
        if upload_protocol is not None:
            
            _query_params.append(('upload_protocol', upload_protocol))
            
        if upload_type is not None:
            
            _query_params.append(('uploadType', upload_type))
            
        if xgafv is not None:
            
            _query_params.append(('$.xgafv', xgafv))
            
        if include_permissions_for_view is not None:
            
            _query_params.append(('includePermissionsForView', include_permissions_for_view))
            
        if page_size is not None:
            
            _query_params.append(('pageSize', page_size))
            
        if page_token is not None:
            
            _query_params.append(('pageToken', page_token))
            
        if supports_all_drives is not None:
            
            _query_params.append(('supportsAllDrives', supports_all_drives))
            
        if supports_team_drives is not None:
            
            _query_params.append(('supportsTeamDrives', supports_team_drives))
            
        if use_domain_admin_access is not None:
            
            _query_params.append(('useDomainAdminAccess', use_domain_admin_access))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    '*/*'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'Oauth2c', 
            'Oauth2'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/files/{fileId}/permissions',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )




    @validate_call
    def drive_permissions_update(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        remove_expiration: Annotated[Optional[StrictBool], Field(description="Whether to remove the expiration date.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> Permission:
        """drive_permissions_update

        Updates a permission with patch semantics. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param remove_expiration: Whether to remove the expiration date.
        :type remove_expiration: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_update_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            remove_expiration=remove_expiration,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def drive_permissions_update_with_http_info(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        remove_expiration: Annotated[Optional[StrictBool], Field(description="Whether to remove the expiration date.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> ApiResponse[Permission]:
        """drive_permissions_update

        Updates a permission with patch semantics. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param remove_expiration: Whether to remove the expiration date.
        :type remove_expiration: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_update_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            remove_expiration=remove_expiration,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def drive_permissions_update_without_preload_content(
        self,
        file_id: Annotated[StrictStr, Field(description="The ID of the file or shared drive.")],
        permission_id: Annotated[StrictStr, Field(description="The ID of the permission.")],
        access_token: Annotated[Optional[StrictStr], Field(description="OAuth access token.")] = None,
        alt: Annotated[Optional[StrictStr], Field(description="Data format for response.")] = None,
        param_callback: Annotated[Optional[StrictStr], Field(description="JSONP")] = None,
        fields: Annotated[Optional[StrictStr], Field(description="Selector specifying which fields to include in a partial response.")] = None,
        key: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        oauth_token: Annotated[Optional[StrictStr], Field(description="OAuth 2.0 token for the current user.")] = None,
        pretty_print: Annotated[Optional[StrictBool], Field(description="Returns response with indentations and line breaks.")] = None,
        quota_user: Annotated[Optional[StrictStr], Field(description="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.")] = None,
        upload_protocol: Annotated[Optional[StrictStr], Field(description="Upload protocol for media (e.g. \"raw\", \"multipart\").")] = None,
        upload_type: Annotated[Optional[StrictStr], Field(description="Legacy upload protocol for media (e.g. \"media\", \"multipart\").")] = None,
        xgafv: Annotated[Optional[StrictStr], Field(description="V1 error format.")] = None,
        remove_expiration: Annotated[Optional[StrictBool], Field(description="Whether to remove the expiration date.")] = None,
        supports_all_drives: Annotated[Optional[StrictBool], Field(description="Whether the requesting application supports both My Drives and shared drives.")] = None,
        supports_team_drives: Annotated[Optional[StrictBool], Field(description="Deprecated: Use `supportsAllDrives` instead.")] = None,
        transfer_ownership: Annotated[Optional[StrictBool], Field(description="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.")] = None,
        use_domain_admin_access: Annotated[Optional[StrictBool], Field(description="Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.")] = None,
        permission: Optional[Permission] = None,
        request_timeout__: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        request_auth__: Optional[Dict[StrictStr, Any]] = None,
        content_type__: Optional[StrictStr] = None,
        headers__: Optional[Dict[StrictStr, Any]] = None,
        host__: Optional[StrictStr] = None,
    ) -> RESTResponseType:
        """drive_permissions_update

        Updates a permission with patch semantics. **Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.

        :param file_id: The ID of the file or shared drive. (required)
        :type file_id: str
        :param permission_id: The ID of the permission. (required)
        :type permission_id: str
        :param access_token: OAuth access token.
        :type access_token: str
        :param alt: Data format for response.
        :type alt: str
        :param param_callback: JSONP
        :type param_callback: str
        :param fields: Selector specifying which fields to include in a partial response.
        :type fields: str
        :param key: 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.
        :type key: str
        :param oauth_token: OAuth 2.0 token for the current user.
        :type oauth_token: str
        :param pretty_print: Returns response with indentations and line breaks.
        :type pretty_print: bool
        :param quota_user: 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.
        :type quota_user: str
        :param upload_protocol: Upload protocol for media (e.g. \"raw\", \"multipart\").
        :type upload_protocol: str
        :param upload_type: Legacy upload protocol for media (e.g. \"media\", \"multipart\").
        :type upload_type: str
        :param xgafv: V1 error format.
        :type xgafv: str
        :param remove_expiration: Whether to remove the expiration date.
        :type remove_expiration: bool
        :param supports_all_drives: Whether the requesting application supports both My Drives and shared drives.
        :type supports_all_drives: bool
        :param supports_team_drives: Deprecated: Use `supportsAllDrives` instead.
        :type supports_team_drives: bool
        :param transfer_ownership: 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.
        :type transfer_ownership: bool
        :param use_domain_admin_access: Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.
        :type use_domain_admin_access: bool
        :param permission:
        :type permission: Permission
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._drive_permissions_update_serialize(
            file_id=file_id,
            permission_id=permission_id,
            access_token=access_token,
            alt=alt,
            param_callback=param_callback,
            fields=fields,
            key=key,
            oauth_token=oauth_token,
            pretty_print=pretty_print,
            quota_user=quota_user,
            upload_protocol=upload_protocol,
            upload_type=upload_type,
            xgafv=xgafv,
            remove_expiration=remove_expiration,
            supports_all_drives=supports_all_drives,
            supports_team_drives=supports_team_drives,
            transfer_ownership=transfer_ownership,
            use_domain_admin_access=use_domain_admin_access,
            permission=permission,
            request_auth__=request_auth__,
            content_type__=content_type__,
            headers__=headers__,
            host__=host__
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "Permission",
        }
        response_data = self.api_client.call_api(
            *_param,
            request_timeout__=request_timeout__
        )
        return response_data.response


    def _drive_permissions_update_serialize(
        self,
        file_id,
        permission_id,
        access_token,
        alt,
        param_callback,
        fields,
        key,
        oauth_token,
        pretty_print,
        quota_user,
        upload_protocol,
        upload_type,
        xgafv,
        remove_expiration,
        supports_all_drives,
        supports_team_drives,
        transfer_ownership,
        use_domain_admin_access,
        permission,
        request_auth__,
        content_type__,
        headers__,
        host__,
    ) -> RequestSerialized:


        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = headers__ or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if file_id is not None:
            _path_params['fileId'] = file_id
        if permission_id is not None:
            _path_params['permissionId'] = permission_id
        # process the query parameters
        if access_token is not None:
            
            _query_params.append(('access_token', access_token))
            
        if alt is not None:
            
            _query_params.append(('alt', alt))
            
        if param_callback is not None:
            
            _query_params.append(('callback', param_callback))
            
        if fields is not None:
            
            _query_params.append(('fields', fields))
            
        if key is not None:
            
            _query_params.append(('key', key))
            
        if oauth_token is not None:
            
            _query_params.append(('oauth_token', oauth_token))
            
        if pretty_print is not None:
            
            _query_params.append(('prettyPrint', pretty_print))
            
        if quota_user is not None:
            
            _query_params.append(('quotaUser', quota_user))
            
        if upload_protocol is not None:
            
            _query_params.append(('upload_protocol', upload_protocol))
            
        if upload_type is not None:
            
            _query_params.append(('uploadType', upload_type))
            
        if xgafv is not None:
            
            _query_params.append(('$.xgafv', xgafv))
            
        if remove_expiration is not None:
            
            _query_params.append(('removeExpiration', remove_expiration))
            
        if supports_all_drives is not None:
            
            _query_params.append(('supportsAllDrives', supports_all_drives))
            
        if supports_team_drives is not None:
            
            _query_params.append(('supportsTeamDrives', supports_team_drives))
            
        if transfer_ownership is not None:
            
            _query_params.append(('transferOwnership', transfer_ownership))
            
        if use_domain_admin_access is not None:
            
            _query_params.append(('useDomainAdminAccess', use_domain_admin_access))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if permission is not None:
            _body_params = permission


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    '*/*'
                ]
            )

        # set the HTTP header `Content-Type`
        if content_type__:
            _header_params['Content-Type'] = content_type__
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'Oauth2c', 
            'Oauth2'
        ]

        return self.api_client.param_serialize(
            method='PATCH',
            resource_path='/files/{fileId}/permissions/{permissionId}',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            host__=host__,
            request_auth__=request_auth__
        )


