Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
HSClientR 0.3.2.9000 (2026-10-20)
=================================

### DEPRECATIONS

* Deprecated `hs_search()` with a warning that the method is no longer supported by this client and may return errors.
* Deprecated `hs_discover()` with a warning that the method is no longer supported by this client and may return errors.
* Deprecated the `HSClient` R6 client and updated initialization messaging to direct users to function-based APIs.

### DOCUMENTATION

* Updated `README` to remove detailed `HSClient` usage examples and retain only a deprecation statement.
* Updated deprecation notes for deprecated search/discover paths to reflect current support status.

HSClientR 0.3.1 (2021-03-31)
============================

Expand Down
33 changes: 23 additions & 10 deletions R/HSClient.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#' @title R6 Class representing a HydroShare Client
#' @title Deprecated R6 HydroShare Client
#' @description
#' `r lifecycle::badge("experimental")`
#' `r lifecycle::badge("deprecated")`
#'
#' *In development*
#' `HSClient` is deprecated and retained only for backward compatibility.
#' It is no longer supported by this package and may return errors.
#' Prefer direct package functions such as [hs_resource()], [hs_files()],
#' and [hs_sysmeta()].
#' @importFrom R6 R6Class
#' @importFrom urltools param_get
#' @importFrom lifecycle badge
Expand All @@ -14,12 +17,21 @@ HSClient <- R6::R6Class("HSClient",
#' @return A new `HSClient` object.
#'
#' *Note: A message will be issued
#' since R6-object is still in development.*
#' since this R6 object is deprecated.*
initialize = function() {
rlang::warn(
paste(
"HSClient is deprecated and no longer supported by this package.",
"It may return errors.",
"Use direct package functions such as hs_resource(), hs_files(),",
"and hs_sysmeta() instead."
)
)

rlang::inform(
crayon::cyan(crayon::bold(paste0(
"R6-based client still in-development.\n",
"Full functionality may not exist."
"R6-based client is deprecated.\n",
"Use package functions instead."
)))
)

Expand All @@ -37,10 +49,11 @@ HSClient <- R6::R6Class("HSClient",
crayon::silver("=======================================\n"),
"Thanks for using HSClientR! ",
crayon::red("\u2665"),
"\nYou can start a query with ",
crayon::red("$query()"),
"\nMake sure to authenticate with ",
crayon::red("$authenticate()"),
"\nThis R6 client is deprecated.",
"\nPrefer package functions like ",
crayon::red("hs_resource()"),
" and ",
crayon::red("hs_files()"),
"\n"
)

Expand Down
12 changes: 11 additions & 1 deletion R/hs_discover.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#' @title HydroShare Discover API
#' @title Deprecated HydroShare Discover API helper
#' @description Query the HydroShare Discover Page
#'
#' `hs_discover()` is retained for backward compatibility only.
#' This method is no longer supported by this client and may
#' return errors.
#' @return A [tibble][tibble::tibble-package] of the first 40 results from
#' HydroShare's [Discover Page](https://www.hydroshare.org/search/). See
#' details for `tibble` description.
Expand Down Expand Up @@ -30,6 +34,12 @@
#' @importFrom rlang .data
#' @export
hs_discover <- function() {
lifecycle::deprecate_warn(
when = "0.3.2",
what = "hs_discover()",
details = "The hs_discover() method is no longer supported by this client and may return errors."
)

request <- httr::GET(
handle = hsapi(),
path = "discoverapi/",
Expand Down
14 changes: 13 additions & 1 deletion R/hs_resource.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
#' Parameters marked with an asterisk (*) are required for
#' that endpoint.
#'
#' ## Deprecated Search Path (`hs_search`)
#'
#' `hs_search()` is retained for backward compatibility only.
#' This method is no longer supported by this client and may
#' return errors.
#'
#' ## Searching Resources (`hs_search`)
#'
#' ### Endpoint:
Expand Down Expand Up @@ -227,7 +233,7 @@ hs_content_types <- function() {
}

# nolint start
#' @title Search HydroShare Resources using solr conventions.
#' @title Deprecated search helper for HydroShare resources.
#' @param page (`integer`) A page number within the paginated result set.
#' @param count (`integer`) Number of results to return per page.
#' @param text (`character`) Search across all Resource Fields
Expand Down Expand Up @@ -268,6 +274,12 @@ hs_content_types <- function() {
# nolint end
hs_search <- function(page = NULL, count = NULL,
text = NULL, author = NULL, ...) {
lifecycle::deprecate_warn(
when = "0.3.2",
what = "hs_search()",
details = "The hs_search() method is no longer supported by this client and may return errors."
)

# Prevents R CMD Check note about non-standard
# evaluation with magrittr pipes
. <- NULL
Expand Down
88 changes: 16 additions & 72 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

HSClientR is an API wrapper for
[HydroShare](https://www.hydroshare.org). Using HSClientR, you can
access resources from HydroShare directly in your R environment, either
by the package functions or the in-development
[`R6 Class`](https://r6.r-lib.org/reference/R6Class.html).
access resources from HydroShare directly in your R environment with
the package functions. The [`R6 Class`](https://r6.r-lib.org/reference/R6Class.html)
client is deprecated and retained for backward compatibility only.

## Installation

Expand All @@ -42,12 +42,15 @@ as well as some additional functionality.

``` r
# To set auth headers
hs_auth(set_headers = TRUE)
hs_auth(set_header = TRUE)
```

This function will begin an [OAuth 2.0](https://oauth.net/2/) dance between your R session and the
HydroShare API. This is only needed if you are utilizing `hs_user()`/`hs_userDetails()` or any of the
`DELETE`, `POST`, and `PUT` functions. Most of the `GET` functions are publicly accessible.
HydroShare API. This is only needed if you are utilizing `hs_user()`/`hs_user_details()`. Most of
the `GET` functions are publicly accessible.

> Note: the search-based examples below call the deprecated HydroShare `/hsapi/resource/search`
> endpoint via `hs_search()` / `hs_resource(text = ...)` and will now warn or return HTTP 404.

``` r
# Search for resources
Expand Down Expand Up @@ -81,6 +84,9 @@ Another way of finding resources is via the Discover API.
This is equivalent to accessing the "Discover" page directly
on the HydroShare website. It returns the first 40 results.

> Note: `hs_discover()` is deprecated will may now warn or fail because the upstream Discover endpoint
> is no longer supported.

> It is preferred to use `hs_resource()` or any of the other `hs_*` functions,
> as they have better support/flexibility in contrast to `hs_discover()`.

Expand Down Expand Up @@ -151,73 +157,11 @@ hs_resource(id = "e1d4f2aff7d84f79b901595f6ea48368")
For more details on using `hs_resource()`, refer to the
[documentation site](https://hsclientr.justinsingh.me/reference/hs_resource.html).

## Example Using R6 HydroShare Client Class
## R6 HydroShare Client

> Note: functionality for queries and discover traversal still need to
> be implemented. The example below may change as the object matures.

``` r
# Create new HSClient object
hs_client <- HSClient$new()

#> R6-based client still in-development.
#> Full functionality may not exist.
#>
#> HSClientR - R6 Client
#> =======================================
#> Thanks for using HSClientR! ♥
#> You can start a query with $query()
#> Make sure to authenticate with $authenticate()
#> =======================================

hs_client$print()

#> It looks like you haven't authenticated yet...
#> Please call $authenticate() on this object to get
#> OAuth2 authentication set up with HydroShare! :)

# Begin authentication (hs_auth)
hs_client$authenticate()

# OAuth2 Dance will begin and a web browser
# will open to HydroShare's login/authorization
# page. Once you login, an access token will be
# sent back to a local httpuv web server for
# your R session.

# Search for a resource (hs_resource)
hs_client$query(text = "NHDPlus VAA")

#> # A tibble: 2 x 18
#> text author abstract contributor subject availability created modified
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 " \n ba… Rea, A… "The NHDPl… "" NHDPlus,… public 2019-0… 2019-08…
#> 2 " \n 60… Johnso… "These fil… "" roughnes… public 2020-1… 2021-02…
#> # … with 10 more variables: coverage_type <chr>, east <dbl>, northlimit <dbl>,
#> # eastlimit <dbl>, southlimit <dbl>, westlimit <dbl>, start_date <lgl>,
#> # end_date <lgl>, resource_type <chr>, content_type <chr>

# $query uses hs_search() to perform the query,
# and while a tibble is outputted, the object returns
# itself invisibly. Once the query is performed, we can
# print our object to see our last query and its results:

hs_client$print()

#> Authenticated as:
#> Justin Singh-Mohudpur
#> User: jsinghm
#> ID: 8409
#> Org: University of California, Santa Barbara
#> =======================================
#> Last Query ($query): text = "NHDPlus VAA"
#> Query Results:
#>
#> 6092c8a62fac45be97a09bfd0b0bf726
#>
#> NHDPlus Value Added Attributes - no geometries
#> These files contain a curated set ...
```
> `HSClient` is deprecated and retained for backward compatibility only.
> Prefer direct package functions such as `hs_resource()`, `hs_files()`, and
> `hs_sysmeta()`.

## Meta

Expand Down
Loading
Loading