use conjure_http::endpoint;
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_client(name = "UploadService")]
pub trait UploadService<
    #[request_writer]
    O,
    #[response_body]
    I: Iterator<
            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
        >,
> {
    /// 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::conjure::CollectionResponseDeserializer
    )]
    fn list_parts(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    fn sign_part(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[query(
            name = "partNumber",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        part_number: i32,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        parts: &[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",
        accept = conjure_http::client::conjure::EmptyResponseDeserializer
    )]
    fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    fn sign_download(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    fn upload_file(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[query(
            name = "fileName",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        file_name: &str,
        #[query(
            name = "sizeBytes",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        workspace: Option<&conjure_object::ResourceIdentifier>,
        #[body(serializer = conjure_http::client::conjure::BinaryRequestSerializer)]
        body: impl conjure_http::client::WriteBody<O>,
    ) -> Result<String, conjure_http::private::Error>;
}
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_client(name = "UploadService")]
pub trait AsyncUploadService<
    #[request_writer]
    O,
    #[response_body]
    I: conjure_http::private::Stream<
            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
        >,
> {
    /// 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::conjure::CollectionResponseDeserializer
    )]
    async fn list_parts(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn sign_part(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[query(
            name = "partNumber",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        part_number: i32,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        parts: &[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",
        accept = conjure_http::client::conjure::EmptyResponseDeserializer
    )]
    async fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn sign_download(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn upload_file(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[query(
            name = "fileName",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        file_name: &str,
        #[query(
            name = "sizeBytes",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        workspace: Option<&conjure_object::ResourceIdentifier>,
        #[body(serializer = conjure_http::client::conjure::BinaryRequestSerializer)]
        body: impl conjure_http::client::AsyncWriteBody<O> + Sync + Send,
    ) -> Result<String, conjure_http::private::Error>;
}
/// The Upload Service manages file uploads to object storage.
#[conjure_http::conjure_client(name = "UploadService", local)]
pub trait LocalAsyncUploadService<
    #[request_writer]
    O,
    #[response_body]
    I: conjure_http::private::Stream<
            Item = Result<conjure_http::private::Bytes, conjure_http::private::Error>,
        >,
> {
    /// 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn initiate_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::conjure::CollectionResponseDeserializer
    )]
    async fn list_parts(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn sign_part(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[query(
            name = "partNumber",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        part_number: i32,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn complete_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        parts: &[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",
        accept = conjure_http::client::conjure::EmptyResponseDeserializer
    )]
    async fn abort_multipart_upload(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[path(name = "uploadId", encoder = conjure_http::client::conjure::PlainEncoder)]
        upload_id: &str,
        #[query(name = "key", encoder = conjure_http::client::conjure::PlainEncoder)]
        key: &str,
    ) -> 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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn sign_download(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[body(serializer = conjure_http::client::StdRequestSerializer)]
        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",
        accept = conjure_http::client::StdResponseDeserializer
    )]
    async fn upload_file(
        &self,
        #[auth]
        auth_: &conjure_object::BearerToken,
        #[query(
            name = "fileName",
            encoder = conjure_http::client::conjure::PlainEncoder
        )]
        file_name: &str,
        #[query(
            name = "sizeBytes",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        size_bytes: Option<conjure_object::SafeLong>,
        #[query(
            name = "workspace",
            encoder = conjure_http::client::conjure::PlainSeqEncoder
        )]
        workspace: Option<&conjure_object::ResourceIdentifier>,
        #[body(serializer = conjure_http::client::conjure::BinaryRequestSerializer)]
        body: impl conjure_http::client::LocalAsyncWriteBody<O>,
    ) -> Result<String, conjure_http::private::Error>;
}
