-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operations #46
Operations #46
Conversation
4f2c5e6
to
b931d9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je bent er bijna denk ik.
let mut query = String::new(); | ||
if let Some(account_id) = &self.account_id { | ||
query.push_str(&format!("accounts/{}&", account_id)); | ||
} | ||
if let Some(cursor) = self.cursor { | ||
query.push_str(&format!("cursor={}&", cursor)); | ||
} | ||
if let Some(limit) = self.limit { | ||
query.push_str(&format!("limit={}&", limit)); | ||
} | ||
if let Some(order) = &self.order { | ||
query.push_str(&format!("order={:?}&", order)); | ||
} | ||
if let Some(include_failed) = &self.include_failed { | ||
query.push_str(&format!("include_failed={:?}&", include_failed)); | ||
} | ||
|
||
query.trim_end_matches('&').to_string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut query = String::new(); | |
if let Some(account_id) = &self.account_id { | |
query.push_str(&format!("accounts/{}&", account_id)); | |
} | |
if let Some(cursor) = self.cursor { | |
query.push_str(&format!("cursor={}&", cursor)); | |
} | |
if let Some(limit) = self.limit { | |
query.push_str(&format!("limit={}&", limit)); | |
} | |
if let Some(order) = &self.order { | |
query.push_str(&format!("order={:?}&", order)); | |
} | |
if let Some(include_failed) = &self.include_failed { | |
query.push_str(&format!("include_failed={:?}&", include_failed)); | |
} | |
query.trim_end_matches('&').to_string() | |
vec![ | |
self.cursor.as_ref().map(|c| format!("cursor={}", c)), | |
self.limit.as_ref().map(|l| format!("limit={}", l)), | |
self.order.as_ref().map(|o| format!("order={}", o)), | |
self.include_failed.as_ref().map(|i| format!("include_failed={}", i)), | |
] | |
.build_query_parameters() |
let mut query = String::new(); | ||
if let Some(ledger_sequence) = &self.ledger_sequence { | ||
query.push_str(&format!("&ledger_sequence={}", ledger_sequence)); | ||
} | ||
if let Some(cursor) = &self.cursor { | ||
query.push_str(&format!("&cursor={}", cursor)); | ||
} | ||
if let Some(limit) = &self.limit { | ||
query.push_str(&format!("&limit={}", limit)); | ||
} | ||
if let Some(order) = &self.order { | ||
query.push_str(&format!("&order={}", order)); | ||
} | ||
if let Some(include_failed) = &self.include_failed { | ||
query.push_str(&format!("&include_failed={}", include_failed)); | ||
} | ||
query |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let mut query = String::new(); | |
if let Some(ledger_sequence) = &self.ledger_sequence { | |
query.push_str(&format!("&ledger_sequence={}", ledger_sequence)); | |
} | |
if let Some(cursor) = &self.cursor { | |
query.push_str(&format!("&cursor={}", cursor)); | |
} | |
if let Some(limit) = &self.limit { | |
query.push_str(&format!("&limit={}", limit)); | |
} | |
if let Some(order) = &self.order { | |
query.push_str(&format!("&order={}", order)); | |
} | |
if let Some(include_failed) = &self.include_failed { | |
query.push_str(&format!("&include_failed={}", include_failed)); | |
} | |
query | |
vec![ | |
self.cursor.as_ref().map(|c| format!("cursor={}", c)), | |
self.limit.as_ref().map(|l| format!("limit={}", l)), | |
self.order.as_ref().map(|o| format!("order={}", o)), | |
self.include_failed.as_ref().map(|i| format!("include_failed={}", i)), | |
] | |
.build_query_parameters() |
impl SingleOperationRequest<NoOperationId> { | ||
pub fn new() -> Self { | ||
SingleOperationRequest::default() | ||
} | ||
|
||
pub fn set_operation_id(self, operation_id: String) -> SingleOperationRequest<OperationId> { | ||
SingleOperationRequest { | ||
operation_id: OperationId(operation_id), | ||
} | ||
} | ||
} | ||
|
||
impl Request for SingleOperationRequest<OperationId> { | ||
fn get_query_parameters(&self) -> String { | ||
let mut query = String::new(); | ||
query.push_str(&format!("{}", self.operation_id.0)); | ||
|
||
query.trim_end_matches('&').to_string() | ||
} | ||
|
||
fn build_url(&self, base_url: &str) -> String { | ||
format!( | ||
"{}/{}/{}", | ||
base_url, | ||
super::OPERATIONS_PATH, | ||
self.get_query_parameters() | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hier mag van mij nog wel iets documentatie bij.
response struct operations per account request added documentation fee stats refactor Updated percentage new files response struct operations per account request added documentation duplicate fix lib.rs documenation small fix added operations for ledgers test simgle operation request documentation
dc18656
to
f6af29b
Compare
endpoints for
I was planning on doing every operation enpoint but the pr is already getting too big.
There is also some code formatting in this pr which increases the amount of files changed a lot but is otherwise uninteresting.