// Generated by wuapi-codegen from the OpenAPI spec. Do not edit: run `bun run codegen`.
use crate::http::{HttpClient, Method, Request, RequestParts, encode_path};
use crate::types;
/// Reject incoming calls. Automatic rejection is a setting on the account (`PATCH /v1/accounts/{accountId}`).
#[derive(Clone, Debug)]
pub struct CallsResource {
http: HttpClient,
}
impl CallsResource {
pub(crate) fn new(http: HttpClient) -> Self {
Self { http }
}
/// Reject an incoming call
///
/// Use the `id` and `from` of a `call.received` event. For automatic rejection, set `rejectCalls` on the account.
///
/// `POST /v1/accounts/{accountId}/calls/{callId}/reject`
///
/// Sends `Idempotency-Key` (a random key, or your own with `.idempotency_key(..)`), so it is retried on timeouts, network errors, `429` and `5xx` without repeating its effect.
pub fn reject(
&self,
account_id: &str,
call_id: &str,
params: types::CallsRejectParams,
) -> Request<()> {
let parts = RequestParts::new(Method::Post, format!("/v1/accounts/{}/calls/{}/reject", encode_path(account_id), encode_path(call_id)))
.body(¶ms)
.keyed()
.no_content();
self.http.request(parts)
}
}