xrpl_api/api/
nft_sell_offers.rs

1//! The nft_sell_offers method returns a list of sell offers for a given NFToken
2//! object.
3//!
4//! <https://xrpl.org/nft_sell_offers.html>
5
6use crate::{types::NFTokenOffer, Request};
7use serde::{Deserialize, Serialize};
8
9#[derive(Default, Debug, Clone, Serialize)]
10pub struct NftSellOffersRequest {
11    /// The unique identifier of a NFToken object.
12    nft_id: String,
13    /// A 20-byte hex string for the ledger version to use.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub ledger_hash: Option<String>,
16    /// The ledger index of the ledger to use, or a shortcut string to choose a
17    /// ledger automatically.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub ledger_index: Option<String>,
20    /// Limit the number of NFT buy offers to retrieve. This value cannot be
21    /// lower than 50 or more than 500. The default is 250.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    limit: Option<u32>,
24    /// Value from a previous paginated response. Resume retrieving data where
25    /// that response left off.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    marker: Option<String>,
28}
29
30impl Request for NftSellOffersRequest {
31    type Response = NftSellOffersResponse;
32
33    fn method(&self) -> String {
34        "nft_sell_offers".to_owned()
35    }
36}
37
38impl NftSellOffersRequest {
39    pub fn new(nft_id: &str) -> Self {
40        Self {
41            nft_id: nft_id.to_owned(),
42            ..Default::default()
43        }
44    }
45}
46
47#[derive(Debug, Deserialize)]
48pub struct NftSellOffersResponse {
49    /// The NFToken these offers are for, as specified in the request.
50    pub nft_id: String,
51    /// A list of buy offers for the token. Each of these is formatted as a Buy
52    /// Offer (see below).
53    pub offers: Vec<NFTokenOffer>,
54    /// The limit, as specified in the request.
55    pub limit: Option<u32>,
56    /// Server-defined value indicating the response is paginated. Pass this to
57    /// the next call to resume where this call left off. Omitted when there are
58    /// no pages of information after this one.
59    pub marker: Option<String>,
60}