Learn R Programming

hdar (version 1.0.5)

Client: Client Class

Description

The Client is the central gateway for interfacing with the HDA Service. It provides a comprehensive suite of methods to perform operations and retrieve data from the service efficiently.

Arguments

Public fields

apiUrl

API endpoint

Methods


Method new()

Constructor for the `Client` class. Initializes a new instance with authentication credentials.

Usage

Client$new(user, password, save_credentials = FALSE)

Arguments

user

Character string representing the username for authentication.

password

Character string representing the password for authentication.

save_credentials

A logical value indicating whether to save the credentials to a configuration file. Default is FALSE.

Returns

An instance of the `Client` class.


Method token()

Retrieves the current authentication token.

Usage

Client$token()

Returns

Character string representing the authentication token.


Method get_token()

Generates a new authentication token.

Usage

Client$get_token()

Returns

Character string representing the newly generated token.


Method send_request()

Sends a specified request to the server and returns the response.

Usage

Client$send_request(req, raw_response = FALSE)

Arguments

req

A request object or list representing the HTTP request.

raw_response

Optional logical value indicating whether the raw response should be returned instead of the parsed body.

Returns

A response object containing the server's response.


Method show_terms()

This function displays the terms and conditions for the services.

Usage

Client$show_terms()

Returns

An HTML document containing the terms and conditions in a collapsible format.


Method terms_and_conditions()

Function to retrieve and accept terms and conditions. Accepting T&C is permanent, it is enough to run this function one. To read T&C see show_terms.

Usage

Client$terms_and_conditions(term_id, reject = FALSE)

Arguments

term_id

A character vector of term_ids that you wish to accept. If missing current status is returned. Use "all" if you want to accept all terms at once.

reject

Logical, default 'FALSE'. If TRUE it inverts the operation and the provided term_id's are rejected/revoked.

Returns

A data frame reflecting the actual acceptance status for each term.


Method datasets()

Lists datasets available on WEkEO, optionally filtered by a text pattern.

Usage

Client$datasets(pattern = NULL)

Arguments

pattern

Optional character string to filter dataset names by matching text.

Returns

List containing datasets and associated information.


Method search()

This function performs a search based on a specified query and returns an instance of SearchResults.

Usage

Client$search(json_query, limit = NULL)

Arguments

json_query

Character string representing the search query.

limit

Optional; a number specifying the maximum number of results to return.

Returns

An instance of the SearchResults class containing the search results.


Method get_querytemplate()

Retrieves the raw query metadata for a specified datasetId.

Usage

Client$get_querytemplate(datasetId, to_json = FALSE)

Arguments

datasetId

Character, representing the dataset's identifier.

to_json

Logical; if `TRUE`, returns the data in JSON format.

Returns

List or JSON file containing the raw query options.


Method generate_query_template()

This function generates a query template based on a specified datasetId.

Usage

Client$generate_query_template(datasetId)

Arguments

datasetId

A numeric or character ID representing the dataset.

Returns

A JSON representing the generated query template.


Method clone()

The objects of this class are cloneable with this method.

Usage

Client$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

show_terms to read the Terms and conditions.

SearchResults for details on the returned object.