Create CommonResourceService and OrderBuilder
[arvados-workbench2.git] / src / common / api / order-builder.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5
6 export default class OrderBuilder {
7     private order: string[] = [];
8
9     addAsc(attribute: string) {
10         this.order.push(`${attribute} asc`);
11         return this;
12     }
13
14     addDesc(attribute: string) {
15         this.order.push(`${attribute} desc`);
16         return this;
17     }
18
19     get() {
20         return `["${this.order.join(`","`)}"]`;
21     }
22 }