Skip to main content

HS.HC.ClientAPI.AbstractAPI

abstract class HS.HC.ClientAPI.AbstractAPI extends %Library.RegisteredObject

Superclass for ClientAPI classes.
For each API (Resource), there will be at least one subclass conventionally named .ClientAPI..API (e.g. HS.ClientAPI.SysIndex.API)
That subclass is the "Factory" class that is used to acquire an instance of the API. It must override the RESOURCENAME Parameter with the name of the resource that this client calls.
For versioned APIs, the Factory class is further extended by "version-specific" subclasses which are conventionally named .ClientAPI..V.API (e.g. HS.ClientAPI.SysIndex.V0.API)
For versioned APIs:
  • the "Factory" class must override the CURRENTRESOURCEVERSION parameter to declare the current API version/
  • each "version-specific" class must override the CURRENTRESOURCE parameter with the version it implements.
The subclass can then easily implement its REST requests by invoking HTTP methods on RestClient which will be configured with appropriate authentication/settings for the duration of the lifetime of the API instance.

Property Inventory

Method Inventory

Parameters

parameter CURRENTRESOURCEVERSION = 0;
Specifies the Current (highest) Resource version supported. Must be overridden by the ClientAPI's Factory class. Note, that this must be kept up to date in the "factory class" as new version-specific classes are added.
parameter ClientCacheTimeout = 30;
Timeout for cached result of version negotiation.
parameter RESOURCENAME;
Specifies the name of the resource as it appears in the URL.
@API.Parameter
parameter RESOURCEVERSION;
Must be overridden by each ClientAPI version-specific class

Properties

property RestClient as HS.HC.RESTClient;
Call methods on this property to make REST requests.
@API.Property
Property methods: RestClientGet(), RestClientGetSwizzled(), RestClientIsValid(), RestClientNewObject(), RestClientSet()

Methods

classmethod GetBestForClient(restClient As HS.HC.RESTClient, versionRange As %String = "") as HS.HC.ClientAPI.AbstractAPI
API.Method Find the best ClientAPI version instance for the endpoint targeted by the specified RESTClient that falls within the versionRange where: versionRange is a single number or a "range spec" in the form - where may be omitted. If is omitted, it is assumed to be the value of #CURRENTRESOURCEVERSION
classmethod GetBestInstance(serviceName As %String, versionRange As %String = "", httpOptions As HS.HC.RESTOptions = "") as HS.HC.ClientAPI.AbstractAPI
API.Method Find the best ClientAPI version instance for the specified serviceName that falls within the versionRange. versionRange is a single number or a "range spec" in the form - where may be omitted. If is omitted, it is assumed to be the value of #CURRENTRESOURCEVERSION

Inherited Members

Inherited Methods

Subclasses

FeedbackOpens in a new tab