All Classes Files Functions Variables Enumerations Enumerator Groups Pages
SharedStructures.idl
Go to the documentation of this file.
1 /**
2  * @file SharedStructures.idl
3  * @brief Shared data structures without an interface
4  *
5  * @author Dusan Juhas
6  *
7  * Copyright © 2017 Kerio Technologies s.r.o.
8  */
9 
10 module kerio {
11 module web {
12 
13 /**
14  * Type for lists of strings.
15  */
16 typedef sequence<string> StringList;
17 
18 /**
19  * Type for lists of integers.
20  */
21 typedef sequence<long> IntegerList;
22 
23 /**
24  * Name-value pair
25  * Note: all fields must be assigned if used in set methods
26  */
27 struct NamedValue {
28  string name;
29  string value;
30 };
31 
32 /**
33  * List of name-value pairs
34  */
35 typedef sequence<NamedValue> NamedValueList;
36 
37 /**
38  * Name-multivalue pair
39  * Note: all fields must be assigned if used in set methods
40  */
42  string name;
43  StringList value;
44 };
45 
46 /**
47  * List of name-multivalue pairs
48  */
49 typedef sequence<NamedMultiValue> NamedMultiValueList;
50 
51 /**
52  * global object identification
53  */
54 typedef string KId;
55 /**
56  * list of global object identifiers
57  */
58 typedef sequence<KId> KIdList;
59 
60 /**
61  * Sorting Direction
62  */
63 enum SortDirection {
64  Asc, ///< ascending order
65  Desc ///< descending order
66 };
67 
68 /**
69  * Simple Query Operator
70  */
71 enum CompareOperator {
72  Eq, ///< '=' - equal
73  NotEq, ///< '<>' - not equal
74  LessThan, ///< '<' - lower that
75  GreaterThan,///< '>' - greater that
76  LessEq, ///< '<=' - lower or equal
77  GreaterEq, ///< '>=' - greater or equal
78  Like ///< contains substring, % is wild character
79 };
80 
81 /**
82  * Compound Operator
83  */
84 enum LogicalOperator {
85  Or,
86  And
87 };
88 
89 /**
90  * A Part of a Condition
91  */
92 struct SubCondition {
93  string fieldName; ///< left side of condition
94  CompareOperator comparator; ///< middle of condition
95  string value; ///< right side of condition
96 };
97 
98 /**
99  * A Complete Condition
100  */
101 typedef sequence<SubCondition> SubConditionList;
102 
103 /**
104  * Sorting Order
105  */
106 struct SortOrder {
107  string columnName;
108  SortDirection direction;
109  boolean caseSensitive;
110 };
111 
112 /**
113  * List of Sorting Orders
114  */
115 typedef sequence<SortOrder> SortOrderList;
116 
117 /**
118  * General Query for Searching
119  *
120  *
121  * Query substitution (quicksearch):
122  *
123  * SearchQuery doesn't support complex queries, only queries
124  * with all AND operators (or all OR operators) are supported.
125  * Combination of AND and OR is not allowed. This limitation is for special cases solved by using
126  * substitution of complicated query-part by simple condition.
127  *
128  * Only the quicksearch is currently implemented and only in "Users::get()" method.
129  *
130  * Behavior of quicksearch in Users::get():
131  *
132  * QUICKSEACH = "x" is equal to: (loginName = "x") OR (fullName = "x")
133  *
134  * QUICKSEACH LIKE "x*" is equal to: (loginName LIKE "x*") OR (fullName LIKE "x*")
135  *
136  * QUICKSEACH <> "x" is equal to: (loginName <> "x") AND (fullName <> "x")
137  *
138  */
139 struct SearchQuery {
140  StringList fields; ///< empty = give me all fields, applicable constants: ADD_USERS, LIST_USERS
141  SubConditionList conditions; ///< empty = without condition
142  LogicalOperator combining; ///< the list of conditions can be either combined by 'ORs' or 'ANDs'
143  long start; ///< how many items to skip before filling a result list (0 means skip none)
144  long limit; ///< how many items to put to a result list (if there are enough items); applicable constant: Unlimited
145  SortOrderList orderBy;
146 };
147 
148 /**
149  * Message can contain replacement marks: { "User %1 cannot be deleted.", ["jsmith"], 1 }
150  */
152  string message; ///< text with placeholders %1, %2, etc., e.g. "User %1 cannot be deleted."
153  StringList positionalParameters; ///< additional strings to replace the placeholders in message (first string replaces %1 etc.)
154  long plurality; ///< count of items, used to distinguish among singular/paucal/plural; 1 for messages with no counted items
155 };
156 
157 typedef sequence<LocalizableMessage> LocalizableMessageList;
158 
159 /**
160  * error structure to be used when manipulating with globally addressable list items
161  */
163  KId id; ///< entity KId, can be user, group, alias, ML...
164  LocalizableMessage errorMessage;
165 };
166 
167 typedef sequence<ManipulationError> ManipulationErrorList;
168 
169 /**
170  * A kind of restriction
171  */
172 enum RestrictionKind {
173  Regex, ///< regular expression
174  ByteLength, ///< maximal length in Bytes
175  ForbiddenNameList, ///< list of denied exact names due to filesystem or KMS store
176  ForbiddenPrefixList, ///< list of denied preffixes due to filesystem or KMS store
177  ForbiddenSuffixList, ///< list of denied suffixes due to filesystem or KMS store
178  ForbiddenCharacterList ///< list of denied characters
179 };
180 
181 /**
182  * Item of the Entity; used in restrictions
183  */
184 enum ItemName {
185  Name, ///< Entity Name
186  Description, ///< Entity Description
187  Email, ///< Entity Email Address
188  FullName, ///< Entity Full Name
189  TimeItem, ///< Entity Time - it cannot be simply Time because of C++ conflict - see bug 34684 comment #3
190  DateItem, ///< Entity Date - I expect same problem with Date as with Time
191  DomainName ///< differs from name (eg. cannot contains underscore)
192 };
193 
194 /**
195  * Units used for handling large values of bytes.
196  * See also userinfo.idl: enum UserValueUnits.
197  */
198 enum ByteUnits {
199  Bytes,
200  KiloBytes,
201  MegaBytes,
202  GigaBytes,
203  TeraBytes,
204  PetaBytes
205 };
206 
207 /**
208  * Stores size of very large values of bytes e.g. for user quota
209  * Note: all fields must be assigned if used in set methods
210  */
212  long value;
213  ByteUnits units;
214 };
215 
216 /**
217  * Settings of size limit
218  * Note: all fields must be assigned if used in set methods
219  */
220 struct SizeLimit {
221  boolean isActive;
222  ByteValueWithUnits limit;
223 };
224 
225 /**
226  * Result of the add operation
227  */
228 struct AddResult {
229  KId id; ///< purposely not id - loginName is shown
230  boolean success; ///< was operation successful? if yes so id is new id for this item else errorMessage tells why it failed
231  LocalizableMessage errorMessage; ///< contains number of recovered user messages or error message
232 };
233 
234 /**
235  * list of add operation results
236  */
237 typedef sequence<AddResult> AddResultList;
238 
239 typedef string IpAddress;
240 typedef sequence<IpAddress> IpAddressList;
241 
242 /**
243  * Status of entry in persistent manager
244  */
245 enum StoreStatus {
246  StoreStatusClean, ///< already present in configuration store
247  StoreStatusModified, ///< update waiting for apply()
248  StoreStatusNew ///< added to manager but not synced to configuration store
249 };
250 
251 /**
252  * When using start and limit to only get a part of all results
253  * (e.g. only 20 users, skipping the first 40 users),
254  * use this special limit value for unlimited count
255  * (of course the service still respects the value of start).
256  *
257  * Note that each service is allowed to use its safety limit
258  * (such as 50,000) to prevent useless overload.
259  * The limits are documented per-service or per-method.
260  *
261  * Implementation note: Some source code transformations may lead to signed long, i.e. 4294967295.
262  * But the correct value is -1.
263  */
264 const long Unlimited = -1;
265 
266 /**
267  * Date and Time - should be used instead of time_t, where time zones can affect time interpretation
268  * Note: all fields must be assigned if used in set methods
269  */
270 struct Time {
271  long hour; ///< 0-23
272  long min; ///< 0-59
273 };
274 
275 /**
276  *
277  * Note: all fields must be assigned if used in set methods
278  */
279 struct Date {
280  long year;
281  long month; ///< 0-11
282  long day; ///< 1-31 max day is limited by month
283 };
284 
285 /**
286  * A string that can be switched on/off. String is meaningful only if switched on.
287  * Note: all fields must be assigned if used in set methods
288  */
290  boolean enabled;
291  string value;
292 };
293 
294 /**
295  *
296  * Note: all fields must be assigned if used in set methods
297  */
298 struct OptionalLong {
299  boolean enabled;
300  long value;
301 };
302 
303 /**
304  * IP Address Group / Time Range / ... that can be switched on/off
305  * Note: all fields must be assigned if used in set methods
306  */
308  boolean enabled;
309  KId id; ///< global identifier
310  string name;
311 };
312 
313 /**
314  * Message can contain replacement marks: { "User %1 cannot be deleted.", ["jsmith"], 1 }.
315  * This is the parameters structure.
316  */
318  StringList positionalParameters; ///< additional strings to replace the placeholders in message (first string replaces %1 etc.)
319  long plurality; ///< count of items, used to distinguish among singular/paucal/plural; 1 for messages with no counted items
320 };
321 
322 /**
323  * Error details regarding a particular item, e.g. one of users that could not be updated or removed.
324  */
325 struct Error {
326  long inputIndex; ///< 0-based index to input array, e.g. 3 means that the relates to the 4th element of the input parameter array
327  long code; ///< -32767..-1 (JSON-RPC) or 1..32767 (application)
328  string message; ///< text with placeholders %1, %2, etc., e.g. "User %1 cannot be deleted."
329  LocalizableMessageParameters messageParameters; ///< strings to replace placeholders in message, and message plurality.
330 };
331 typedef sequence<Error> ErrorList;
332 
333 exception ApiException {
334  string message; ///< text with placeholders %1, %2
335  long code; ///< -32767..-1 (JSON-RPC) or 1..32767 (application)
336  LocalizableMessageParameters messageParameters; ///< strings to replace placeholders in message, and message plurality.
337 };
338 
339 /**
340  * important information about download
341  */
342 struct Download {
343  string url; ///< download url
344  string name; ///< filename
345  long length; ///< file size in bytes
346 };
347 
348 /**
349  * Details about a particular item created.
350  */
351 struct CreateResult {
352  long inputIndex; ///< 0-based index to input array, e.g. 3 means that the relates to the 4th element of the input parameter array
353  KId id; ///< ID of created item.
354 };
355 
356 typedef sequence<CreateResult> CreateResultList;
357 
358 /**
359  * Type for date/time representation
360  */
361 typedef long DateTimeStamp;
362 
363 /**
364  * Describes client (third-party) application or script which uses the Administration API.
365  */
367  string name; ///< E.g. "Simple server monitor"
368  string vendor; ///< E.g. "MyScript Ltd."
369  string version; ///< E.g. "1.0.0 beta 1"
370 };
371 
372 /**
373  * Credentials contains userName and password
374  */
375 struct Credentials {
376  string userName; ///< UserName
377  string password; ///< Password
378 };
379 
380 }; // module web
381 }; // module kerio