Qore ServiceNowRestDataProvider Module Reference 1.2
Loading...
Searching...
No Matches
ServiceNowRestRecordIterator.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
28class ServiceNowRestRecordIterator : public AbstractDataProviderRecordIterator {
29
30public:
31
32private:
35
37 string name;
38
40 hash<ServiceNowRestRecordInfo> record_info;
41
44
45public:
46
48
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
129protected:
130 string getOrderBy(softlist<string> coll);
131public:
132
133
134protected:
135 bool checkColumnName(string col);
136public:
137
138
139protected:
140 string getColumnNames(*softlist<auto> column_names);
141public:
142
143
144protected:
145 string doWhereExpression(hash<DataProviderExpression> where_cond, *hash<auto> search_options);
146public:
147
148
149protected:
150 string doWhereExpressionIntern(hash<DataProviderExpression> arg);
151public:
152
153
154protected:
155 string doWhereExpression(auto arg);
156public:
157
158
159protected:
160 string getArgValue(string key, auto value);
161public:
162
163};
164};
*string get(string path, *hash< auto > headers, *reference< hash< auto > > info)
Defines the record iterator class for Table-based iterators.
Definition: ServiceNowRestRecordIterator.qc.dox.h:28
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
bool next()
Increments the row pointer when retrieving rows from a select statement; returns True if there is a r...
hash< auto > getValue()
Returns a single record if the iterator is valid.
*string makeQuery(*hash< DataProviderExpression > where_cond, *hash< auto > search_options)
Returns the filter for a request.
string name
current object name
Definition: ServiceNowRestRecordIterator.qc.dox.h:37
bool valid()
Returns True if the iterator is valid.
ServiceNowRestClient::ServiceNowRestClient rest
The REST client object for API calls.
Definition: ServiceNowRestRecordIterator.qc.dox.h:34
*hash< string, DataProvider::AbstractDataField > getRecordType()
Returns the record description, if available.
Qore::ListHashIterator i
record iterator
Definition: ServiceNowRestRecordIterator.qc.dox.h:43
hash< ServiceNowRestRecordInfo > record_info
Record info for the entity.
Definition: ServiceNowRestRecordIterator.qc.dox.h:40
auto memberGate(string key)
Returns the value of the given field in the current row, if the iterator is valid.
Qore ServiceNowRestDataProvider module definition.
Definition: ServiceNowRestDataProvider.qc.dox.h:26