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

Actually GetAll when there are fewer than 1000 entries and FindAll when a limit is not provided #9

Open
wants to merge 7 commits into
base: Develop
Choose a base branch
from

Conversation

cofl
Copy link

@cofl cofl commented Jul 19, 2018

Discovered while testing against the asset list on a local SnipeIT install.

In EndPointManager.GetAll, when there are fewer than 1000 assets in the system, only 50 assets (the default limit) would be included in the ResponseCollection, though the Total would still show the correct number.

In EndPointManager.FindAll, when a limit is not provided, again at most only 50 assets would be included in the ResponseCollection, even when the results should have more, such as when retrieving all assets of a certain manufacturer.

Replication steps

I did my testing in PowerShell.

  1. Have a SnipeIT instance with more than 50 but fewer than 1000 assets, where approximately 160 of those assets have a manufacturer.
  2. PowerShell log attached (paths removed):
PS C:\> $api = [SnipeSharp.SnipeItApi]::new(); $api.ApiSettings.ApiToken = $token; $api.ApiSettings.BaseUrl = $url
PS C:\> $api.AssetManager.GetAll() | select Total, @{Name='Actual';Expression={$_.Rows.Count}}

Total Actual
----- ------
  602     50

PS C:\> $filter = [SnipeSharp.Endpoints.SearchFilters.AssetSearchFilter]::new()
PS C:\> $filter.Manufacturer = $api.ManufacturerManager.Get("Lenovo")
PS C:\> $api.ManufacturerManager.Get("Lenovo").AssetsCount
167
PS C:\> $api.AssetManager.FindAll($filter) | select Total, @{Name='Actual';Expression={$_.Rows.Count}}

Total Actual
----- ------
  167     50

@cofl cofl changed the base branch from master to Develop July 19, 2018 14:25
@cofl
Copy link
Author

cofl commented Jul 19, 2018

This addresses #5.

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