konstructio / dropkick

dropkick cli
Other
4 stars 0 forks source link

Civo: Some paginated functions don't "paginate" #19

Closed patrickdappollonio closed 15 hours ago

patrickdappollonio commented 2 weeks ago

It seems that some API endpoints that expect pagination don't take it in as pagination.

For example, /v2/objectstores expects a page and perPage params. However the SDK does not support passing it, the ListObjectStores() receives no arguments, essentially grabbing page 1 only.

https://github.com/civo/civogo/blob/v0.3.79/objectstore.go#L58-L71

Compare that function to ListObjectStoreCredentials that does take a page and perPage:

https://github.com/civo/civogo/blob/v0.3.79/objectstore_credential.go#L46-L64

I naively thought they were using some sort of magic when setting the Page value of the returned output (since it was a pointer) but realized that couldn't have worked if it would've got a copy of the pointer instead.

It's possible to use civogo's SendXXXRequest() functions and craft our own URLs:

https://pkg.go.dev/github.com/civo/civogo#Client.SendGetRequest https://pkg.go.dev/github.com/civo/civogo#Client.SendPostRequest

patrickdappollonio commented 15 hours ago

Fixed in the v2 refactor: https://github.com/konstructio/dropkick/pull/20