Welcome to mirror list, hosted at ThFree Co, Russian Federation.

EnhancedFolder.js « Folder « Model « src - git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cbc6d8fd1c0aa31c180ed74505f9f401202b0d03 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Folder from './Folder';

export default class EnhancedFolder extends Folder {

    /**
     *
     * @param {Object} [data={}]
     * @param {BasicPasswordsClient} api
     */
    constructor(data = {}, api) {
        super(data);
        this._api = api;
    }

    /**
     *
     * @returns {Server}
     */
    getServer() {
        return this._api.getServer();
    }

    /**
     *
     * @returns {Promise<FolderCollection>}
     */
    async fetchRevisions() {
        if(this.getProperty('revisions') === undefined) {
            await this._api.getFolderRepository().findById(this.getId(), 'revisions');
        }

        return this.getProperty('revisions');
    }

    /**
     *
     * @returns {Promise<PasswordCollection>}
     */
    async fetchPasswords() {
        if(this.getProperty('passwords') === undefined) {
            await this._api.getFolderRepository().findById(this.getId(), 'passwords');
        }

        return this.getProperty('passwords');
    }

    /**
     *
     * @returns {Promise<FolderCollection>}
     */
    async fetchFolders() {
        if(this.getProperty('folders') === undefined) {
            await this._api.getFolderRepository().findById(this.getId(), 'folders');
        }

        return this.getProperty('folders');
    }

    /**
     *
     * @returns {Promise<Folder>}
     */
    async fetchParent() {
        if(this.getProperty('parent') === undefined) {
            await this._api.getFolderRepository().findById(this.getId(), 'parent');
        }

        return this.getProperty('parent');
    }
}