web3.storage icon indicating copy to clipboard operation
web3.storage copied to clipboard

Add user/uploads API pagination and sorting to the js client

Open joshJarr opened this issue 2 years ago • 2 comments

Related to: https://app.zenhub.com/workspaces/web3storage-product-6106d25b58fccc00105aedcb/issues/web3-storage/web3.storage/1362 Once PR 1501 is merged the GET user/uploads endpoint will then support additional functionality.

This additional functionality should be documented and added to the JS client. Acceptance Criteria:

As a user, I can

  • [ ] Request pages of uploads
  • [ ] Sort my uploads by date and name, ascending and descending
  • [ ] Filter my results before of after a given date

Pagination Can be achieved by supplying the endpoint with

  • size: number Number of results returned by a page (default 25)
  • page: number The page number (default 1)

Sorting Uploads can now be sorted on the API with

  • sortBy: 'Name' | 'Date' The table to sort by name being the file name, date being the date the upload was created - the inserted_at column. (default 'Name').
  • sortOrder 'asc' | 'desc': Orders results by ascending or descending (default 'desc'`)

Filtering (optional) Existing filtering functionality exists with before, but now we can also filter with after

  • before: ISO 8601 string: A date to filter all results prior to.
  • after: ISO 8601 string: A date to filter all results post to.

joshJarr avatar Jun 28 '22 10:06 joshJarr

Just confirming - this is net of #1408 (which looks like it's just for the API)? Did the behavior of the JS client change after merging #1408? Just looking to see how to prioritize this (though this issue seems like it could be a pretty quick win)

dchoi27 avatar Jul 05 '22 16:07 dchoi27

Ooh, and for users using the w3 CLI, do you know if updating the client will automatically get it into the CLI, or do we need to do this in addition? (see: #1610) cc @mbommerez

dchoi27 avatar Jul 05 '22 17:07 dchoi27

We need to do an investigation into this, what it currrently does.

Also, since we migrate to w3up and its new CLI, not sure how much time we should spend on this?

mbommerez avatar Sep 21 '22 14:09 mbommerez

Yes, let's say we're not doing this.

dchoi27 avatar Sep 21 '22 16:09 dchoi27

Okay thanks, closing this out.

mbommerez avatar Sep 21 '22 16:09 mbommerez