#[allow(unused_imports)]
use super::types::*;
#[derive(Clone)]
pub struct DelegatedSignersClient {
client: crate::client::Client,
}
impl DelegatedSignersClient {
pub fn new(client: crate::client::Client) -> Self {
DelegatedSignersClient { client }
}
pub async fn cancel_fleet_operation_init(
&self,
store_id: String,
body: CancelFleetOperationRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/fleet-operations/cancel",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn cancel_fleet_operation_complete(
&self,
store_id: String,
body: CancelFleetOperationRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<CancelFleetOperationResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/fleet-operations/cancel",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_with_user_action::<CancelFleetOperationResponse>(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_add_mac_user_input_init(
&self,
store_id: String,
body: CreateAddMacUserInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/add-mac-user/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_add_mac_user_input_complete(
&self,
store_id: String,
body: CreateAddMacUserInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/add-mac-user/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_add_provisioner_input_init(
&self,
store_id: String,
body: CreateAddProvisionerInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/add-provisioner/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_add_provisioner_input_complete(
&self,
store_id: String,
body: CreateAddProvisionerInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/add-provisioner/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_clone_input_init(
&self,
store_id: String,
body: CreateCloneInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!("/key-stores/{}/clone/input", urlencoding::encode(&store_id));
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_clone_input_complete(
&self,
store_id: String,
body: CreateCloneInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!("/key-stores/{}/clone/input", urlencoding::encode(&store_id));
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_genesis_input_init(
&self,
store_id: String,
body: CreateGenesisInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/genesis/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_genesis_input_complete(
&self,
store_id: String,
body: CreateGenesisInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/genesis/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_key_harvest_input_init(
&self,
store_id: String,
body: CreateKeyHarvestInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/key-harvest/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_key_harvest_input_complete(
&self,
store_id: String,
body: CreateKeyHarvestInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/key-harvest/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_onchain_sign_input_init(
&self,
store_id: String,
body: CreateOnchainSignInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/onchain-sign/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_onchain_sign_input_complete(
&self,
store_id: String,
body: CreateOnchainSignInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/onchain-sign/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn create_proof_of_control_input_init(
&self,
store_id: String,
body: CreateProofOfControlInputRequest,
) -> Result<crate::signer::UserActionChallenge, crate::error::Error> {
let path = format!(
"/key-stores/{}/proof-of-control/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.create_user_action_challenge(reqwest::Method::POST, &path, Some(&body))
.await
}
pub async fn create_proof_of_control_input_complete(
&self,
store_id: String,
body: CreateProofOfControlInputRequest,
challenge_identifier: String,
assertion: crate::signer::CredentialAssertion,
) -> Result<(), crate::error::Error> {
let path = format!(
"/key-stores/{}/proof-of-control/input",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
let user_action = self
.client
.complete_user_action_signing(challenge_identifier, &assertion)
.await?;
self.client
.request_no_content_with_user_action(
reqwest::Method::POST,
&path,
Some(&body),
&user_action,
)
.await
}
pub async fn list_key_stores(&self) -> Result<ListKeyStoresResponse, crate::error::Error> {
let path = String::from("/key-stores");
self.client
.request::<ListKeyStoresResponse>(reqwest::Method::GET, &path, None, false)
.await
}
pub async fn list_signers(&self) -> Result<ListSignersResponse, crate::error::Error> {
let path = String::from("/signers");
self.client
.request::<ListSignersResponse>(reqwest::Method::GET, &path, None, false)
.await
}
pub async fn submit_add_mac_user_output(
&self,
store_id: String,
body: SubmitAddMacUserOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitAddMacUserOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/add-mac-user/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitAddMacUserOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_add_provisioner_output(
&self,
store_id: String,
body: SubmitAddProvisionerOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitAddProvisionerOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/add-provisioner/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitAddProvisionerOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_clone_output(
&self,
store_id: String,
body: SubmitCloneOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitCloneOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/clone/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitCloneOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_genesis_output(
&self,
store_id: String,
body: SubmitGenesisOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitGenesisOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/genesis/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitGenesisOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_key_harvest_output(
&self,
store_id: String,
body: SubmitKeyHarvestOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitKeyHarvestOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/key-harvest/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitKeyHarvestOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_onchain_sign_output(
&self,
store_id: String,
body: SubmitOnchainSignOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitOnchainSignOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/onchain-sign/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitOnchainSignOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
pub async fn submit_proof_of_control_output(
&self,
store_id: String,
body: SubmitProofOfControlOutputRequest,
file: crate::client::MultipartFile,
) -> Result<SubmitProofOfControlOutputResponse, crate::error::Error> {
let path = format!(
"/key-stores/{}/proof-of-control/output",
urlencoding::encode(&store_id)
);
let body = serde_json::to_value(&body)?;
self.client
.request_multipart::<SubmitProofOfControlOutputResponse>(
reqwest::Method::POST,
&path,
Some(&body),
file,
true,
)
.await
}
}