Qore BillwerkRestClient Module Reference  1.1
BillwerkRestClient::BillwerkRestClient Class Reference

this class provides the REST client API for communication with the billwerk.com platform More...

Inheritance diagram for BillwerkRestClient::BillwerkRestClient:

Public Member Methods

 constructor (hash< auto > options, *softbool do_not_connect)
 creates the object with the given options More...
 

Static Public Member Methods

static hash< auto > getOptions (hash< auto > options)
 returns options for the RestClient::constructor()
 

Private Member Methods

 getToken ()
 logs in an sets the token for further communication
 

Detailed Description

this class provides the REST client API for communication with the billwerk.com platform

This class requires one of the following options for billwerk.com's authentication and authorization:

  • client_secret: the billwerk.com's client_secret
  • token: the billwerk.com's token, if provided then the HTTP username, password, and client_secret are not needed and will be ignored.

After connecting, the BillwerkRestClient class will request a session token that will be used in further communication.

Member Function Documentation

◆ constructor()

BillwerkRestClient::BillwerkRestClient::constructor ( hash< auto >  options,
*softbool  do_not_connect 
)

creates the object with the given options

Example:
BillwerkRestClient billwerk(
{
"url": "https://cloud.billwerk.com/test",
"client_id": "id",
"client_secret": "8df3cc8be92d300edb9ff9b9a680d22eacbf2ee5"
});
Parameters
optionsvalid options are:
  • client_secret (optional): the billwerk.com client_secret
  • client_id (optional): the billwerk.com client_id
  • additional_methods: Optional hash with more but not-HTTP-standardized methods to handle. It allows to create various HTTP extensions like e.g. WebDAV. The hash takes the method name as a key, and the value is a boolean True or False: indicating if the method requires a message body as well. Example:
    # add new HTTP methods for WebDAV; both of which require a message body
    {"additional_methods": {"PROPFIND": True, "MKCOL": True}};
  • connect_timeout: The timeout value in milliseconds for establishing a new socket connection (also can be a relative date-time value for clarity, ex: 20s)
  • content_encoding: for possible values, see EncodingSupport; this sets the send encoding (if the "send_encoding" option is not set) and the requested response encoding (note that the RestClient class will only compress outgoing message bodies over CompressionThreshold bytes in size)
  • data: a data serialization option; if not present defaults to "auto"
  • default_path: The default path to use for new connections if a path is not otherwise specified in the connection URL
  • default_port: The default port number to connect to if none is given in the URL
  • error_passthru: if True then HTTP status codes indicating errors will not cause an HTTP-CLIENT-RECEIVE-ERROR exception to be raised, rather such responses will be passed through to the caller like any other response
  • headers: an optional hash of headers to send with every request, these can also be overridden in request method calls
  • http_version: Either '1.0' or '1.1' for the claimed HTTP protocol version compliancy in outgoing message headers
  • max_redirects: The maximum number of redirects before throwing an exception (the default is 5)
  • proxy: The proxy URL for connecting through a proxy
  • send_encoding: a send data encoding option or the value "auto" which means to use automatic encoding; if not present defaults to no content-encoding on sent message bodies (note that the RestClient class will only compress outgoing message bodies over CompressionThreshold bytes in size)
  • swagger: the path to a Swagger 2.0 REST schema file for API validation; only used if validator not provided (see the Swagger module)
  • timeout: The timeout value in milliseconds (also can be a relative date-time value for clarity, ex: 30s)
  • url: A string giving the URL to connect to; if not given then the target URL will be taken from any validator option, if given by calling AbstractRestSchemaValidator::getTargetUrl()
  • validator: an AbstractRestSchemaValidator object to validate request and response messages; overrides swagger
  • no_charset: if True no charset will be added to the Content-Type header (should be set to True if data are sent in the body). Default is True if not passed.
do_not_connectif False (the default), then a connection will be immediately established to the remote server
Exceptions
RESTCLIENT-ERRORinvalid option passed to constructor, unsupported data serialization, etc
BILLWERKRESTCLIENT-ERRORmissing or invalid required option for Billwerk.com REST authentication or communication