SDMXRequestBuilder: Class "SDMXRequestBuilder"

View source: R/SDMXRequestBuilder-methods.R

SDMXRequestBuilderR Documentation

Class "SDMXRequestBuilder"

Description

A basic class to handle a SDMX service request builder

Usage

SDMXRequestBuilder(regUrl, repoUrl, accessKey = NULL,
  formatter, handler, compliant, unsupportedResources = list(), 
  headers = list())

Arguments

regUrl

an object of class "character" giving the base Url of the SDMX service registry

repoUrl

an object of class "character" giving the base Url of the SDMX service repository

accessKey

an object of class "character" indicating the name of request parameter for which an authentication or subscription user key/token has to be provided to perform requests

formatter

an object of class "list" giving a formatting function (for each resource) that takes an object of class "SDMXRequestParams" as single argument. Such parameter allows to customize eventual params (e.g. specific data provider rules)

handler

an object of class "list" that will be in charge of build a web request.

compliant

an object of class "logical" indicating if the request builder is somehow compliant with a service specification

unsupportedResources

an object of class "list" giving one or more resources not supported by the Request builder for a given provider

headers

an object of class "list" that contains any additional headers for the request.

Details

The handler function will list the resource methods. Each method will accept a single object of class SDMXRequestParams as argument. This object will give the different request params as slots (baseUrl, agencyId, resource, resourceId, version, flowRef, key, start, end, compliant) to build the output (a string representing the web request to build).

The rsdmx package will as much as possible try to handler generic handlers. At now, the available embedded builders are: SDMXREST20RequestBuilder (connector for SDMX 2.0 web-services), SDMXREST21RequestBuilder (connector for SDMX 2.1 web-services), SDMXDotStatRequestBuilder (connector for SDMX .Stat web-services implementations)

Slots

regUrl

an object of class "character" giving the base Url of the SDMX service registry

repoUrl

an object of class "character" giving the base Url of the SDMX service repository

accessKey

an object of class "character" indicating the name of request parameter for which an authentication or subscription user key/token has to be provided to perform requests

formatter

an object of class "list" giving a formatting function (for each resource) that takes an object of class "SDMXRequestParams" as single argument. Such parameter allows to customize eventual params (e.g. specific data provider rules)

handler

an object of class "list" that will be in charge of build a web request.

compliant

an object of class "logical" indicating if the request builder is somehow compliant with a service specification

unsupportedResources

an object of class "character" giving one or more resources not supported by the Request builder for a given provider

headers

an object of class "list" that contains any additional headers for the request.

Warning

This class is not useful in itself, but all SDMX non-abstract classes will encapsulate it as slot, when parsing an SDMX-ML document (Concepts, or DataStructureDefinition)

Author(s)

Emmanuel Blondel, emmanuel.blondel1@gmail.com

Examples

 #default formatter
 myFormatter = list(
   dataflow = function(obj){
     #format some obj slots here
     return(obj)
   },
   datastructure = function(obj){
     #format some obj slots here
     return(obj)
   },
   data = function(obj){
     #format some obj slots here
     return(obj)
   }
 )

 #an handler
 #where each element of the list is a function taking as argument an object
 #of class "SDMXRequestParams"
 myHandler <- list(
   "dataflow" = function(obj){return(obj@regUrl)},
   "datastructure" = function(obj){return(obj@regUrl)},
   "data" = function(obj){return(obj@repoUrl)}
 )
 
 #how to create a SDMXRequestBuilder
 requestBuilder <- SDMXRequestBuilder(
   regUrl = "http://www.myorg.org/registry",
   repoUrl = "http://www.myorg.org/repository",
   accessKey = NULL,
   formatter = myFormatter, handler = myHandler, compliant = FALSE)


rsdmx documentation built on Aug. 28, 2023, 5:09 p.m.