| Qore CdsRestClient Module Reference 2.0

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
CdsRestClient::CdsRestConnection Class Reference

class for Microsoft Common Data Service REST connections; returns CdsRestClient objects More...

Inheritance diagram for CdsRestClient::CdsRestConnection:
[legend]

## Public Member Functions
| constructor (hash< auto > config, *hash< auto > attr)
| creates the CdsRestConnection object
*string | getAppName ()
| Returns the data provider application name this connection serves, if any.
string | getAuthorizationCodeRequest (hash< AuthCodeInfo > info=< AuthCodeInfo >{})
| Returns a URI for an authorization code request.
string | getAuthUrl (*bool allow_relative)
| Returns the OAuth2 auth URL or throws an exception if not set.
DataProvider::AbstractDataProvider | getDataProvider (*hash< auto > constructor_options)
| returns a data provider object for this connection
string | getOAuth2OptionName (string opt)
| Returns the OAuth2 option name for this connection.
hash< auto > | getOAuth2Options ()
| Returns OAuth2 options in a standard format.
string | getTokenUrl (*bool allow_relative)
| Returns the OAuth2 token URL or throws an exception if not set.
string | getType ()
| returns `"cdsrests"`
bool | hasDataProvider ()
| returns True as this connection returns a data provider with the getDataProvider() method
bool | isAuthTokenError (int status_code, hash< auto > headers, bool body_deserialized, *string body_content_type, auto body)
| Returns True if the response was related to an authorization token error.

## Public Attributes
const | ConnectionScheme = ...
| Connection entry info.
const | OAuth2AuthRequestOptions = ...
| options required to support the OAuth2 authorization code grant flow
const | OAuth2DifferentOptionMap = map {$1.value: $1.key}
| Different OAuth2 option map; standard name => extern name.
const | OAuth2Options = ...
| Maps CDS REST options to standard options.
const | OAuth2StandardToCdsOptionMap = map {$1.value: $1.key}
| Maps standard option names to CDS REST option names.

## Protected Member Functions
| checkAuthCodeFeature ()
| Sets the auth code feature if supported.
hash< ConnectionSchemeInfo > | getConnectionSchemeInfoImpl ()
| Returns the ConnectionSchemeInfo hash for this object.
CdsRestClient | getImpl (bool connect=True, *hash< auto > rtopts)
| returns a CdsRestClient object
| setChildCapabilities ()
| Sets child data provider capabilities.

## Static Protected Member Functions
static hash< auto > | getOptions (string url, *hash< auto > orig_opts)
| returns options for CdsRestConnection::constructor()

## Detailed Description

class for Microsoft Common Data Service REST connections; returns CdsRestClient objects

supports options as in RestClient::RestClient with the following differences:

- `"api"`: the API version for CDS
- `"api_profile"`: one of:
  - `none` (no options set)
  - `dynamics` (set client options for the MS Dynamics 365 API)
- `"oauth2_client_id"`: (required) the Microsoft Common Data Service OAuth2 client ID
- `"oauth2_client_secret"`: (required) the Microsoft Common Data Service OAuth2 client secret
- `"data"`: see DataSerializationOptions for possible values; the default is `"json"`
- `"scope"`: the OAuth2 scope for the login; the default depends on the `"api_profile"` option

See also
  CdsRestClient::CdsRestClient::constructor() for more information on the above options

## Member Function Documentation

## ◆ constructor()

CdsRestClient::CdsRestConnection::constructor | ( | hash< auto > | config,
|  | *hash< auto > | attr )

creates the CdsRestConnection object

Parameters

  config | with the following keys: name (required string): the connection name display_name (optional string): the display name short_desc (optional string): a short description in plain text desc (optional string): a long description with markdown formatting url (required string): the connection URL opts (optional hash): connection options logger (optional LoggerInterface object): logger for the connection
  attr | optional connection attributes monitor (optional bool): should the connection be monitored? Default: True enabled (optional bool): is the connection enabled? Default: True locked (optional bool): is the connection locked? Default: False debug_data (optional bool): debug data? Default: False tags (optional hash): tags for the connection; no default value

Exceptions

  CONNECTION-OPTION-ERROR | missing or invalid connection option or attribute

## ◆ getAppName()

*string CdsRestClient::CdsRestConnection::getAppName | ( |  | ) |

Returns the data provider application name this connection serves, if any.

Returns
  the data provider application name this connection serves, if any

## ◆ getAuthorizationCodeRequest()

string CdsRestClient::CdsRestConnection::getAuthorizationCodeRequest | ( | hash< AuthCodeInfo > | info = < AuthCodeInfo >{} | ) |

Returns a URI for an authorization code request.

The `oauth2_grant_type` must be `authorization_code`, and `oauth2_client_id`, `oauth2_auth_url`, `oauth2_redirect_url` must set if the `redirect_uri` option is not used

Parameters

  info | context information for the authorization code request

Since
  CdsRestClient 2.0

## ◆ getDataProvider()

DataProvider::AbstractDataProvider CdsRestClient::CdsRestConnection::getDataProvider | ( | *hash< auto > | constructor_options | ) |

returns a data provider object for this connection

Parameters

  constructor_options | any additional constructor options for the data provider

Returns
  a data provider object for this connection

## ◆ getImpl()

CdsRestClient CdsRestClient::CdsRestConnection::getImpl | ( | bool | connect = True,
|  | *hash< auto > | rtopts )
| protected

returns a CdsRestClient object

Parameters

  connect | if True, then the connection is returned already connected
  rtopts | this connection type does not accept any runtime options, so this parameter is ignored

Returns
  a CdsRestClient object

## ◆ getOAuth2OptionName()

string CdsRestClient::CdsRestConnection::getOAuth2OptionName | ( | string | opt | ) |

Returns the OAuth2 option name for this connection.

Since
  CdsRestClient 2.0

## ◆ getOAuth2Options()

hash< auto > CdsRestClient::CdsRestConnection::getOAuth2Options | ( |  | ) |

Returns OAuth2 options in a standard format.

Since
  CdsRestClient 2.0

## ◆ hasDataProvider()

bool CdsRestClient::CdsRestConnection::hasDataProvider | ( |  | ) |

returns True as this connection returns a data provider with the getDataProvider() method

Returns
  True as this connection returns a data provider with the getDataProvider() method

See also
  getDataProvider()

## ◆ isAuthTokenError()

bool CdsRestClient::CdsRestConnection::isAuthTokenError | ( | int | status_code,
|  | hash< auto > | headers,
|  | bool | body_deserialized,
|  | *string | body_content_type,
|  | auto | body )

Returns True if the response was related to an authorization token error.

Returns
  True if the response was related to an authorization token error