1 /* newslash-admin.js */
4 var nsAdmin = new Newslash({ baseUrl: '/api/v1/admin', });
5 Newslash.prototype.admin = nsAdmin;
8 nsAdmin.exportFeeds = function exportFeeds() {
9 return this.get("/repository/export?target=feeds");
12 nsAdmin.importFeeds = function importFeeds() {
13 return this.get("/repository/import?target=feeds");
16 nsAdmin.exportBoxes = function exportBoxes() {
17 return this.get("/repository/export?target=boxes");
20 nsAdmin.importBoxes = function importBoxes() {
21 return this.get("/repository/import?target=boxes");
25 nsAdmin.getBlockedItems = function getBlockedItems(type) {
26 return this.get("/blocking?type=" + type);
29 nsAdmin.blockItem = function blockItem(type, id) {
30 return this.post("/blocking", {action: "block", type: type, id: id});
33 nsAdmin.unblockItem = function blockItem(type, id) {
34 return this.post("/blocking", {action: "unblock", type: type, id: id});
38 nsAdmin.updateBox = function createBox(params) {
39 if (!params) return this.fail();
41 params.action = "update";
43 params.action = "create";
45 return this.post("/sidebar", params);
48 nsAdmin.deleteBox = function deleteBox(id) {
49 if (!id) return this.fail();
50 return this.post("/sidebar", { action: "delete", id: id });
53 nsAdmin.getBoxes = function getBoxes() {
54 return this.get("/sidebar");
57 nsAdmin.getBoxById = function getBoxById(id) {
58 if (!id) return this.fail();
59 return this.get("/sidebar?id=" + id);
63 nsAdmin.getADCodes = function getADCodes() {
64 return this.get("/ad/code");
67 nsAdmin.getADCodeById = function getADCodeById(id) {
68 if (!id) return this.fail();
69 return this.get("/ad/code?id=" + id);
72 nsAdmin.updateADCodes = function createADCode(params) {
73 if (!params) return this.fail();
75 params.action = "update";
77 params.action = "create";
79 return this.post("/ad/code", params);
82 nsAdmin.deleteADCodes = function deleteADCode(id) {
83 if (!id) return this.fail();
84 return this.post("/ad/code", { action: "delete", id: id });