use conjure_http::endpoint;
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_endpoints(
    name = "UploadService",
    use_legacy_error_serialization
)]
pub trait UploadService<#[request_body] I> {
    /// Initiates a multipart upload to object storage.
    /// Returns an uploadId that should be used with listParts, signPart, and completeMultipartUpload.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload",
        name = "initiateMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(
            deserializer = conjure_http::server::StdRequestDeserializer,
            log_as = "uploadRequest"
        )]
        upload_request: super::super::super::super::objects::ingest::api::InitiateMultipartUploadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::InitiateMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Lists the parts that have been uploaded for a given uploadId.
    #[endpoint(
        method = GET,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "listParts",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    fn list_parts(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        Vec<super::super::super::super::objects::ingest::api::PartWithSize>,
        conjure_http::private::Error,
    >;
    /// Signs an upload request for a single part.
    /// Returns a URL that will execute the upload without further authentication.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "signPart",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn sign_part(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "partNumber",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "partNumber"
        )]
        part_number: i32,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignPartResponse,
        conjure_http::private::Error,
    >;
    /// Completes a multipart upload to object storage.
    /// This should be called after all parts have been uploaded.
    /// Will throw EmptyMultipartUpload if there are 0 parts.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/complete",
        name = "completeMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        parts: Vec<super::super::super::super::objects::ingest::api::Part>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::CompleteMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Aborts a multipart upload to S3.
    /// Frees storage used by previously uploaded parts and prevents further uploads to the same uploadId.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/abort",
        name = "abortMultipartUpload"
    )]
    fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<(), conjure_http::private::Error>;
    /// Returns a short-lived signed GET URL for an object already in the uploads bucket.
    /// Use this to hand a freshly-uploaded object's path to an external service (e.g. Dagger)
    /// without giving that service any Scout credentials. The caller must be authorized to
    /// read the workspace that owns the path (encoded as the first segment of the object key).
    #[endpoint(
        method = POST,
        path = "/upload/v1/sign-download",
        name = "signDownload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn sign_download(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::super::objects::ingest::api::SignDownloadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignDownloadResponse,
        conjure_http::private::Error,
    >;
    /// Uploads a file to S3. Intended for smaller files.
    #[endpoint(
        method = POST,
        path = "/upload/v1/upload-file",
        name = "uploadFile",
        produces = conjure_http::server::StdResponseSerializer
    )]
    fn upload_file(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[query(
            name = "fileName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "fileName"
        )]
        file_name: String,
        #[query(
            name = "sizeBytes",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder,
            log_as = "sizeBytes"
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        workspace: Option<conjure_object::ResourceIdentifier>,
        #[body(deserializer = conjure_http::server::conjure::BinaryRequestDeserializer)]
        body: I,
    ) -> Result<String, conjure_http::private::Error>;
}
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_endpoints(
    name = "UploadService",
    use_legacy_error_serialization
)]
pub trait AsyncUploadService<#[request_body] I> {
    /// Initiates a multipart upload to object storage.
    /// Returns an uploadId that should be used with listParts, signPart, and completeMultipartUpload.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload",
        name = "initiateMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(
            deserializer = conjure_http::server::StdRequestDeserializer,
            log_as = "uploadRequest"
        )]
        upload_request: super::super::super::super::objects::ingest::api::InitiateMultipartUploadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::InitiateMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Lists the parts that have been uploaded for a given uploadId.
    #[endpoint(
        method = GET,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "listParts",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    async fn list_parts(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        Vec<super::super::super::super::objects::ingest::api::PartWithSize>,
        conjure_http::private::Error,
    >;
    /// Signs an upload request for a single part.
    /// Returns a URL that will execute the upload without further authentication.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "signPart",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn sign_part(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "partNumber",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "partNumber"
        )]
        part_number: i32,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignPartResponse,
        conjure_http::private::Error,
    >;
    /// Completes a multipart upload to object storage.
    /// This should be called after all parts have been uploaded.
    /// Will throw EmptyMultipartUpload if there are 0 parts.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/complete",
        name = "completeMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        parts: Vec<super::super::super::super::objects::ingest::api::Part>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::CompleteMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Aborts a multipart upload to S3.
    /// Frees storage used by previously uploaded parts and prevents further uploads to the same uploadId.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/abort",
        name = "abortMultipartUpload"
    )]
    async fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<(), conjure_http::private::Error>;
    /// Returns a short-lived signed GET URL for an object already in the uploads bucket.
    /// Use this to hand a freshly-uploaded object's path to an external service (e.g. Dagger)
    /// without giving that service any Scout credentials. The caller must be authorized to
    /// read the workspace that owns the path (encoded as the first segment of the object key).
    #[endpoint(
        method = POST,
        path = "/upload/v1/sign-download",
        name = "signDownload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn sign_download(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::super::objects::ingest::api::SignDownloadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignDownloadResponse,
        conjure_http::private::Error,
    >;
    /// Uploads a file to S3. Intended for smaller files.
    #[endpoint(
        method = POST,
        path = "/upload/v1/upload-file",
        name = "uploadFile",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn upload_file(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[query(
            name = "fileName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "fileName"
        )]
        file_name: String,
        #[query(
            name = "sizeBytes",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder,
            log_as = "sizeBytes"
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        workspace: Option<conjure_object::ResourceIdentifier>,
        #[body(deserializer = conjure_http::server::conjure::BinaryRequestDeserializer)]
        body: I,
    ) -> Result<String, conjure_http::private::Error>;
}
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_endpoints(
    name = "UploadService",
    use_legacy_error_serialization,
    local
)]
pub trait LocalAsyncUploadService<#[request_body] I> {
    /// Initiates a multipart upload to object storage.
    /// Returns an uploadId that should be used with listParts, signPart, and completeMultipartUpload.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload",
        name = "initiateMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(
            deserializer = conjure_http::server::StdRequestDeserializer,
            log_as = "uploadRequest"
        )]
        upload_request: super::super::super::super::objects::ingest::api::InitiateMultipartUploadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::InitiateMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Lists the parts that have been uploaded for a given uploadId.
    #[endpoint(
        method = GET,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "listParts",
        produces = conjure_http::server::conjure::CollectionResponseSerializer
    )]
    async fn list_parts(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        Vec<super::super::super::super::objects::ingest::api::PartWithSize>,
        conjure_http::private::Error,
    >;
    /// Signs an upload request for a single part.
    /// Returns a URL that will execute the upload without further authentication.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}",
        name = "signPart",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn sign_part(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "partNumber",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "partNumber"
        )]
        part_number: i32,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignPartResponse,
        conjure_http::private::Error,
    >;
    /// Completes a multipart upload to object storage.
    /// This should be called after all parts have been uploaded.
    /// Will throw EmptyMultipartUpload if there are 0 parts.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/complete",
        name = "completeMultipartUpload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        parts: Vec<super::super::super::super::objects::ingest::api::Part>,
    ) -> Result<
        super::super::super::super::objects::ingest::api::CompleteMultipartUploadResponse,
        conjure_http::private::Error,
    >;
    /// Aborts a multipart upload to S3.
    /// Frees storage used by previously uploaded parts and prevents further uploads to the same uploadId.
    #[endpoint(
        method = POST,
        path = "/upload/v1/multipart-upload/{uploadId}/abort",
        name = "abortMultipartUpload"
    )]
    async fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[path(
            name = "uploadId",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "uploadId"
        )]
        upload_id: String,
        #[query(name = "key", decoder = conjure_http::server::conjure::FromPlainDecoder)]
        key: String,
        #[query(
            name = "bucket",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        bucket: Option<String>,
    ) -> Result<(), conjure_http::private::Error>;
    /// Returns a short-lived signed GET URL for an object already in the uploads bucket.
    /// Use this to hand a freshly-uploaded object's path to an external service (e.g. Dagger)
    /// without giving that service any Scout credentials. The caller must be authorized to
    /// read the workspace that owns the path (encoded as the first segment of the object key).
    #[endpoint(
        method = POST,
        path = "/upload/v1/sign-download",
        name = "signDownload",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn sign_download(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[body(deserializer = conjure_http::server::StdRequestDeserializer)]
        request: super::super::super::super::objects::ingest::api::SignDownloadRequest,
    ) -> Result<
        super::super::super::super::objects::ingest::api::SignDownloadResponse,
        conjure_http::private::Error,
    >;
    /// Uploads a file to S3. Intended for smaller files.
    #[endpoint(
        method = POST,
        path = "/upload/v1/upload-file",
        name = "uploadFile",
        produces = conjure_http::server::StdResponseSerializer
    )]
    async fn upload_file(
        &self,
        #[auth]
        auth_: conjure_object::BearerToken,
        #[query(
            name = "fileName",
            decoder = conjure_http::server::conjure::FromPlainDecoder,
            log_as = "fileName"
        )]
        file_name: String,
        #[query(
            name = "sizeBytes",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder,
            log_as = "sizeBytes"
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            decoder = conjure_http::server::conjure::FromPlainOptionDecoder
        )]
        workspace: Option<conjure_object::ResourceIdentifier>,
        #[body(deserializer = conjure_http::server::conjure::BinaryRequestDeserializer)]
        body: I,
    ) -> Result<String, conjure_http::private::Error>;
}
