rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

pin_versions() returns only "recent" versions #470

Closed shaun-parker closed 3 years ago

shaun-parker commented 3 years ago

Hi The pin_versions() function only returns a cut of the top 20 most recent versions of a pin. Would it be possible to include an argument to show the full list of versions, or a custom number, or even filter the list with a date range? We have some pins updating every day, sometimes it's useful to go back more than 20 days and pull an old version. I know this can be done with pin_get() and specifying the version number, but actually finding the version number that we want to pull means going over to Connect and getting it from the front-end interface. Would be much more useful if we could do this programmatically

image

EKtheSage commented 3 years ago

In addition to what @shaun-parker suggested, I think it would be beneficial to allow for filtering on meta data.

As the current pin_versions() stands, it only lists the create dates and version number, which becomes hard to determine the right version you want to retrieve without some human-understandable descriptions.

For example, if we added the metadata like below, we should be able to find it among the many versions of the same pin by filtering on pin_object$metadata$user$type == 'Industry' & pin_object$metadata$user$is_adjusted == TRUE

pin_write(
  board = board,
  x = test,
  name = 'Iris_Data',
  desc = 'Iris Take Two',
  metadata = list(
    Calendar_Date = '2021-06-30',
    type = 'Industry',
    is_adjusted = TRUE
  )
)
hadley commented 3 years ago

@shaun-parker I'm pretty sure this is fixed in the dev version, since rsc_content_versions() (used by board_pin_versions.pins_board_rsconnect()) now uses an endpoint that isn't paginated.

@EKtheSage I don't think that's feasible currently because reading the additional metadata would require an additional HTTP request for each pin, which would make pin_versions() much slower.

github-actions[bot] commented 2 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.