Skip to main content

MessageRepository

Struct MessageRepository 

Source
pub struct MessageRepository { /* private fields */ }
Expand description

The iMessage database repository.

Implementations§

Source§

impl MessageRepository

Source

pub fn open(db_path: PathBuf) -> Result<Self>

Open the iMessage database in read-only mode and detect its schema.

Source

pub fn schema(&self) -> &DetectedSchema

Get the detected schema.

Source

pub fn get_message_count(&self, params: &MessageCountParams) -> Result<i64>

Count all messages, with optional filters.

Source

pub fn get_chat_count(&self) -> Result<i64>

Count all chats.

Source

pub fn get_handle_count(&self, address: Option<&str>) -> Result<i64>

Count all handles, optionally filtered by address.

Source

pub fn get_attachment_count(&self) -> Result<i64>

Count all attachments.

Source

pub fn get_message( &self, guid: &str, with_chats: bool, with_attachments: bool, ) -> Result<Option<Message>>

Get a single message by GUID, optionally with chats and attachments.

Source

pub fn get_attachment( &self, attachment_guid: &str, ) -> Result<Option<Attachment>>

Get a single attachment by GUID (handles prefix stripping).

Source

pub fn get_imessage_account(&self) -> Result<Option<String>>

Get the iMessage account login string.

Source

pub fn get_chat_last_message(&self, chat_guid: &str) -> Result<Option<Message>>

Get the last message in a chat by GUID.

Source

pub fn get_messages( &self, params: &MessageQueryParams, ) -> Result<(Vec<Message>, i64)>

Get messages with pagination and filters. Returns (messages, total_count).

Source

pub fn get_updated_messages( &self, params: &UpdatedMessageQueryParams, ) -> Result<Vec<Message>>

Get updated messages (delivered, read, edited, retracted since a date).

Source

pub fn get_chats(&self, params: &ChatQueryParams) -> Result<(Vec<Chat>, i64)>

Get chats with pagination and filters. Returns (chats, total_count).

Source

pub fn get_handles( &self, params: &HandleQueryParams, ) -> Result<(Vec<Handle>, i64)>

Get handles with pagination. Returns (handles, total_count).

Source

pub fn get_attachments_for_message( &self, message_rowid: i64, ) -> Result<Vec<Attachment>>

Get all attachments for a message by message ROWID.

Source

pub fn get_chats_read_since(&self, after_apple_ts: i64) -> Result<Vec<Chat>>

Get chats whose last_read_message_timestamp >= the given Apple timestamp. Used by the chat update poller to detect read status changes.

Source

pub fn get_media_counts( &self, media_type: &str, after: Option<i64>, ) -> Result<i64>

Get media counts (total across all chats).

Source

pub fn get_media_counts_by_chat( &self, chat_guid: &str, media_type: &str, ) -> Result<i64>

Get media counts scoped to a specific chat.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more