mirror of
https://github.com/rustmailer/rustmailer.git
synced 2026-08-19 16:01:08 +00:00
refactor(list-messages): switch from page-based to cursor-based pagination
- Changed `list-messages` API from page/page_size to cursor/next_page_token - Aligns pagination approach with Gmail API for easier integration - Frontend updates to handle cursor-based navigation
This commit is contained in:
+2
-2
@@ -202,9 +202,9 @@ impl GmailClient {
|
||||
account_id: u64,
|
||||
use_proxy: Option<u64>,
|
||||
label_id: &str,
|
||||
page_token: Option<String>,
|
||||
page_token: Option<&str>,
|
||||
after: Option<&str>,
|
||||
max_results: u32,
|
||||
max_results: u64,
|
||||
) -> RustMailerResult<MessageList> {
|
||||
let mut url = format!(
|
||||
"https://gmail.googleapis.com/gmail/v1/users/me/messages?labelIds={}&maxResults={}",
|
||||
|
||||
+4
-4
@@ -43,9 +43,9 @@ pub async fn fetch_and_save_since_date(
|
||||
account_id,
|
||||
use_proxy,
|
||||
&label.label_id,
|
||||
page_token,
|
||||
page_token.as_deref(),
|
||||
Some(date),
|
||||
ENVELOPE_BATCH_SIZE,
|
||||
ENVELOPE_BATCH_SIZE as u64,
|
||||
)
|
||||
.await?;
|
||||
// The total number of messages can only be retrieved via an API query
|
||||
@@ -156,9 +156,9 @@ pub async fn fetch_and_save_full_label(
|
||||
account_id,
|
||||
use_proxy,
|
||||
&label.label_id,
|
||||
page_token,
|
||||
page_token.as_deref(),
|
||||
None,
|
||||
ENVELOPE_BATCH_SIZE,
|
||||
ENVELOPE_BATCH_SIZE as u64,
|
||||
)
|
||||
.await?;
|
||||
// Update page_token returned by Gmail API
|
||||
|
||||
Reference in New Issue
Block a user