Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades committed Dec 14, 2023
1 parent a74cb37 commit aa68cd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
8 changes: 2 additions & 6 deletions src/endpoints/feed_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ pub(crate) mod basic {
self.payload.params.body = Some(body);
self
}

/// Consume and send the [`Request`].
async fn send(self) -> Result<()> {
handle_request(self.client, &self).await
}
}

impl<'a> Endpoint for Request<'a> {
Expand All @@ -121,8 +116,9 @@ pub(crate) mod basic {

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume and send the [`Request`].
fn into_future(self) -> Self::IntoFuture {
self.send()
async move { handle_request(self.client, &self).await }
}

Check warning on line 122 in src/endpoints/feed_items.rs

View check run for this annotation

Codecov / codecov/patch

src/endpoints/feed_items.rs#L120-L122

Added lines #L120 - L122 were not covered by tests
}

Expand Down
8 changes: 2 additions & 6 deletions src/endpoints/transactions/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,15 @@ impl<'a> Request<'a> {
self.expand_merchant = true;
self
}

/// Consume the request and return the [`Transaction`]
async fn send(self) -> Result<Transaction> {
handle_request(self.client, &self).await
}
}

impl<'a> IntoFuture for Request<'a> {
type Output = Result<Transaction>;

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume the request and return the [`Transaction`]
fn into_future(self) -> Self::IntoFuture {
self.send()
async move { handle_request(self.client, &self).await }

Check warning on line 64 in src/endpoints/transactions/get.rs

View check run for this annotation

Codecov / codecov/patch

src/endpoints/transactions/get.rs#L63-L64

Added lines #L63 - L64 were not covered by tests
}
}
22 changes: 9 additions & 13 deletions src/endpoints/transactions/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,23 @@ impl<'a> Request<'a> {
self.query.expand_merchant = Some("merchant");
self
}

/// Consume the request and return the list of [`Transaction`]s
async fn send(self) -> Result<Vec<Transaction>> {
#[derive(Deserialize)]
struct Response {
transactions: Vec<Transaction>,
}

let response: Response = handle_request(self.client, &self).await?;

Ok(response.transactions)
}
}

impl<'a> IntoFuture for Request<'a> {
type Output = Result<Vec<Transaction>>;

type IntoFuture = impl Future<Output = Self::Output>;

/// Consume the request and return the list of [`Transaction`]s
fn into_future(self) -> Self::IntoFuture {

Check warning on line 88 in src/endpoints/transactions/list.rs

View check run for this annotation

Codecov / codecov/patch

src/endpoints/transactions/list.rs#L88

Added line #L88 was not covered by tests
self.send()
#[derive(Deserialize)]
struct Response {
transactions: Vec<Transaction>,
}
async move {
let response: Response = handle_request(self.client, &self).await?;
Ok(response.transactions)
}

Check warning on line 96 in src/endpoints/transactions/list.rs

View check run for this annotation

Codecov / codecov/patch

src/endpoints/transactions/list.rs#L93-L96

Added lines #L93 - L96 were not covered by tests
}
}

Expand Down

0 comments on commit aa68cd4

Please sign in to comment.