$darkmode

| Qore ServiceNowRestDataProvider Module Reference 1.2

ServiceNowRestRecordIterator.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
26 namespace ServiceNowRestDataProvider {
28 class ServiceNowRestRecordIterator : public AbstractDataProviderRecordIterator {
29
30 public:
31
32 private:
34 ServiceNowRestClient::ServiceNowRestClient rest;
35
37 string name;
38
40 hash<ServiceNowRestRecordInfo> record_info;
41
43 Qore::ListHashIterator i;
44
45 public:
46
48
54 constructor(ServiceNowRestClient::ServiceNowRestClient rest, string name,
55 hash<ServiceNowRestRecordInfo> record_info, *hash<auto> where_cond, *hash<auto> search_options) {
56 self.rest = rest;
57 self.name = name;
58 self.record_info = record_info;
59
60 // make query
61 *string query = makeQuery(where_cond, search_options);
62 hash<auto> info;
63 try {
64 string uri = "table/" + name;
65 if (query) {
66 uri += sprintf("?%s", query);
67 }
68 i = new ListHashIterator(rest.get(uri, NOTHING, \info).body.response.result);
69 } catch (hash<ExceptionInfo> ex) {
70 // ensure that any error response body is included in the exception
71 hash<auto> ex_arg = {
72 "query": query,
73 } + info{"response-code", "response-body"};
74 throw ex.err, ex.desc, ex_arg;
75 }
76 }
77
79
82 bool valid();
83
84
86
92 bool next();
93
94
96
98 hash<auto> getValue();
99
100
102
108 auto memberGate(string key);
109
110
111 /*
112 #! Returns "or" clauses
113 string getOrClause(list<auto> arglist) {
114 list<auto> l = map $1, (map doWhereExpression($1), arglist), $1;
115 return l ? (foldl $1 + "^OR" + $2, l) : "";
116 }
117 */
118
120 *string makeQuery(*hash<DataProviderExpression> where_cond, *hash<auto> search_options);
121
122
124
126 *hash<string, DataProvider::AbstractDataField> getRecordType();
127
128
129 protected:
130 string getOrderBy(softlist<string> coll);
131 public:
132
133
134 protected:
135 bool checkColumnName(string col);
136 public:
137
138
139 protected:
140 string getColumnNames(*softlist<auto> column_names);
141 public:
142
143
144 protected:
145 string doWhereExpression(hash<DataProviderExpression> where_cond, *hash<auto> search_options);
146 public:
147
148
149 protected:
150 string doWhereExpressionIntern(hash<DataProviderExpression> arg);
151 public:
152
153
154 protected:
155 string doWhereExpression(auto arg);
156 public:
157
158
159 protected:
160 string getArgValue(string key, auto value);
161 public:
162
163};
164};
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.
NOTHING
const NOTHING
sprintf
string sprintf(string fmt,...)
ServiceNowRestDataProvider
Qore ServiceNowRestDataProvider module definition.
Definition: ServiceNowRestDataProvider.qc.dox.h:26