Object.defineProperty(exports, "__esModule", { value: true });
var axios_1 = require("axios");
module.exports = function (actionAPI) {
    actionAPI.handle(function (properties, status) {
        var connectionID = properties.connectionID != undefined && properties.connectionID.length > 0
            ? properties.connectionID
            : 'none';
        if (connectionID != 'none') {
            var connection = actionAPI.getConnection('zoom-bridge', connectionID);
            axios_1.default
                .get("http://".concat(connection.properties.ip, ":").concat(connection.properties.port, "/v1/actions/screenshot"))
                .then(function () {
                status('Action completed');
            })
                .catch(function () {
                status('Unable to reach Zoom-Bridge');
            });
        }
        else
            status('No connection specified', 'error');
    });
    actionAPI.onOpenEditor(function (editorAPI, properties) {
        var connectionID = properties.connectionID != undefined && properties.connectionID.length > 0
            ? properties.connectionID
            : 'none';
        var connectionField = {
            id: 'connectionID',
            name: 'connection',
            type: 'connection',
            connectionType: 'zoom-bridge',
            value: connectionID
        };
        editorAPI.onFieldChanges(function (fields) {
            var values = editorAPI.tools.objectifyFieldsValues(fields);
            editorAPI.saveProperties({ connectionID: values.connectionID });
        });
        editorAPI.setFields([
            connectionField
        ]);
    });
};
//# sourceMappingURL=screenshot.js.map