# Code generated by Lark OpenAPI.

from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.model import BaseRequest
from lark_oapi.core.enum import HttpMethod, AccessTokenType
from .permission_public import PermissionPublic


class PatchPermissionPublicRequest(BaseRequest):
    def __init__(self) -> None:
        super().__init__()
        self.type: Optional[str] = None
        self.token: Optional[str] = None
        self.request_body: Optional[PermissionPublic] = None

    @staticmethod
    def builder() -> "PatchPermissionPublicRequestBuilder":
        return PatchPermissionPublicRequestBuilder()


class PatchPermissionPublicRequestBuilder(object):

    def __init__(self) -> None:
        patch_permission_public_request = PatchPermissionPublicRequest()
        patch_permission_public_request.http_method = HttpMethod.PATCH
        patch_permission_public_request.uri = "/open-apis/drive/v2/permissions/:token/public"
        patch_permission_public_request.token_types = {AccessTokenType.TENANT, AccessTokenType.USER}
        self._patch_permission_public_request: PatchPermissionPublicRequest = patch_permission_public_request

    def type(self, type: str) -> "PatchPermissionPublicRequestBuilder":
        self._patch_permission_public_request.type = type
        self._patch_permission_public_request.add_query("type", type)
        return self

    def token(self, token: str) -> "PatchPermissionPublicRequestBuilder":
        self._patch_permission_public_request.token = token
        self._patch_permission_public_request.paths["token"] = str(token)
        return self

    def request_body(self, request_body: PermissionPublic) -> "PatchPermissionPublicRequestBuilder":
        self._patch_permission_public_request.request_body = request_body
        self._patch_permission_public_request.body = request_body
        return self

    def build(self) -> PatchPermissionPublicRequest:
        return self._patch_permission_public_request
