rustybook-messenger 0.2.0

Messenger client for Rustybook
Documentation
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Sp {
    InsertMessage,
    UpdateTypingIndicator,
    TaskExists,
    UpsertSyncGroupThreadsRange,
    UpsertInboxThreadsRange,
    UpdateThreadsRangesV2,
    RemoveTask,
    ExecuteFirstBlockForSyncTransaction,
    UpsertSequenceId,
    VerifyContactRowExists,
    ExecuteFinallyBlockForSyncTransaction,
    Unknown(String),
}

impl Sp {
    pub fn parse(value: &str) -> Self {
        match value {
            "insertMessage" => Self::InsertMessage,
            "updateTypingIndicator" => Self::UpdateTypingIndicator,
            "taskExists" => Self::TaskExists,
            "upsertSyncGroupThreadsRange" => Self::UpsertSyncGroupThreadsRange,
            "upsertInboxThreadsRange" => Self::UpsertInboxThreadsRange,
            "updateThreadsRangesV2" => Self::UpdateThreadsRangesV2,
            "removeTask" => Self::RemoveTask,
            "executeFirstBlockForSyncTransaction" => Self::ExecuteFirstBlockForSyncTransaction,
            "upsertSequenceId" => Self::UpsertSequenceId,
            "verifyContactRowExists" => Self::VerifyContactRowExists,
            "executeFinallyBlockForSyncTransaction" => Self::ExecuteFinallyBlockForSyncTransaction,
            unknown => Self::Unknown(unknown.to_string()),
        }
    }

    pub fn as_str(&self) -> &str {
        match self {
            Self::InsertMessage => "insertMessage",
            Self::UpdateTypingIndicator => "updateTypingIndicator",
            Self::TaskExists => "taskExists",
            Self::UpsertSyncGroupThreadsRange => "upsertSyncGroupThreadsRange",
            Self::UpsertInboxThreadsRange => "upsertInboxThreadsRange",
            Self::UpdateThreadsRangesV2 => "updateThreadsRangesV2",
            Self::RemoveTask => "removeTask",
            Self::ExecuteFirstBlockForSyncTransaction => "executeFirstBlockForSyncTransaction",
            Self::UpsertSequenceId => "upsertSequenceId",
            Self::VerifyContactRowExists => "verifyContactRowExists",
            Self::ExecuteFinallyBlockForSyncTransaction => "executeFinallyBlockForSyncTransaction",
            Self::Unknown(value) => value,
        }
    }

    pub fn name(&self) -> &'static str {
        match self {
            Self::InsertMessage => "insert_message",
            Self::UpdateTypingIndicator => "update_typing_indicator",
            Self::TaskExists => "task_exists",
            Self::UpsertSyncGroupThreadsRange => "upsert_sync_group_threads_range",
            Self::UpsertInboxThreadsRange => "upsert_inbox_threads_range",
            Self::UpdateThreadsRangesV2 => "update_threads_ranges_v2",
            Self::RemoveTask => "remove_task",
            Self::ExecuteFirstBlockForSyncTransaction => "execute_first_block_for_sync_transaction",
            Self::UpsertSequenceId => "upsert_sequence_id",
            Self::VerifyContactRowExists => "verify_contact_row_exists",
            Self::ExecuteFinallyBlockForSyncTransaction => {
                "execute_finally_block_for_sync_transaction"
            }
            Self::Unknown(_) => "unknown",
        }
    }
}