+ public addIn(field: string, value?: string | string[], resourcePrefix?: string) {
+ return this.addCondition(field, "in", value, "", "", resourcePrefix);
+ }
+
+ public getFilters() {
+ return this.filters;
+ }
+
+ private addCondition(field: string, cond: string, value?: string | string[], prefix: string = "", postfix: string = "", resourcePrefix?: string) {
+ if (value) {
+ value = typeof value === "string"
+ ? `"${prefix}${value}${postfix}"`
+ : `["${value.join(`","`)}"]`;
+
+ const resPrefix = resourcePrefix
+ ? _.snakeCase(resourcePrefix) + "."
+ : "";
+
+ this.filters += `${this.filters ? "," : ""}["${resPrefix}${_.snakeCase(field)}","${cond}",${value}]`;
+ }
+ return this;