// This file is auto-generated by oagen. Do not edit.
use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
#[allow(unused_imports)]
use serde::Serialize;
pub struct VariantDeliverableFilesApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Serialize)]
pub struct ListParams {
/// Number of items to return per page.
///
/// Defaults to `15`.
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
/// Page number to return.
///
/// Defaults to `1`.
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl Default for ListParams {
#[allow(deprecated)]
fn default() -> Self {
Self {
limit: Some(15),
page: Some(1),
x_store: Default::default(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UploadParams {
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
/// Request body sent with this call.
///
/// Required.
#[serde(skip)]
pub body: SdkUploadVariantDeliverableFileRequestMultipartFormData,
}
impl UploadParams {
/// Construct a new `UploadParams` with the required fields set.
#[allow(deprecated)]
pub fn new(body: SdkUploadVariantDeliverableFileRequestMultipartFormData) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetParams {
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct ReplaceParams {
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
/// Request body sent with this call.
///
/// Required.
#[serde(skip)]
pub body: SdkReplaceVariantDeliverableFileSettingsRequestApplicationJson,
}
impl ReplaceParams {
/// Construct a new `ReplaceParams` with the required fields set.
#[allow(deprecated)]
pub fn new(body: SdkReplaceVariantDeliverableFileSettingsRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateParams {
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
/// Request body sent with this call.
///
/// Required.
#[serde(skip)]
pub body: SdkUpdateVariantDeliverableFileRequestApplicationJson,
}
impl UpdateParams {
/// Construct a new `UpdateParams` with the required fields set.
#[allow(deprecated)]
pub fn new(body: SdkUpdateVariantDeliverableFileRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct DeleteParams {
/// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl<'a> VariantDeliverableFilesApi<'a> {
/// List variant deliverable files
///
/// List variant deliverable files. Requires the listing Sanctum ability. Lists managed files without revealing storage keys. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn list(
&self,
product: &str,
variant: &str,
params: ListParams,
) -> Result<SdkListVariantDeliverableFilesResponseValue200ApplicationJson, Error> {
self.list_with_options(product, variant, params, None).await
}
/// Variant of [`Self::list`] that accepts per-request [`crate::RequestOptions`].
pub async fn list_with_options(
&self,
product: &str,
variant: &str,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkListVariantDeliverableFilesResponseValue200ApplicationJson, Error> {
self.list_raw(product, variant, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn list_raw(
&self,
product: &str,
variant: &str,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkListVariantDeliverableFilesResponseValue200ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("listVariantDeliverableFiles".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/products/{product}/variants/{variant}/deliverable/files",
)
.await
}
/// Upload a variant deliverable file
///
/// Upload a variant deliverable file. Requires the listing Sanctum ability. Accepts an uploaded file, stores it under a server-generated key, and queues the durable move after commit. Uploads may be staged before DOWNLOADABLE is activated; inactive pending files are retained temporarily and scheduled for cleanup if activation is abandoned. Client-supplied storage paths are not accepted. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn upload(
&self,
product: &str,
variant: &str,
params: UploadParams,
) -> Result<SdkUploadVariantDeliverableFileResponseValue201ApplicationJson, Error> {
self.upload_with_options(product, variant, params, None)
.await
}
/// Variant of [`Self::upload`] that accepts per-request [`crate::RequestOptions`].
pub async fn upload_with_options(
&self,
product: &str,
variant: &str,
params: UploadParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkUploadVariantDeliverableFileResponseValue201ApplicationJson, Error> {
self.upload_raw(product, variant, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn upload_raw(
&self,
product: &str,
variant: &str,
params: UploadParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkUploadVariantDeliverableFileResponseValue201ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files");
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("uploadVariantDeliverableFile".to_string());
merged.body_encoding = crate::BodyEncoding::Multipart;
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/products/{product}/variants/{variant}/deliverable/files",
)
.await
}
/// Retrieve a variant deliverable file
///
/// Retrieve a variant deliverable file. Requires the listing Sanctum ability. The file is scoped through the authenticated store, product, and variant. Internal storage keys are immutable and never returned. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn get(
&self,
product: &str,
variant: &str,
file: &str,
params: GetParams,
) -> Result<SdkGetVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.get_with_options(product, variant, file, params, None)
.await
}
/// Variant of [`Self::get`] that accepts per-request [`crate::RequestOptions`].
pub async fn get_with_options(
&self,
product: &str,
variant: &str,
file: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.get_raw(product, variant, file, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn get_raw(
&self,
product: &str,
variant: &str,
file: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkGetVariantDeliverableFileResponseValue200ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let file = crate::client::path_segment(file);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files/{file}");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getVariantDeliverableFile".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/products/{product}/variants/{variant}/deliverable/files/{file}",
)
.await
}
/// Replace variant deliverable file settings
///
/// Replace variant deliverable file settings. Requires the listing Sanctum ability. The file is scoped through the authenticated store, product, and variant. Internal storage keys are immutable and never returned. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn replace(
&self,
product: &str,
variant: &str,
file: &str,
params: ReplaceParams,
) -> Result<SdkReplaceVariantDeliverableFileSettingsResponseValue200ApplicationJson, Error>
{
self.replace_with_options(product, variant, file, params, None)
.await
}
/// Variant of [`Self::replace`] that accepts per-request [`crate::RequestOptions`].
pub async fn replace_with_options(
&self,
product: &str,
variant: &str,
file: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkReplaceVariantDeliverableFileSettingsResponseValue200ApplicationJson, Error>
{
self.replace_raw(product, variant, file, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn replace_raw(
&self,
product: &str,
variant: &str,
file: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkReplaceVariantDeliverableFileSettingsResponseValue200ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let file = crate::client::path_segment(file);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files/{file}");
let method = http::Method::PUT;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("replaceVariantDeliverableFileSettings".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PUT /v2/products/{product}/variants/{variant}/deliverable/files/{file}",
)
.await
}
/// Update a variant deliverable file
///
/// Update a variant deliverable file. Requires the listing Sanctum ability. The file is scoped through the authenticated store, product, and variant. Internal storage keys are immutable and never returned. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn update(
&self,
product: &str,
variant: &str,
file: &str,
params: UpdateParams,
) -> Result<SdkUpdateVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.update_with_options(product, variant, file, params, None)
.await
}
/// Variant of [`Self::update`] that accepts per-request [`crate::RequestOptions`].
pub async fn update_with_options(
&self,
product: &str,
variant: &str,
file: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkUpdateVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.update_raw(product, variant, file, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn update_raw(
&self,
product: &str,
variant: &str,
file: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkUpdateVariantDeliverableFileResponseValue200ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let file = crate::client::path_segment(file);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files/{file}");
let method = http::Method::PATCH;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("updateVariantDeliverableFile".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PATCH /v2/products/{product}/variants/{variant}/deliverable/files/{file}",
)
.await
}
/// Delete a variant deliverable file
///
/// Delete a variant deliverable file. Requires the listing Sanctum ability. The file is scoped through the authenticated store, product, and variant. Internal storage keys are immutable and never returned. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
pub async fn delete(
&self,
product: &str,
variant: &str,
file: &str,
params: DeleteParams,
) -> Result<SdkDeleteVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.delete_with_options(product, variant, file, params, None)
.await
}
/// Variant of [`Self::delete`] that accepts per-request [`crate::RequestOptions`].
pub async fn delete_with_options(
&self,
product: &str,
variant: &str,
file: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkDeleteVariantDeliverableFileResponseValue200ApplicationJson, Error> {
self.delete_raw(product, variant, file, params, options)
.await
.map(|response| response.data)
}
/// Returns the typed result together with status, headers, and request ID.
pub async fn delete_raw(
&self,
product: &str,
variant: &str,
file: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkDeleteVariantDeliverableFileResponseValue200ApplicationJson>,
Error,
> {
let product = crate::client::path_segment(product);
let variant = crate::client::path_segment(variant);
let file = crate::client::path_segment(file);
let path = format!("/v2/products/{product}/variants/{variant}/deliverable/files/{file}");
let method = http::Method::DELETE;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("deleteVariantDeliverableFile".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"DELETE /v2/products/{product}/variants/{variant}/deliverable/files/{file}",
)
.await
}
}