"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .getfileresponse import GetFileResponse, GetFileResponseTypedDict
from .unexpectederrorresponse import (
    UnexpectedErrorResponse,
    UnexpectedErrorResponseTypedDict,
)
from apideck_unify.types import BaseModel
from apideck_unify.utils import (
    FieldMetadata,
    HeaderMetadata,
    PathParamMetadata,
    QueryParamMetadata,
    RequestMetadata,
)
import pydantic
from typing import Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict

FILE_STORAGE_UPLOAD_SESSIONS_FINISH_OP_SERVERS = [
    "https://upload.apideck.com",
]


class FileStorageUploadSessionsFinishGlobalsTypedDict(TypedDict):
    consumer_id: NotRequired[str]
    r"""ID of the consumer which you want to get or push data from"""
    app_id: NotRequired[str]
    r"""The ID of your Unify application"""


class FileStorageUploadSessionsFinishGlobals(BaseModel):
    consumer_id: Annotated[
        Optional[str],
        pydantic.Field(alias="x-apideck-consumer-id"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""ID of the consumer which you want to get or push data from"""

    app_id: Annotated[
        Optional[str],
        pydantic.Field(alias="x-apideck-app-id"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The ID of your Unify application"""


class FileStorageUploadSessionsFinishRequestBodyTypedDict(TypedDict):
    pass


class FileStorageUploadSessionsFinishRequestBody(BaseModel):
    pass


class FileStorageUploadSessionsFinishRequestTypedDict(TypedDict):
    id: str
    r"""ID of the record you are acting upon."""
    raw: NotRequired[bool]
    r"""Include raw response. Mostly used for debugging purposes"""
    service_id: NotRequired[str]
    r"""Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API."""
    digest: NotRequired[str]
    r"""The RFC3230 message digest of the uploaded part. Only required for the Box connector. More information on the Box API docs [here](https://developer.box.com/reference/put-files-upload-sessions-id/#param-digest)"""
    request_body: NotRequired[FileStorageUploadSessionsFinishRequestBodyTypedDict]


class FileStorageUploadSessionsFinishRequest(BaseModel):
    id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""ID of the record you are acting upon."""

    raw: Annotated[
        Optional[bool],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = False
    r"""Include raw response. Mostly used for debugging purposes"""

    service_id: Annotated[
        Optional[str],
        pydantic.Field(alias="x-apideck-service-id"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API."""

    digest: Annotated[
        Optional[str],
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""The RFC3230 message digest of the uploaded part. Only required for the Box connector. More information on the Box API docs [here](https://developer.box.com/reference/put-files-upload-sessions-id/#param-digest)"""

    request_body: Annotated[
        Optional[FileStorageUploadSessionsFinishRequestBody],
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ] = None


FileStorageUploadSessionsFinishResponseTypedDict = TypeAliasType(
    "FileStorageUploadSessionsFinishResponseTypedDict",
    Union[GetFileResponseTypedDict, UnexpectedErrorResponseTypedDict],
)


FileStorageUploadSessionsFinishResponse = TypeAliasType(
    "FileStorageUploadSessionsFinishResponse",
    Union[GetFileResponse, UnexpectedErrorResponse],
)
