Skip to content

Conversation

@adamconnelly
Copy link
Contributor

The main change here is to support making the auto paging behaviour optional. The reasoning behind this is that we don't know in advance how many pages of data there might be, and sometimes we only care about a small subset of the data.

I also fixed a couple other issues that I spotted while looking at this. Full details here:

  • Added a new option, DisableAutoPaging. This defaults to false for backwards compatibility, but allows the behaviour of automatically requesting all pages of a paged response to be disabled.
  • While doing this I split the execute() method into two versions - one that supports paging and another that doesn't. The reason I did this is that the previous version was adding the pagelen parameter for any paths containing /repositories/, but this breaks if you call Repositories.ListForAccount() with a role specified, in which case there's no trailing /. I figured it was better to be explicit about when to support paging or not.
  • Moved the max_depth support out of the client and into Repository.ListFiles(), which is where it's actually supported. I noticed that Repository.ListBranches() also specifies the max depth. It doesn't look like this is actually supported by the API to me, but I didn't want to risk breaking it in case I'm wrong.
  • Fixed a mistake in GetCommitContents() where it was using a DELETE instead of a GET.

- Added a new option, `DisableAutoPaging`. This defaults to false for backwards compatibility, but allows the behaviour of automatically requesting all pages of a paged response to be disabled.
- While doing this I split the `execute()` method into two versions - one that supports paging and another that doesn't. The reason I did this is that the previous version was adding the `pagelen` parameter for any paths containing `/repositories/`, but this breaks if you call `Repositories.ListForAccount()` with a role specified, in which case there's no trailing `/`. I figured it was better to be explicit about when to support paging or not.
- Moved the `max_depth` support out of the client and into `Repository.ListFiles()`, which is where it's actually supported. I noticed that `Repository.ListBranches()` also specifies the max depth. It doesn't look like this is actually supported by the API to me, but I didn't want to risk breaking it in case I'm wrong.
- Fixed a mistake in `GetCommitContents()` where it was using a `DELETE` instead of a `GET`.
Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ktrysmt ktrysmt merged commit f99b061 into ktrysmt:master Apr 18, 2022
@adamconnelly adamconnelly deleted the allow-no-paging branch April 18, 2022 09:09
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 this pull request may close these issues.

2 participants