UNPKG

@cpanel/api

Version:

cPanel API JavaScript and TypeScript interface libraries. This library provides a set of classes for calling cPanel WHM API 1 and UAPI calls. The classes hide much of the complexity of these APIs behind classes the abstract the underlying variances betwee

103 lines 3.73 kB
// MIT License // // Copyright 2021 cPanel L.L.C. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. /** * The filter operator defines the rule used to compare data in a column with the passed-in value. It * behaves something like: * * const value = 1; * data.map(item => item[column]) * .filter(itemValue => operator(itemValue, value)); * * where item is the data from the column */ export var FilterOperator; (function (FilterOperator) { /** * String contains value */ FilterOperator[FilterOperator["Contains"] = 0] = "Contains"; /** * String begins with value */ FilterOperator[FilterOperator["Begins"] = 1] = "Begins"; /** * String ends with value */ FilterOperator[FilterOperator["Ends"] = 2] = "Ends"; /** * String matches pattern in value */ FilterOperator[FilterOperator["Matches"] = 3] = "Matches"; /** * Column value equals value */ FilterOperator[FilterOperator["Equal"] = 4] = "Equal"; /** * Column value not equal value */ FilterOperator[FilterOperator["NotEqual"] = 5] = "NotEqual"; /** * Column value is less than value */ FilterOperator[FilterOperator["LessThan"] = 6] = "LessThan"; /** * Column value is less than value using unlimited rules. */ FilterOperator[FilterOperator["LessThanUnlimited"] = 7] = "LessThanUnlimited"; /** * Column value is greater than value. */ FilterOperator[FilterOperator["GreaterThan"] = 8] = "GreaterThan"; /** * Column value is greater than value using unlimited rules. */ FilterOperator[FilterOperator["GreaterThanUnlimited"] = 9] = "GreaterThanUnlimited"; /** * Column value is defined. Value is ignored in this case. */ FilterOperator[FilterOperator["Defined"] = 10] = "Defined"; /** * Column value is undefined. Value is ignored in this case. */ FilterOperator[FilterOperator["Undefined"] = 11] = "Undefined"; })(FilterOperator || (FilterOperator = {})); /** * Defines a filter request for a Api call. */ export class Filter { /** * Construct a new Filter object. * * @param column Column name requests. Must be non-empty and exist on the related backend collection. * @param operator Comparison operator to use when applying the filter. * @param value Value to compare the columns value too. */ constructor(column, operator, value) { if (!column) { throw new Error("You must define a non-empty column name."); } this.column = column; this.operator = operator; this.value = value; } } //# sourceMappingURL=filter.js.map