Loading...
Searching...
No Matches
ServiceNowRestRecordIterator.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
namespace ServiceNowRestDataProvider {
class ServiceNowRestRecordIterator : public AbstractDataProviderRecordIterator {
public:
private:
ServiceNowRestClient::ServiceNowRestClient rest;
string name;
hash<ServiceNowRestRecordInfo> record_info;
Qore::ListHashIterator i;
public:
constructor(ServiceNowRestClient::ServiceNowRestClient rest, string name,
hash<ServiceNowRestRecordInfo> record_info, *hash<auto> where_cond, *hash<auto> search_options) {
self.rest = rest;
self.name = name;
self.record_info = record_info;
// make query
*string query = makeQuery(where_cond, search_options);
hash<auto> info;
try {
string uri = "table/" + name;
if (query) {
uri += sprintf("?%s", query);
}
i = new ListHashIterator(rest.get(uri, NOTHING, \info).body.response.result);
} catch (hash<ExceptionInfo> ex) {
// ensure that any error response body is included in the exception
hash<auto> ex_arg = {
"query": query,
} + info{"response-code", "response-body"};
throw ex.err, ex.desc, ex_arg;
}
}
bool valid();
bool next();
hash<auto> getValue();
auto memberGate(string key);
/*
#! Returns "or" clauses
string getOrClause(list<auto> arglist) {
list<auto> l = map $1, (map doWhereExpression($1), arglist), $1;
return l ? (foldl $1 + "^OR" + $2, l) : "";
}
*/
*string makeQuery(*hash<DataProviderExpression> where_cond, *hash<auto> search_options);
*hash<string, DataProvider::AbstractDataField> getRecordType();
protected:
string getOrderBy(softlist<string> coll);
public:
protected:
bool checkColumnName(string col);
public:
protected:
string getColumnNames(*softlist<auto> column_names);
public:
protected:
string doWhereExpression(hash<DataProviderExpression> where_cond, *hash<auto> search_options);
public:
protected:
string doWhereExpressionIntern(hash<DataProviderExpression> arg);
public:
protected:
string doWhereExpression(auto arg);
public:
protected:
string getArgValue(string key, auto value);
public:
};
};
Qore::ListHashIterator
ServiceNowRestDataProvider::ServiceNowRestRecordIterator
Defines the record iterator class for Table-based iterators.
Definition: ServiceNowRestRecordIterator.qc.dox.h:28
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::constructor
constructor(ServiceNowRestClient::ServiceNowRestClient rest, string name, hash< ServiceNowRestRecordInfo > record_info, *hash< auto > where_cond, *hash< auto > search_options)
creates the iterator
Definition: ServiceNowRestRecordIterator.qc.dox.h:54
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::next
bool next()
Increments the row pointer when retrieving rows from a select statement; returns True if there is a r...
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::getValue
hash< auto > getValue()
Returns a single record if the iterator is valid.
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::makeQuery
*string makeQuery(*hash< DataProviderExpression > where_cond, *hash< auto > search_options)
Returns the filter for a request.
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::name
string name
current object name
Definition: ServiceNowRestRecordIterator.qc.dox.h:37
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::valid
bool valid()
Returns True if the iterator is valid.
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::rest
ServiceNowRestClient::ServiceNowRestClient rest
The REST client object for API calls.
Definition: ServiceNowRestRecordIterator.qc.dox.h:34
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::getRecordType
*hash< string, DataProvider::AbstractDataField > getRecordType()
Returns the record description, if available.
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::i
Qore::ListHashIterator i
record iterator
Definition: ServiceNowRestRecordIterator.qc.dox.h:43
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::record_info
hash< ServiceNowRestRecordInfo > record_info
Record info for the entity.
Definition: ServiceNowRestRecordIterator.qc.dox.h:40
ServiceNowRestDataProvider::ServiceNowRestRecordIterator::memberGate
auto memberGate(string key)
Returns the value of the given field in the current row, if the iterator is valid.
ServiceNowRestDataProvider
Qore ServiceNowRestDataProvider module definition.
Definition: ServiceNowRestDataProvider.qc.dox.h:26