pub mod application;
pub mod attachment;
pub mod channel;
pub mod guild;
pub mod poll;
pub mod scheduled_event;
pub mod sticker;
pub mod template;
pub mod user;
mod audit_reason;
mod base;
mod get_current_authorization_information;
mod get_gateway;
mod get_gateway_authed;
mod get_user_application;
mod get_voice_regions;
mod multipart;
mod try_into_request;
mod update_user_application;
pub use self::{
audit_reason::AuditLogReason,
base::{Request, RequestBuilder},
get_current_authorization_information::GetCurrentAuthorizationInformation,
get_gateway::GetGateway,
get_gateway_authed::GetGatewayAuthed,
get_user_application::GetUserApplicationInfo,
get_voice_regions::GetVoiceRegions,
multipart::Form,
try_into_request::TryIntoRequest,
update_user_application::UpdateCurrentUserApplication,
};
pub use twilight_http_ratelimiting::Method;
use crate::error::{Error, ErrorType};
use http::header::{HeaderName, HeaderValue};
use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
use serde::Serialize;
use std::iter;
const REASON_HEADER_NAME: &str = "x-audit-log-reason";
#[derive(Serialize)]
struct Nullable<T>(Option<T>);
fn audit_header(reason: &str) -> Result<impl Iterator<Item = (HeaderName, HeaderValue)>, Error> {
let header_name = HeaderName::from_static(REASON_HEADER_NAME);
let encoded_reason = utf8_percent_encode(reason, NON_ALPHANUMERIC).to_string();
let header_value = HeaderValue::from_str(&encoded_reason).map_err(|e| Error {
kind: ErrorType::CreatingHeader {
name: encoded_reason,
},
source: Some(Box::new(e)),
})?;
Ok(iter::once((header_name, header_value)))
}