Files
inbuxa-server/crates/jmap-proto/src/response/mod.rs
T
jcoffey-dev 86d7ebd982
ci / fork-checks (pull_request) Successful in 52s
ci / build (pull_request) Successful in 1h4m15s
Audit log: a permanent, tamper-evident record of admin actions
What administrators and the server itself do to the control plane is now
recorded, from inbuxa-drafts/specs/audit-hold-lock.md (AU-1 to AU-12):
settings, accounts, domains, roles and every other registry change, with
each field's before and after (secrets only as "changed"); the fork's own
settings objects; administrator sign-ins (and failed ones to administrator
accounts), master-user and recovery-admin sign-ins, once an hour per
account, method and address; access to another account's data through
impersonation or FetchAnyBlob, once an hour; exports and tamper checks;
and registry writes the server makes on its own, named by subsystem
(system:AcmeRenewal, system:auto-ban, system:directory-sync, ...), with a
spam rules update as one summary record.

No change without its record (AU-3): before a set method changes anything,
a pending record per requested create, update and destroy is written; if
that fails, the method is refused with serverFail. Its outcome follows as
a later entry. A change interrupted by a crash stays "unfinished".

Records live in the fork's subspace under L, as one SHA-256 hash chain per
node. The chain's head is stored, never cached, and every append asserts
it, so two writers can't take the same place. Nothing can edit or delete
a record; the daily purge removes the oldest past the retention (default
730 days, minimum 90) and records where the chain now starts, so
verification still passes. security.audit-recorded (647) copies each
record to webhooks, OpenTelemetry and the log; security.audit-write-failed
(648) reports a failed write.

New JMAP objects under urn:inbuxa:jmap: inbuxa:AuditEvent/get and /query
(filters: time, actor, action, target, account, tenant, outcome, address,
text), inbuxa:AuditSettings, inbuxa:AuditExport (CSV or JSON Lines built
on the server, each line with its chain hash, ending in a manifest; the
created object names the blob and its SHA-256) and
inbuxa:AuditVerification. New permissions sysAuditGet, sysAuditExport and
sysAuditSettingsUpdate: the Administrator role gets all three, the Tenant
Administrator role gets read and export, once, on existing installs too.
A tenant administrator sees records whose actor or target is in its
tenant, including a server administrator's changes there.

Sign-in method on the session: access tokens now remember how they signed
in (password, app password, API key, OAuth client, directory, master user,
recovery admin), including across the HTTP credential cache. New OAuth
access tokens carry their client id in the sealed claims; older ones show
as client "unknown" until they expire.

The schema gains the permissions, the two events and a Management >
Compliance > Audit Log link.

Stack: the request layer boxes every inner future where it's made. Without
that, a debug build overflowed the default 2 MB worker stack on a registry
set; measured with the same request, the branch and main now overflow at
the same stack size (between 1856 and 1920 KiB, debug), so the layer adds
nothing measurable.

Tests: unit tests in inbuxa-features and jmap; system::audit::audit_log_tests
(run with --ignored) passes on RocksDB, SQLite, PostgreSQL, PostgreSQL with a
read replica, MySQL, MySQL with a replica and FoundationDB. The system, JMAP
and SCIM suites pass. authorization.rs skipped fork permissions that guard
no registry object; the audit suite checks a plain user is refused instead.
2026-09-27 13:40:12 -07:00

753 lines
26 KiB
Rust

/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*
* Modified by Coffey Labs in 2026 for INBUXA.
*/
pub mod serialize;
pub mod status;
use self::serialize::serialize_hex;
use crate::{
error::method::MethodErrorWrapper,
method::{
availability::GetAvailabilityResponse,
changes::ChangesResponse,
copy::{CopyBlobResponse, CopyResponse},
get::GetResponse,
import::ImportEmailResponse,
lookup::BlobLookupResponse,
parse::ParseResponse,
query::QueryResponse,
query_changes::QueryChangesResponse,
search_snippet::GetSearchSnippetResponse,
set::SetResponse,
upload::BlobUploadResponse,
validate::ValidateSieveScriptResponse,
},
object::{
AnyId,
addressbook::AddressBook,
blob::Blob,
calendar::Calendar,
calendar_event::CalendarEvent,
calendar_event_notification::{
CalendarEventNotification, CalendarEventNotificationGetResponse,
},
contact::ContactCard,
email::Email,
email_submission::EmailSubmission,
file_node::FileNode,
identity::Identity,
mailbox::Mailbox,
participant_identity::ParticipantIdentity,
principal::Principal,
push_subscription::PushSubscription,
quota::Quota,
registry::Registry,
share_notification::ShareNotification,
sieve::Sieve,
thread::Thread,
vacation_response::VacationResponse,
},
request::{Call, method::MethodName},
};
use jmap_tools::{Null, Value};
use std::collections::HashMap;
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum ResponseMethod<'x> {
Get(GetResponseMethod),
Set(SetResponseMethod),
Changes(ChangesResponseMethod),
Copy(CopyResponseMethod),
ImportEmail(ImportEmailResponse),
Parse(ParseResponseMethod),
QueryChanges(QueryChangesResponse),
Query(QueryResponse),
SearchSnippet(GetSearchSnippetResponse),
ValidateScript(ValidateSieveScriptResponse),
LookupBlob(BlobLookupResponse),
UploadBlob(BlobUploadResponse),
Echo(Value<'x, Null, Null>),
Error(MethodErrorWrapper),
}
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum GetResponseMethod {
Email(GetResponse<Email>),
Mailbox(GetResponse<Mailbox>),
Thread(GetResponse<Thread>),
Identity(GetResponse<Identity>),
EmailSubmission(GetResponse<EmailSubmission>),
PushSubscription(GetResponse<PushSubscription>),
Sieve(GetResponse<Sieve>),
VacationResponse(GetResponse<VacationResponse>),
Principal(GetResponse<Principal>),
PrincipalAvailability(GetAvailabilityResponse),
Quota(GetResponse<Quota>),
Blob(GetResponse<Blob>),
AddressBook(GetResponse<AddressBook>),
ContactCard(GetResponse<ContactCard>),
FileNode(GetResponse<FileNode>),
Calendar(GetResponse<Calendar>),
CalendarEvent(GetResponse<CalendarEvent>),
CalendarEventNotification(CalendarEventNotificationGetResponse),
ParticipantIdentity(GetResponse<ParticipantIdentity>),
ShareNotification(GetResponse<ShareNotification>),
Registry(GetResponse<Registry>),
MaskedEmail(GetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>),
DeletedAccount(GetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>),
AiLimits(GetResponse<crate::object::inbuxa_ai_limits::AiLimits>),
AuditEvent(GetResponse<crate::object::inbuxa_audit::AuditEvent>),
AuditSettings(GetResponse<crate::object::inbuxa_audit::AuditSettings>),
ProtocolPolicy(GetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>),
TenantProtocolPolicy(
GetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>,
),
}
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum SetResponseMethod {
Email(Box<SetResponse<Email>>),
Mailbox(Box<SetResponse<Mailbox>>),
Identity(Box<SetResponse<Identity>>),
EmailSubmission(Box<SetResponse<EmailSubmission>>),
PushSubscription(Box<SetResponse<PushSubscription>>),
Sieve(Box<SetResponse<Sieve>>),
VacationResponse(Box<SetResponse<VacationResponse>>),
AddressBook(Box<SetResponse<AddressBook>>),
ContactCard(Box<SetResponse<ContactCard>>),
FileNode(Box<SetResponse<FileNode>>),
ShareNotification(Box<SetResponse<ShareNotification>>),
Calendar(Box<SetResponse<Calendar>>),
CalendarEvent(Box<SetResponse<CalendarEvent>>),
CalendarEventNotification(Box<SetResponse<CalendarEventNotification>>),
ParticipantIdentity(Box<SetResponse<ParticipantIdentity>>),
Registry(Box<SetResponse<Registry>>),
MaskedEmail(Box<SetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>>),
DeletedAccount(Box<SetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>>),
AiLimits(Box<SetResponse<crate::object::inbuxa_ai_limits::AiLimits>>),
AuditSettings(Box<SetResponse<crate::object::inbuxa_audit::AuditSettings>>),
AuditExport(Box<SetResponse<crate::object::inbuxa_audit::AuditExport>>),
AuditVerification(Box<SetResponse<crate::object::inbuxa_audit::AuditVerification>>),
Explanation(Box<SetResponse<crate::object::inbuxa_explanation::Explanation>>),
ProtocolPolicy(Box<SetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>>),
TenantProtocolPolicy(
Box<SetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>>,
),
}
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum ChangesResponseMethod {
Email(Box<ChangesResponse<Email>>),
Mailbox(Box<ChangesResponse<Mailbox>>),
Thread(Box<ChangesResponse<Thread>>),
Identity(Box<ChangesResponse<Identity>>),
EmailSubmission(Box<ChangesResponse<EmailSubmission>>),
Quota(Box<ChangesResponse<Quota>>),
AddressBook(Box<ChangesResponse<AddressBook>>),
ContactCard(Box<ChangesResponse<ContactCard>>),
FileNode(Box<ChangesResponse<FileNode>>),
Calendar(Box<ChangesResponse<Calendar>>),
CalendarEvent(Box<ChangesResponse<CalendarEvent>>),
CalendarEventNotification(Box<ChangesResponse<CalendarEventNotification>>),
ShareNotification(Box<ChangesResponse<ShareNotification>>),
// inbuxa: x:MaskedEmail/changes
Registry(Box<ChangesResponse<crate::object::registry::Registry>>),
}
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum CopyResponseMethod {
Email(CopyResponse<Email>),
ContactCard(CopyResponse<ContactCard>),
CalendarEvent(CopyResponse<CalendarEvent>),
FileNode(CopyResponse<FileNode>),
Blob(CopyBlobResponse),
}
#[derive(Debug, serde::Serialize)]
#[serde(untagged)]
pub enum ParseResponseMethod {
Email(ParseResponse<Email>),
ContactCard(ParseResponse<ContactCard>),
CalendarEvent(ParseResponse<CalendarEvent>),
}
#[derive(Debug, serde::Serialize)]
pub struct Response<'x> {
#[serde(rename = "methodResponses")]
pub method_responses: Vec<Call<ResponseMethod<'x>>>,
#[serde(rename = "sessionState")]
#[serde(serialize_with = "serialize_hex")]
pub session_state: u32,
#[serde(rename = "createdIds")]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub created_ids: HashMap<String, AnyId>,
}
impl<'x> Response<'x> {
pub fn new(session_state: u32, created_ids: HashMap<String, AnyId>, capacity: usize) -> Self {
Response {
session_state,
created_ids,
method_responses: Vec::with_capacity(capacity),
}
}
pub fn push_response(
&mut self,
id: String,
name: MethodName,
method: impl Into<ResponseMethod<'x>>,
) {
self.method_responses.push(Call {
id,
method: method.into(),
name,
});
}
pub fn push_error(&mut self, id: String, err: impl Into<MethodErrorWrapper>) {
self.method_responses.push(Call {
id,
method: ResponseMethod::Error(err.into()),
name: MethodName::error(),
});
}
pub fn push_created_id(&mut self, create_id: String, id: impl Into<AnyId>) {
self.created_ids.insert(create_id, id.into());
}
}
impl From<trc::Error> for ResponseMethod<'_> {
fn from(error: trc::Error) -> Self {
ResponseMethod::Error(error.into())
}
}
impl<'x, T: Into<ResponseMethod<'x>>> From<trc::Result<T>> for ResponseMethod<'x> {
fn from(result: trc::Result<T>) -> Self {
match result {
Ok(value) => value.into(),
Err(error) => error.into(),
}
}
}
impl<'x> From<GetResponse<Email>> for ResponseMethod<'x> {
fn from(value: GetResponse<Email>) -> Self {
ResponseMethod::Get(GetResponseMethod::Email(value))
}
}
impl<'x> From<GetResponse<Mailbox>> for ResponseMethod<'x> {
fn from(value: GetResponse<Mailbox>) -> Self {
ResponseMethod::Get(GetResponseMethod::Mailbox(value))
}
}
impl<'x> From<GetResponse<Thread>> for ResponseMethod<'x> {
fn from(value: GetResponse<Thread>) -> Self {
ResponseMethod::Get(GetResponseMethod::Thread(value))
}
}
impl<'x> From<GetResponse<Identity>> for ResponseMethod<'x> {
fn from(value: GetResponse<Identity>) -> Self {
ResponseMethod::Get(GetResponseMethod::Identity(value))
}
}
impl<'x> From<GetResponse<EmailSubmission>> for ResponseMethod<'x> {
fn from(value: GetResponse<EmailSubmission>) -> Self {
ResponseMethod::Get(GetResponseMethod::EmailSubmission(value))
}
}
impl<'x> From<GetResponse<PushSubscription>> for ResponseMethod<'x> {
fn from(value: GetResponse<PushSubscription>) -> Self {
ResponseMethod::Get(GetResponseMethod::PushSubscription(value))
}
}
impl<'x> From<GetResponse<Sieve>> for ResponseMethod<'x> {
fn from(value: GetResponse<Sieve>) -> Self {
ResponseMethod::Get(GetResponseMethod::Sieve(value))
}
}
// inbuxa: Fastmail's MaskedEmail
impl<'x> From<GetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>> for ResponseMethod<'x> {
fn from(value: GetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>) -> Self {
ResponseMethod::Get(GetResponseMethod::MaskedEmail(value))
}
}
impl<'x> From<SetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::fastmail_masked_email::FastmailMaskedEmail>) -> Self {
ResponseMethod::Set(SetResponseMethod::MaskedEmail(Box::new(value)))
}
}
// inbuxa: AI call limits
impl<'x> From<GetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>>
for ResponseMethod<'x>
{
fn from(value: GetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>) -> Self {
ResponseMethod::Get(GetResponseMethod::ProtocolPolicy(value))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>>
for ResponseMethod<'x>
{
fn from(value: SetResponse<crate::object::inbuxa_protocol_policy::ProtocolPolicy>) -> Self {
ResponseMethod::Set(SetResponseMethod::ProtocolPolicy(Box::new(value)))
}
}
impl<'x> From<GetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>>
for ResponseMethod<'x>
{
fn from(
value: GetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>,
) -> Self {
ResponseMethod::Get(GetResponseMethod::TenantProtocolPolicy(value))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>>
for ResponseMethod<'x>
{
fn from(
value: SetResponse<crate::object::inbuxa_tenant_protocol_policy::TenantProtocolPolicy>,
) -> Self {
ResponseMethod::Set(SetResponseMethod::TenantProtocolPolicy(Box::new(value)))
}
}
impl<'x> From<GetResponse<crate::object::inbuxa_ai_limits::AiLimits>> for ResponseMethod<'x> {
fn from(value: GetResponse<crate::object::inbuxa_ai_limits::AiLimits>) -> Self {
ResponseMethod::Get(GetResponseMethod::AiLimits(value))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_ai_limits::AiLimits>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_ai_limits::AiLimits>) -> Self {
ResponseMethod::Set(SetResponseMethod::AiLimits(Box::new(value)))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_explanation::Explanation>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_explanation::Explanation>) -> Self {
ResponseMethod::Set(SetResponseMethod::Explanation(Box::new(value)))
}
}
// inbuxa: deleted accounts (UD-17)
impl<'x> From<GetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>> for ResponseMethod<'x> {
fn from(value: GetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>) -> Self {
ResponseMethod::Get(GetResponseMethod::DeletedAccount(value))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_deleted_account::DeletedAccount>) -> Self {
ResponseMethod::Set(SetResponseMethod::DeletedAccount(Box::new(value)))
}
}
impl<'x> From<GetResponse<VacationResponse>> for ResponseMethod<'x> {
fn from(value: GetResponse<VacationResponse>) -> Self {
ResponseMethod::Get(GetResponseMethod::VacationResponse(value))
}
}
impl<'x> From<GetResponse<Principal>> for ResponseMethod<'x> {
fn from(value: GetResponse<Principal>) -> Self {
ResponseMethod::Get(GetResponseMethod::Principal(value))
}
}
impl<'x> From<GetResponse<Quota>> for ResponseMethod<'x> {
fn from(value: GetResponse<Quota>) -> Self {
ResponseMethod::Get(GetResponseMethod::Quota(value))
}
}
impl<'x> From<GetResponse<Blob>> for ResponseMethod<'x> {
fn from(value: GetResponse<Blob>) -> Self {
ResponseMethod::Get(GetResponseMethod::Blob(value))
}
}
impl<'x> From<GetResponse<ContactCard>> for ResponseMethod<'x> {
fn from(value: GetResponse<ContactCard>) -> Self {
ResponseMethod::Get(GetResponseMethod::ContactCard(value))
}
}
impl<'x> From<GetResponse<AddressBook>> for ResponseMethod<'x> {
fn from(value: GetResponse<AddressBook>) -> Self {
ResponseMethod::Get(GetResponseMethod::AddressBook(value))
}
}
impl<'x> From<GetResponse<Registry>> for ResponseMethod<'x> {
fn from(value: GetResponse<Registry>) -> Self {
ResponseMethod::Get(GetResponseMethod::Registry(value))
}
}
impl<'x> From<SetResponse<Email>> for ResponseMethod<'x> {
fn from(value: SetResponse<Email>) -> Self {
ResponseMethod::Set(SetResponseMethod::Email(Box::new(value)))
}
}
impl<'x> From<SetResponse<Mailbox>> for ResponseMethod<'x> {
fn from(value: SetResponse<Mailbox>) -> Self {
ResponseMethod::Set(SetResponseMethod::Mailbox(Box::new(value)))
}
}
impl<'x> From<SetResponse<Identity>> for ResponseMethod<'x> {
fn from(value: SetResponse<Identity>) -> Self {
ResponseMethod::Set(SetResponseMethod::Identity(Box::new(value)))
}
}
impl<'x> From<SetResponse<EmailSubmission>> for ResponseMethod<'x> {
fn from(value: SetResponse<EmailSubmission>) -> Self {
ResponseMethod::Set(SetResponseMethod::EmailSubmission(Box::new(value)))
}
}
impl<'x> From<SetResponse<PushSubscription>> for ResponseMethod<'x> {
fn from(value: SetResponse<PushSubscription>) -> Self {
ResponseMethod::Set(SetResponseMethod::PushSubscription(Box::new(value)))
}
}
impl<'x> From<SetResponse<Sieve>> for ResponseMethod<'x> {
fn from(value: SetResponse<Sieve>) -> Self {
ResponseMethod::Set(SetResponseMethod::Sieve(Box::new(value)))
}
}
impl<'x> From<SetResponse<VacationResponse>> for ResponseMethod<'x> {
fn from(value: SetResponse<VacationResponse>) -> Self {
ResponseMethod::Set(SetResponseMethod::VacationResponse(Box::new(value)))
}
}
impl<'x> From<SetResponse<AddressBook>> for ResponseMethod<'x> {
fn from(value: SetResponse<AddressBook>) -> Self {
ResponseMethod::Set(SetResponseMethod::AddressBook(Box::new(value)))
}
}
impl<'x> From<SetResponse<ContactCard>> for ResponseMethod<'x> {
fn from(value: SetResponse<ContactCard>) -> Self {
ResponseMethod::Set(SetResponseMethod::ContactCard(Box::new(value)))
}
}
impl<'x> From<SetResponse<Registry>> for ResponseMethod<'x> {
fn from(value: SetResponse<Registry>) -> Self {
ResponseMethod::Set(SetResponseMethod::Registry(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<Email>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<Email>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::Email(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<Mailbox>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<Mailbox>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::Mailbox(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<Thread>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<Thread>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::Thread(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<Identity>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<Identity>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::Identity(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<EmailSubmission>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<EmailSubmission>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::EmailSubmission(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<Quota>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<Quota>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::Quota(Box::new(value)))
}
}
impl<'x> From<ChangesResponse<AddressBook>> for ResponseMethod<'x> {
fn from(value: ChangesResponse<AddressBook>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::AddressBook(Box::new(value)))
}
}
impl<'x> From<CopyResponse<Email>> for ResponseMethod<'x> {
fn from(value: CopyResponse<Email>) -> Self {
ResponseMethod::Copy(CopyResponseMethod::Email(value))
}
}
impl<'x> From<CopyBlobResponse> for ResponseMethod<'x> {
fn from(value: CopyBlobResponse) -> Self {
ResponseMethod::Copy(CopyResponseMethod::Blob(value))
}
}
impl<'x> From<CopyResponse<ContactCard>> for ResponseMethod<'x> {
fn from(value: CopyResponse<ContactCard>) -> Self {
ResponseMethod::Copy(CopyResponseMethod::ContactCard(value))
}
}
impl<'x> From<ImportEmailResponse> for ResponseMethod<'x> {
fn from(value: ImportEmailResponse) -> Self {
ResponseMethod::ImportEmail(value)
}
}
impl<'x> From<ParseResponse<Email>> for ResponseMethod<'x> {
fn from(value: ParseResponse<Email>) -> Self {
ResponseMethod::Parse(ParseResponseMethod::Email(value))
}
}
impl<'x> From<ParseResponse<ContactCard>> for ResponseMethod<'x> {
fn from(value: ParseResponse<ContactCard>) -> Self {
ResponseMethod::Parse(ParseResponseMethod::ContactCard(value))
}
}
impl<'x> From<QueryChangesResponse> for ResponseMethod<'x> {
fn from(value: QueryChangesResponse) -> Self {
ResponseMethod::QueryChanges(value)
}
}
impl<'x> From<QueryResponse> for ResponseMethod<'x> {
fn from(value: QueryResponse) -> Self {
ResponseMethod::Query(value)
}
}
impl<'x> From<GetSearchSnippetResponse> for ResponseMethod<'x> {
fn from(value: GetSearchSnippetResponse) -> Self {
ResponseMethod::SearchSnippet(value)
}
}
impl<'x> From<ValidateSieveScriptResponse> for ResponseMethod<'x> {
fn from(value: ValidateSieveScriptResponse) -> Self {
ResponseMethod::ValidateScript(value)
}
}
impl<'x> From<BlobLookupResponse> for ResponseMethod<'x> {
fn from(value: BlobLookupResponse) -> Self {
ResponseMethod::LookupBlob(value)
}
}
impl<'x> From<BlobUploadResponse> for ResponseMethod<'x> {
fn from(value: BlobUploadResponse) -> Self {
ResponseMethod::UploadBlob(value)
}
}
impl<'x> From<Value<'x, Null, Null>> for ResponseMethod<'x> {
fn from(value: Value<'x, Null, Null>) -> Self {
ResponseMethod::Echo(value)
}
}
impl<'x> From<MethodErrorWrapper> for ResponseMethod<'x> {
fn from(value: MethodErrorWrapper) -> Self {
ResponseMethod::Error(value)
}
}
impl From<GetResponse<FileNode>> for ResponseMethod<'_> {
fn from(response: GetResponse<FileNode>) -> Self {
ResponseMethod::Get(GetResponseMethod::FileNode(response))
}
}
impl From<SetResponse<FileNode>> for ResponseMethod<'_> {
fn from(response: SetResponse<FileNode>) -> Self {
ResponseMethod::Set(SetResponseMethod::FileNode(Box::new(response)))
}
}
impl From<ChangesResponse<FileNode>> for ResponseMethod<'_> {
fn from(response: ChangesResponse<FileNode>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::FileNode(Box::new(response)))
}
}
impl From<GetAvailabilityResponse> for ResponseMethod<'_> {
fn from(response: GetAvailabilityResponse) -> Self {
ResponseMethod::Get(GetResponseMethod::PrincipalAvailability(response))
}
}
impl From<GetResponse<Calendar>> for ResponseMethod<'_> {
fn from(response: GetResponse<Calendar>) -> Self {
ResponseMethod::Get(GetResponseMethod::Calendar(response))
}
}
impl From<SetResponse<Calendar>> for ResponseMethod<'_> {
fn from(response: SetResponse<Calendar>) -> Self {
ResponseMethod::Set(SetResponseMethod::Calendar(Box::new(response)))
}
}
impl From<ChangesResponse<CalendarEvent>> for ResponseMethod<'_> {
fn from(response: ChangesResponse<CalendarEvent>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::CalendarEvent(Box::new(response)))
}
}
impl From<ChangesResponse<CalendarEventNotification>> for ResponseMethod<'_> {
fn from(response: ChangesResponse<CalendarEventNotification>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::CalendarEventNotification(Box::new(
response,
)))
}
}
impl From<SetResponse<CalendarEvent>> for ResponseMethod<'_> {
fn from(response: SetResponse<CalendarEvent>) -> Self {
ResponseMethod::Set(SetResponseMethod::CalendarEvent(Box::new(response)))
}
}
impl From<SetResponse<ParticipantIdentity>> for ResponseMethod<'_> {
fn from(response: SetResponse<ParticipantIdentity>) -> Self {
ResponseMethod::Set(SetResponseMethod::ParticipantIdentity(Box::new(response)))
}
}
impl From<GetResponse<ParticipantIdentity>> for ResponseMethod<'_> {
fn from(response: GetResponse<ParticipantIdentity>) -> Self {
ResponseMethod::Get(GetResponseMethod::ParticipantIdentity(response))
}
}
impl From<ChangesResponse<ShareNotification>> for ResponseMethod<'_> {
fn from(response: ChangesResponse<ShareNotification>) -> Self {
ResponseMethod::Changes(ChangesResponseMethod::ShareNotification(Box::new(response)))
}
}
impl From<SetResponse<ShareNotification>> for ResponseMethod<'_> {
fn from(response: SetResponse<ShareNotification>) -> Self {
ResponseMethod::Set(SetResponseMethod::ShareNotification(Box::new(response)))
}
}
impl From<GetResponse<ShareNotification>> for ResponseMethod<'_> {
fn from(response: GetResponse<ShareNotification>) -> Self {
ResponseMethod::Get(GetResponseMethod::ShareNotification(response))
}
}
impl From<GetResponse<CalendarEvent>> for ResponseMethod<'_> {
fn from(response: GetResponse<CalendarEvent>) -> Self {
ResponseMethod::Get(GetResponseMethod::CalendarEvent(response))
}
}
impl From<ParseResponse<CalendarEvent>> for ResponseMethod<'_> {
fn from(value: ParseResponse<CalendarEvent>) -> Self {
ResponseMethod::Parse(ParseResponseMethod::CalendarEvent(value))
}
}
impl From<CopyResponse<CalendarEvent>> for ResponseMethod<'_> {
fn from(value: CopyResponse<CalendarEvent>) -> Self {
ResponseMethod::Copy(CopyResponseMethod::CalendarEvent(value))
}
}
impl From<CopyResponse<FileNode>> for ResponseMethod<'_> {
fn from(value: CopyResponse<FileNode>) -> Self {
ResponseMethod::Copy(CopyResponseMethod::FileNode(value))
}
}
impl From<CalendarEventNotificationGetResponse> for ResponseMethod<'_> {
fn from(value: CalendarEventNotificationGetResponse) -> Self {
ResponseMethod::Get(GetResponseMethod::CalendarEventNotification(value))
}
}
impl From<SetResponse<CalendarEventNotification>> for ResponseMethod<'_> {
fn from(value: SetResponse<CalendarEventNotification>) -> Self {
ResponseMethod::Set(SetResponseMethod::CalendarEventNotification(Box::new(
value,
)))
}
}
// inbuxa: the audit log
impl<'x> From<GetResponse<crate::object::inbuxa_audit::AuditEvent>> for ResponseMethod<'x> {
fn from(value: GetResponse<crate::object::inbuxa_audit::AuditEvent>) -> Self {
ResponseMethod::Get(GetResponseMethod::AuditEvent(value))
}
}
impl<'x> From<GetResponse<crate::object::inbuxa_audit::AuditSettings>> for ResponseMethod<'x> {
fn from(value: GetResponse<crate::object::inbuxa_audit::AuditSettings>) -> Self {
ResponseMethod::Get(GetResponseMethod::AuditSettings(value))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_audit::AuditSettings>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_audit::AuditSettings>) -> Self {
ResponseMethod::Set(SetResponseMethod::AuditSettings(Box::new(value)))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_audit::AuditExport>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_audit::AuditExport>) -> Self {
ResponseMethod::Set(SetResponseMethod::AuditExport(Box::new(value)))
}
}
impl<'x> From<SetResponse<crate::object::inbuxa_audit::AuditVerification>> for ResponseMethod<'x> {
fn from(value: SetResponse<crate::object::inbuxa_audit::AuditVerification>) -> Self {
ResponseMethod::Set(SetResponseMethod::AuditVerification(Box::new(value)))
}
}