|
|
@ -32,13 +32,14 @@ export const API_ACCESS_GOOD = "apiConnected";
|
|
|
|
export const API_ACCESS_BAD = "apiNotConnected";
|
|
|
|
export const API_ACCESS_BAD = "apiNotConnected";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Fipamo Administration API
|
|
|
|
* A can of methods used to edit install settings, navigation pages.
|
|
|
|
* A pocket full of methods used to edit install settings, navigation pages.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
class FipamoAdminAPI {
|
|
|
|
class FipamoAdminAPI {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
* @constructor
|
|
|
|
|
|
|
|
* @param {string} baseURL - url of site; uses local when empty
|
|
|
|
|
|
|
|
* @param {string} key - user api key
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
constructor(baseURL = null, key = null) {
|
|
|
|
constructor(baseURL = null, key = null) {
|
|
|
|
this.percentComplete = 0; //for later
|
|
|
|
this.percentComplete = 0; //for later
|
|
|
@ -58,9 +59,9 @@ class FipamoAdminAPI {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Method for retrieving user authorizing user login
|
|
|
|
* Method for retrieving user authorizing user login
|
|
|
|
|
|
|
|
* @param {object} data - json object that contains data for set up
|
|
|
|
* @property {string} handle - handle for site user
|
|
|
|
* @property {string} handle - handle for site user
|
|
|
|
* @property {string} password - password for site user
|
|
|
|
* @property {string} password - password for site user
|
|
|
|
* @param {object} data - json object that contains data for set up
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
login(data) {
|
|
|
|
login(data) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
@ -108,7 +109,7 @@ class FipamoAdminAPI {
|
|
|
|
syncSettings(data) {
|
|
|
|
syncSettings(data) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(
|
|
|
|
this._request(
|
|
|
|
API_SETTINGS_SYNC,
|
|
|
|
this.baseURL ? this.baseURL + API_SETTINGS_SYNC : API_SETTINGS_SYNC,
|
|
|
|
TASK_SETTINGS_WRITE,
|
|
|
|
TASK_SETTINGS_WRITE,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
@ -131,7 +132,8 @@ class FipamoAdminAPI {
|
|
|
|
publishSite(data) {
|
|
|
|
publishSite(data) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(
|
|
|
|
this._request(
|
|
|
|
API_PUBLISH_PAGES,
|
|
|
|
//API_PUBLISH_PAGES,
|
|
|
|
|
|
|
|
this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES,
|
|
|
|
TASK_PUBLISH_SITE,
|
|
|
|
TASK_PUBLISH_SITE,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
@ -189,7 +191,13 @@ class FipamoAdminAPI {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(url, event, REQUEST_TYPE_POST, content, data)
|
|
|
|
this._request(
|
|
|
|
|
|
|
|
this.baseURL ? this.baseURL + url : url,
|
|
|
|
|
|
|
|
event,
|
|
|
|
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
|
|
|
|
content,
|
|
|
|
|
|
|
|
data
|
|
|
|
|
|
|
|
)
|
|
|
|
.then((result) => {
|
|
|
|
.then((result) => {
|
|
|
|
resolve(result);
|
|
|
|
resolve(result);
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -210,7 +218,7 @@ class FipamoAdminAPI {
|
|
|
|
syncNav(data) {
|
|
|
|
syncNav(data) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(
|
|
|
|
this._request(
|
|
|
|
API_NAV_SYNC,
|
|
|
|
this.baseURL ? this.baseURL + API_NAV_SYNC : API_NAV_SYNC,
|
|
|
|
TASK_SETTINGS_WRITE,
|
|
|
|
TASK_SETTINGS_WRITE,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
@ -232,7 +240,7 @@ class FipamoAdminAPI {
|
|
|
|
sendMail(message) {
|
|
|
|
sendMail(message) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(
|
|
|
|
this._request(
|
|
|
|
API_SEND_MAIL,
|
|
|
|
this.baseURL ? this.baseURL + API_SEND_MAIL : API_SEND_MAIL,
|
|
|
|
TASK_SEND_MAIL,
|
|
|
|
TASK_SEND_MAIL,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
@ -253,7 +261,7 @@ class FipamoAdminAPI {
|
|
|
|
reindexPages(data) {
|
|
|
|
reindexPages(data) {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
this._request(
|
|
|
|
this._request(
|
|
|
|
API_REINDEX_PAGES,
|
|
|
|
this.baseURL ? this.baseURL + API_REINDEX_PAGES : API_REINDEX_PAGES,
|
|
|
|
TASK_REINDEX_PAGE,
|
|
|
|
TASK_REINDEX_PAGE,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
REQUEST_TYPE_POST,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|
CONTENT_TYPE_JSON,
|
|
|
|