Learn R Programming

rosv (version 0.5.1)

RosvQuery1: R6 Class for OSV Query Endpoint

Description

An R6 class to provide a lower-level interface to the query endpoint of the OSV API.

Arguments

Value

An R6 object to operate with OSV query endpoint.

Public fields

request

Request object made by httr2.

content

Body contents of response from OSV API.

response

Response object returned from OSV API.

Methods


Method new()

Set the core request details for subsequent use when called in run() method.

Usage

RosvQuery1$new(
  commit = NULL,
  version = NULL,
  name = NULL,
  ecosystem = NULL,
  purl = NULL
)

Arguments

commit

Commit hash to query against (do not use when version set).

version

Version of package.

name

Name of package.

ecosystem

Ecosystem package lives within (must be set if using name).

purl

URL for package (do not use if name or ecosystem is set).


Method run()

Perform the request and return response for OSV API call.

Usage

RosvQuery1$run()


Method parse()

Parse the contents returned into a tidier format. Can use future plans to help parallelize. Not all contents are parsed.

Usage

RosvQuery1$parse()


Method print()

Print basic details of query object to screen.

Usage

RosvQuery1$print(...)

Arguments

...

Reserved for possible future use.


Method clone()

The objects of this class are cloneable with this method.

Usage

RosvQuery1$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

Pageination is implemented via httr2::req_perform_iterative() and a private method for extracting tokens automatically. When initialized, the page_token is set to NULL; if a token is generated for large results the process is handled internally. The response object will contain a list of all returned responses before any formatting occurred. The content field will contain the list of vulnerabilities which may be further parsed into a table format.

See Also

Examples

Run this code
query <- RosvQuery1$new(commit = '6879efc2c1596d11a6a6ad296f80063b558d5e0f')
query

Run the code above in your browser using DataLab