deriv_api_schema/
p2p_advert_create_request.rs

1
2// Generated automatically by schema_generator.rs - DO NOT EDIT.
3// Source: ./deriv-api-docs/config/v3/p2p_advert_create/send.json
4
5// Use direct crate names for imports
6use serde::{Deserialize, Serialize};
7use serde_json::Value;
8
9
10
11// Import required types from the *same* crate
12use crate::rate_type::RateType;
13use crate::type_::Type;
14use crate::block_trade::BlockTrade;
15
16/// Creates a P2P (Peer to Peer) advert. Can only be used by an approved P2P advertiser.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(rename_all = "snake_case")]
19pub struct P2pAdvertCreateRequest {
20    /// The total amount of the advert, in advertiser's account currency.\n
21    // Correct serde attribute construction - Use helper
22    
23    pub amount: String,
24    /// [Optional] Indicates if this is block trade ad or not. Default: 0.\n
25    // Correct serde attribute construction - Use helper
26    #[serde(skip_serializing_if = "Option::is_none")] 
27    pub block_trade: Option<BlockTrade>,
28    /// [Optional] Advertiser contact information.\n
29    // Correct serde attribute construction - Use helper
30    #[serde(skip_serializing_if = "Option::is_none")] 
31    pub contact_info: Option<String>,
32    /// [Optional] General information about the advert.\n
33    // Correct serde attribute construction - Use helper
34    #[serde(skip_serializing_if = "Option::is_none")] 
35    pub description: Option<String>,
36    /// [Optional] 2 letter country codes. Counterparties who do not live in these countries will not be allowed to place orders against the advert.\n
37    // Correct serde attribute construction - Use helper
38    #[serde(skip_serializing_if = "Option::is_none")] 
39    pub eligible_countries: Option<Vec<String>>,
40    /// [Optional] Local currency for this advert. If not provided, will use the currency of client's residence by default.\n
41    // Correct serde attribute construction - Use helper
42    #[serde(skip_serializing_if = "Option::is_none")] 
43    pub local_currency: Option<String>,
44    /// [Optional] The login id of the user. Mandatory when multiple tokens were provided during authorize.\n
45    // Correct serde attribute construction - Use helper
46    #[serde(skip_serializing_if = "Option::is_none")] 
47    pub loginid: Option<String>,
48    /// Maximum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be more than or equal to `min_order_amount`\n
49    // Correct serde attribute construction - Use helper
50    
51    pub max_order_amount: String,
52    /// [Optional] Counterparties who have a 30 day completion rate less than this value will not be allowed to place orders against the advert.\n
53    // Correct serde attribute construction - Use helper
54    #[serde(skip_serializing_if = "Option::is_none")] 
55    pub min_completion_rate: Option<String>,
56    /// [Optional] Counterparties who joined less than this number of days ago will not be allowed to place orders against the advert.\n
57    // Correct serde attribute construction - Use helper
58    #[serde(skip_serializing_if = "Option::is_none")] 
59    pub min_join_days: Option<i64>,
60    /// Minimum allowed amount for the orders of this advert, in advertiser's `account_currency`. Should be less than or equal to `max_order_amount`.\n
61    // Correct serde attribute construction - Use helper
62    
63    pub min_order_amount: String,
64    /// [Optional] Counterparties who have an average rating less than this value will not be allowed to place orders against the advert.\n
65    // Correct serde attribute construction - Use helper
66    #[serde(skip_serializing_if = "Option::is_none")] 
67    pub min_rating: Option<String>,
68    /// [Optional] Expiry period (seconds) for order created against this ad.\n
69    // Correct serde attribute construction - Use helper
70    #[serde(skip_serializing_if = "Option::is_none")] 
71    pub order_expiry_period: Option<i64>,
72    /// Field 'p2p_advert_create' mapped to Value due to complexity/potential issues.\n
73    // Correct serde attribute construction - Use helper
74    
75    pub p2p_advert_create: Value,
76    /// [Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field.\n
77    // Correct serde attribute construction - Use helper
78    #[serde(skip_serializing_if = "Option::is_none")] 
79    pub passthrough: Option<Value>,
80    /// [Optional] Payment instructions.\n
81    // Correct serde attribute construction - Use helper
82    #[serde(skip_serializing_if = "Option::is_none")] 
83    pub payment_info: Option<String>,
84    /// [Optional] Payment method name (deprecated).\n
85    // Correct serde attribute construction - Use helper
86    #[serde(skip_serializing_if = "Option::is_none")] 
87    pub payment_method: Option<String>,
88    /// IDs of previously saved payment methods as returned from p2p_advertiser_payment_methods, only applicable for sell ads.\n
89    // Correct serde attribute construction - Use helper
90    #[serde(skip_serializing_if = "Option::is_none")] 
91    pub payment_method_ids: Option<Vec<i64>>,
92    /// Payment method identifiers as returned from p2p_payment_methods, only applicable for buy ads.\n
93    // Correct serde attribute construction - Use helper
94    #[serde(skip_serializing_if = "Option::is_none")] 
95    pub payment_method_names: Option<Vec<String>>,
96    /// Conversion rate from advertiser's account currency to `local_currency`. An absolute rate value (fixed), or percentage offset from current market rate (floating).\n
97    // Correct serde attribute construction - Use helper
98    
99    pub rate: String,
100    /// Type of rate, fixed or floating.\n
101    // Correct serde attribute construction - Use helper
102    #[serde(skip_serializing_if = "Option::is_none")] 
103    pub rate_type: Option<RateType>,
104    /// [Optional] Used to map request to response.\n
105    // Correct serde attribute construction - Use helper
106    #[serde(skip_serializing_if = "Option::is_none")] 
107    pub req_id: Option<i64>,
108    /// The advertisement represents the intention to perform this action on your Deriv account funds.\n
109    // Correct serde attribute construction - Use helper
110    #[serde(rename = "type")] 
111    pub type_: Type,
112}
113