mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-29 18:54:21 +01:00
listinvoices: add index and start params.
Now we have defined ordering, we can add a start param. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `listinvoices` has `index` and `start` parameters for listing control.
This commit is contained in:
32
cln-rpc/src/model.rs
generated
32
cln-rpc/src/model.rs
generated
@@ -583,6 +583,34 @@ pub mod requests {
|
||||
type Response = super::responses::ListdatastoreResponse;
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum ListinvoicesIndex {
|
||||
#[serde(rename = "created")]
|
||||
CREATED,
|
||||
#[serde(rename = "updated")]
|
||||
UPDATED,
|
||||
}
|
||||
|
||||
impl TryFrom<i32> for ListinvoicesIndex {
|
||||
type Error = anyhow::Error;
|
||||
fn try_from(c: i32) -> Result<ListinvoicesIndex, anyhow::Error> {
|
||||
match c {
|
||||
0 => Ok(ListinvoicesIndex::CREATED),
|
||||
1 => Ok(ListinvoicesIndex::UPDATED),
|
||||
o => Err(anyhow::anyhow!("Unknown variant {} for enum ListinvoicesIndex", o)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for ListinvoicesIndex {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
ListinvoicesIndex::CREATED => "CREATED",
|
||||
ListinvoicesIndex::UPDATED => "UPDATED",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ListinvoicesRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -593,6 +621,10 @@ pub mod requests {
|
||||
pub payment_hash: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub offer_id: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub index: Option<ListinvoicesIndex>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub start: Option<u64>,
|
||||
}
|
||||
|
||||
impl From<ListinvoicesRequest> for Request {
|
||||
|
||||
Reference in New Issue
Block a user