summaryrefslogtreecommitdiff
path: root/client/js/models/snapshot_list.js
blob: 9ea1bdd6be4ebc9a7a745be974c13ca2c88e299c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use strict";

const api = require("../api.js");
const uri = require("../util/uri.js");
const AbstractList = require("./abstract_list.js");
const Snapshot = require("./snapshot.js");

class SnapshotList extends AbstractList {
    static search(text, offset, limit) {
        return api
            .get(
                uri.formatApiLink("snapshots", {
                    query: text,
                    offset: offset,
                    limit: limit,
                })
            )
            .then((response) => {
                return Promise.resolve(
                    Object.assign({}, response, {
                        results: SnapshotList.fromResponse(response.results),
                    })
                );
            });
    }
}

SnapshotList._itemClass = Snapshot;
SnapshotList._itemName = "snapshot";

module.exports = SnapshotList;