All files / api/modules scripts.js

100% Statements 7/7
80% Branches 4/5
100% Functions 6/6
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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    2x   3x       1x       1x       2x       2x       1x      
import { apiGet, apiPost } from "../client";
 
export const scriptsApi = {
  actionsList(options) {
    return apiGet("/api/v1/scripts/actions/list", options);
  },
 
  regularList(options) {
    return apiGet("/api/v1/scripts/regular/list", options);
  },
 
  scopesList(options) {
    return apiGet("/api/v1/scripts/scopes/list", options);
  },
 
  runAction(alias, params = {}) {
    return apiPost("/api/v1/scripts/actions/run", { alias, params });
  },
 
  setRegularState(alias, enabled) {
    return apiGet(`/api/v1/scripts/regular/alias/${encodeURIComponent(alias)}/${enabled ? "enable" : "disable"}`);
  },
 
  setScopeState(name, enabled) {
    return apiGet(`/api/v1/scripts/actions/scope/${encodeURIComponent(name)}/${enabled ? "enable" : "disable"}`);
  },
};