@@ -3,87 +3,159 @@ use serde::{Deserialize, Serialize};
3
3
4
4
use crate :: models:: Response ;
5
5
6
- /// Struct defining the self link in the list all accounts response.
6
+ /// Represents the self-link in the list of all accounts response.
7
+ ///
8
+ /// This struct defines the structure of the self-link (`href`) found in the accounts response
9
+ /// from the Horizon API. It contains the URL to the current resource or query.
10
+ ///
7
11
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
8
12
pub struct AccountsResponseSelfLink {
13
+ /// A `String` representing the hyperlink reference to the current resource or query.
9
14
href : String ,
10
15
}
11
16
12
- /// Struct defining the links in the list all accounts response.
17
+ /// Represents the various links in the list of all accounts response.
18
+ ///
19
+ /// This struct encapsulates the different types of navigational links (self, next, previous)
20
+ /// in the accounts response. Each link is an instance of [`AccountsResponseSelfLink`].
21
+ ///
13
22
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
14
23
pub struct AccountsResponseLinks {
15
24
#[ serde( rename = "self" ) ]
25
+ /// The link to the current page of account records.
16
26
self_link : AccountsResponseSelfLink ,
27
+ /// An optional link to the next page of account records.
17
28
next : Option < AccountsResponseSelfLink > ,
29
+ /// An optional link to the previous page of account records.
18
30
prev : Option < AccountsResponseSelfLink > ,
19
31
}
20
32
21
- /// Struct defining a single balance in the list all accounts response.
33
+ /// Represents a single balance within an account in the list of all accounts response.
34
+ ///
35
+ /// This struct details the balance information for an account, including the type of asset
36
+ /// and the associated liabilities.
37
+ ///
22
38
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
23
39
pub struct Balances {
40
+ /// The total balance of the asset.
24
41
balance : String ,
42
+ /// Buying liabilities associated with the asset.
25
43
buying_liabilities : String ,
44
+ /// Selling liabilities associated with the asset.
26
45
selling_liabilities : String ,
46
+ /// The type of asset (e.g., native, credit_alphanum4, credit_alphanum12).
27
47
asset_type : String ,
28
48
}
29
49
30
- /// Struct defining the thresholds in the list all accounts response.
50
+ /// Represents the thresholds associated with an account in the list of all accounts response.
51
+ ///
52
+ /// This struct encapsulates the various threshold values for different operations in an account.
53
+ ///
31
54
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
32
55
pub struct AccountsResponseThresholds {
56
+ /// The threshold for low-level operations.
33
57
low_threshold : i32 ,
58
+ /// The threshold for medium-level operations.
34
59
med_threshold : i32 ,
60
+ /// The threshold for high-level operations.
35
61
high_threshold : i32 ,
36
62
}
37
63
38
- /// Struct defining the flags in the list all accounts response.
64
+ /// Represents the flags set on an account in the list of all accounts response.
65
+ ///
66
+ /// This struct defines the various boolean flags that can be set on an account,
67
+ /// indicating specific permissions or settings.
68
+ ///
39
69
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
40
70
pub struct AccountsResponseFlags {
71
+ /// Indicates if authorization is required for transactions.
41
72
auth_required : bool ,
73
+ /// Indicates if authorization can be revoked.
42
74
auth_revocable : bool ,
75
+ /// Indicates if the account's authorization settings cannot be changed.
43
76
auth_immutable : bool ,
77
+ /// Indicates if the clawback feature is enabled.
44
78
auth_clawback_enabled : bool ,
45
79
}
46
80
47
- /// Struct defining a single signer in the list all accounts response.
81
+ /// Represents a signer associated with an account in the list of all accounts response.
82
+ ///
83
+ /// This struct details the information about a signer for an account, including their
84
+ /// key, type, and weight in authorization decisions.
85
+ ///
48
86
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
49
87
pub struct Signers {
88
+ /// The weight of the signer's vote in authorization decisions.
50
89
weight : i32 ,
90
+ /// The key associated with the signer.
51
91
key : String ,
92
+ /// The type of the signer (e.g., 'ed25519_public_key').
52
93
#[ serde( rename = "type" ) ]
53
94
signer_type : String ,
54
95
}
55
96
56
- /// Struct defining a record of a single account in the list all accounts response.
97
+ /// Represents a single account record in the list of all accounts response.
98
+ ///
99
+ /// This struct encapsulates detailed information about an individual account as returned
100
+ /// in the Horizon API response. It includes various fields like account identifiers,
101
+ /// thresholds, flags, balances, and more.
102
+ ///
57
103
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
58
104
pub struct Record {
105
+ /// Links associated with this account record.
59
106
#[ serde( rename = "_links" ) ]
60
107
links : AccountsResponseLinks ,
108
+ /// The unique identifier of the account.
61
109
id : String ,
110
+ /// The public key of the account.
62
111
account_id : String ,
112
+ /// The sequence number of the account.
63
113
sequence : String ,
114
+ /// The number of subentries in the account.
64
115
subentry_count : i32 ,
65
116
last_modified_ledger : u64 ,
66
117
last_modified_time : String ,
118
+ /// The thresholds for different operations in the account.
67
119
thresholds : AccountsResponseThresholds ,
120
+ /// The flags set on the account.
68
121
flags : AccountsResponseFlags ,
122
+ /// A list of balances for different assets held by the account.
69
123
balances : Vec < Balances > ,
124
+ /// A list of signers associated with the account.
70
125
signers : Vec < Signers > ,
126
+ /// Additional data associated with the account (in JSON format).
71
127
data : serde_json:: Value ,
128
+ /// The number of entries the account is sponsoring.
72
129
num_sponsoring : i32 ,
130
+ /// The number of entries the account is sponsored for.
73
131
num_sponsored : i32 ,
132
+ /// A token used for paging through results.
74
133
paging_token : String ,
75
134
}
76
135
77
- /// Struct defining the embedded object in the list all accounts response.
136
+ /// Represents the embedded part of the list all accounts response.
137
+ ///
138
+ /// This struct is used to hold the actual array of account records ([`Record`]) as part of
139
+ /// the Horizon API response. It serves as a container for the data portion of the response.
140
+ ///
78
141
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
79
142
pub struct Embedded {
143
+ /// * `records`: A vector of [`Record`] structs, each representing an individual account.
80
144
records : Vec < Record > ,
81
145
}
82
146
83
- /// Struct defining the list all accounts response.
147
+
148
+ /// Represents the entire response for the list all accounts query.
149
+ ///
150
+ /// This struct defines the overall structure of the response returned from the Horizon API
151
+ /// when querying for multiple accounts. It includes navigational links and the embedded data
152
+ /// containing account records.
153
+ ///
84
154
#[ derive( Debug , Deserialize , Serialize , Clone , Getters ) ]
85
155
pub struct AccountsResponse {
156
+ /// Navigational links related to the response.
86
157
_links : AccountsResponseLinks ,
158
+ /// The embedded object containing the actual account records.
87
159
_embedded : Embedded ,
88
160
}
89
161
0 commit comments