Skip to contents

An R6 class to provide a lower-level interface to the querybatch endpoint of the OSV API. Batches are enforced to only process by commit hash, purl, or name+ecosystem. This avoids some confusion as to which is taken preferentially and simplifies query creation.

Value

An R6 object to operate with OSV querybatch endpoint.

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 results with vulnerabilities which may be further parsed into a table format.

Super class

rosv::RosvQuery1 -> RosvQueryBatch

Methods

Inherited methods


Method new()

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

Usage

RosvQueryBatch$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

RosvQueryBatch$run()


Method parse()

Parse the contents returned into a tidier format.

Usage

RosvQueryBatch$parse()

Details

When no result is found, any empty list is returned by the API, which during parsing will be dropped as the list is flattened. However, the index of the list is still accessible and the dropped items can easily be identified from the results column. Not all contents are parsed.


Method clone()

The objects of this class are cloneable with this method.

Usage

RosvQueryBatch$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

pkgs <- c('jinja2', 'dask')
ecosystem <- rep('PyPI', length(pkgs))
batchquery <- RosvQueryBatch$new(name = pkgs, ecosystem = ecosystem)
batchquery
#> Request made to: NA 
#> Successful responses of total: NA 
#> Successful content size (bytes): NA