pub struct ReplicationResponse {
pub records: Vec<Value>,
pub next_link: Option<String>,
pub record_count: usize,
}Expand description
Response from a replication endpoint query
The replication endpoint returns records along with a next link in the
response headers for pagination through large datasets.
§Example
let query = ReplicationQueryBuilder::new("Property")
.top(2000)
.build()?;
let response = client.execute_replication(&query).await?;
println!("Retrieved {} records", response.record_count);
// Continue with next link if available
if let Some(next_link) = response.next_link {
let next_response = client.execute_next_link(&next_link).await?;
println!("Retrieved {} more records", next_response.record_count);
}Fields§
§records: Vec<Value>The array of records returned by the query
next_link: Option<String>The next link URL from response headers for pagination
This is extracted from the next header in the HTTP response.
Use this with execute_next_link() to fetch the next batch of records.
record_count: usizeNumber of records in this response
Implementations§
Source§impl ReplicationResponse
impl ReplicationResponse
Sourcepub fn new(records: Vec<JsonValue>, next_link: Option<String>) -> Self
pub fn new(records: Vec<JsonValue>, next_link: Option<String>) -> Self
Create a new replication response
This is typically called internally by the client. You usually don’t need to construct this yourself.
§Examples
let records = vec![json!({"ListingKey": "12345"})];
let response = ReplicationResponse::new(records, None);
assert_eq!(response.record_count, 1);
assert!(!response.has_more());Sourcepub fn has_more(&self) -> bool
pub fn has_more(&self) -> bool
Check if there are more records available
Returns true if there’s a next link available for pagination.
§Examples
let query = ReplicationQueryBuilder::new("Property")
.top(2000)
.build()?;
let response = client.execute_replication(&query).await?;
if response.has_more() {
println!("More records available!");
let next_response = client.execute_next_link(
response.next_link().unwrap()
).await?;
}Sourcepub fn next_link(&self) -> Option<&str>
pub fn next_link(&self) -> Option<&str>
Get the next link URL if available
Returns Some(&str) with the URL for the next page, or None if
there are no more records.
§Examples
let query = ReplicationQueryBuilder::new("Property").build()?;
let mut response = client.execute_replication(&query).await?;
let mut all_records = response.records.clone();
// Fetch all pages
while let Some(next_url) = response.next_link() {
response = client.execute_next_link(next_url).await?;
all_records.extend(response.records.clone());
}
println!("Total records: {}", all_records.len());Trait Implementations§
Source§impl Clone for ReplicationResponse
impl Clone for ReplicationResponse
Source§fn clone(&self) -> ReplicationResponse
fn clone(&self) -> ReplicationResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more