8
37
Fork
You've already forked forgejo-api
18

How to get the total count while getting a list of entries? #80

Closed
opened 2025年02月06日 04:23:06 +01:00 by dmoonfire · 3 comments

I have a large number (121) projects inside an organization. To get the list of groups, I can use org_list_reposto get it, but I can't ask for all of them because Forgejo is set up to only return a maximum of 50 entries (by default).

letquery=OrgListReposQuery{page: Some(1),limit: Some(10000),};letlist=&self.api.org_list_repos(&group_name,query).await?;

Without changing configuration, the API returns a header that contains the total number of entries:

x-total-count: 121

Is there a good way of getting that count in some manner? I would prefer to use that instead of repeatedly requesting pages until I get an empty list.

I have a large number (121) projects inside an organization. To get the list of groups, I can use `org_list_repos`to get it, but I can't ask for all of them because Forgejo is set up to only return a maximum of 50 entries (by default). ```rust let query = OrgListReposQuery { page: Some(1), limit: Some(10000), }; let list = &self .api .org_list_repos(&group_name, query) .await?; ``` Without changing configuration, the API returns a header that contains the total number of entries: ``` x-total-count: 121 ``` Is there a good way of getting that count in some manner? I would prefer to use that instead of repeatedly requesting pages until I get an empty list.

It seems to be the best option would be to change org_list_repos to return that x-total-count header, which I should easily be able to do.

It seems to be the best option would be to change `org_list_repos` to return that `x-total-count` header, which I should easily be able to do.

Thank you.

Thank you.

A new version with the needed changes will be published shortly

A new version with the needed changes will be published shortly
Sign in to join this conversation.
No Branch/Tag specified
main
docs-ci
pages
v0.11.0
v0.10.0
v0.9.2
v0.9.1
v0.9.0
v0.8.1
v0.8.0
v0.7.0
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.0
v0.1.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cyborus/forgejo-api#80
Reference in a new issue
Cyborus/forgejo-api
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?