Skip to content

Commit a27e4b2

Browse files
[octocrab] Expose get_links from page module (#7)
The commit compare endpoint does not conform to how octocrab expects paginated response bodies to be shaped. So, we need to expose a way to get the pagination headers from the response and manually do a little pagination ourselves.
1 parent 754b5c6 commit a27e4b2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ mod api;
214214
mod body;
215215
mod error;
216216
mod from_response;
217-
mod page;
217+
pub mod page;
218218

219219
pub mod auth;
220220
pub mod etag;

src/page.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ impl<T: serde::de::DeserializeOwned> crate::FromResponse for Page<T> {
238238
}
239239
}
240240

241-
struct HeaderLinks {
242-
next: Option<Uri>,
243-
prev: Option<Uri>,
244-
first: Option<Uri>,
245-
last: Option<Uri>,
241+
pub struct HeaderLinks {
242+
pub next: Option<Uri>,
243+
pub prev: Option<Uri>,
244+
pub first: Option<Uri>,
245+
pub last: Option<Uri>,
246246
}
247247

248-
fn get_links(headers: &http::header::HeaderMap) -> crate::Result<HeaderLinks> {
248+
pub fn get_links(headers: &http::header::HeaderMap) -> crate::Result<HeaderLinks> {
249249
let mut first = None;
250250
let mut prev = None;
251251
let mut next = None;

0 commit comments

Comments
 (0)