Skip to content
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

non-working example - issues paged list #507

Closed
panov-andy opened this issue Dec 21, 2023 · 2 comments · Fixed by #684
Closed

non-working example - issues paged list #507

panov-andy opened this issue Dec 21, 2023 · 2 comments · Fixed by #684

Comments

@panov-andy
Copy link

Hi,
I tried the example from the main page (README.md) and it returns only the first page of the issues.
Please, can you update the example?

let octocrab = octocrab::instance();
// Returns the first page of all issues.
let mut page = octocrab
    .issues("XAMPPRocky", "octocrab")
    .list()
    // Optional Parameters
    .creator("XAMPPRocky")
    .state(params::State::All)
    .per_page(50)
    .send()
    .await?;

// Go through every page of issues. Warning: There's no rate limiting so
// be careful.
loop {
    for issue in &page {
        println!("{}", issue.title);
    }
    page = match octocrab
        .get_page::<models::issues::Issue>(&page.next)
        .await?
    {
        Some(next_page) => next_page,
        None => break,
    }
}
@panov-andy
Copy link
Author

I tried to reduce the number of items_per_page and have got 3 pages only in total for public GitHub.

I also tried to run this example against corporate GitHub with debug logs enabled and have got api/v3 twice for the next_page.

.base_uri("https://github.internal.corp/api/v3/")?

[2023-12-21T18:02:48Z DEBUG octocrab] HTTP; http.method=GET http.url=https://github.internal.corp/api/v3/repos/kubernetes-live/auto-issues-live/issues?state=all&per_page=5 otel.name="HTTP" otel.kind="client"
[2023-12-21T18:02:48Z DEBUG octocrab] HTTP; http.method=GET http.url=https://github.internal.corp/api/v3/api/v3/repositories/215168/issues?state=all&per_page=5&page=2 otel.name="HTTP" otel.kind="client"

@XAMPPRocky
Copy link
Owner

Thank you for your issue! I don't have the time currently to investigate, but would be happy to help review a fix for the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants