include('API_Client');

var BaseInterface = function (api_url) {
    var self = this;

    this.Client = new API_Client(api_url);
    this.Client.default_error_handler = this.error;

    this.add = function (data, handler) {
        this.Client.send_add(data, handler);
    }

    this.edit = function (data, handler) {
        this.Client.send_edit(data, handler);
    }

    this.erase = function (data, handler) {
        this.Client.send_delete(data, handler);
    }

    this.view = function (data, handler) {
        this.Client.send_view(data, handler);
    }

    this.list_content = function (data, handler) {
        this.Client.send_list(data, handler);
    }

    this.show_containers = function (data, handler) {
        this.Client.send_tree(data, handler);
    }

    this.error = function (response) {
        alert(hash(response));
    }

    return this;
}
BaseInterface.prototype = new BaseInterface;
