@octopusx/ndk
Version:
octopus x sdk to connect to the octopusx grids and services
146 lines (145 loc) • 6.6 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const requests_1 = require("../utils/requests");
class Profile {
constructor(options) {
this.options = options;
this.options.url = process.env.OCX_PROFILE_BASE_URL || process.env.VUE_APP_OCX_PROFILE_BASE_URL;
}
createProfileType(data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileType/add`;
return requests_1.default(`POST`, url, requestOptions);
});
}
getProfileTypes() {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileType`;
return requests_1.default(`GET`, url, requestOptions);
});
}
getSingleProfile(profileId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileType/${profileId}`;
return requests_1.default(`GET`, url, requestOptions);
});
}
updateProfileType(profileId, data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileType/${profileId}`;
return requests_1.default(`PUT`, url, requestOptions);
});
}
deleteProfileType(profileId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileType/${profileId}`;
return requests_1.default(`DELETE`, url, requestOptions);
});
}
createProfileRecords(data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileRecord/add`;
return requests_1.default(`POST`, url, requestOptions);
});
}
getProfileRecords() {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileRecord`;
return requests_1.default(`GET`, url, requestOptions);
});
}
getSingleProfileRecord(profileRecordId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileRecord/${profileRecordId}`;
return requests_1.default(`GET`, url, requestOptions);
});
}
updateProfileRecord(profileRecordId, data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileRecord/${profileRecordId}`;
return requests_1.default(`PUT`, url, requestOptions);
});
}
deleteProfileRecord(profileRecordId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileRecord/${profileRecordId}`;
return requests_1.default(`DELETE`, url, requestOptions);
});
}
createProfileFields(data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileField/add`;
return requests_1.default(`POST`, url, requestOptions);
});
}
getProfileFields() {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileField`;
return requests_1.default(`GET`, url, requestOptions);
});
}
getSingleProfileField(profileFieldId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileField/${profileFieldId}`;
return requests_1.default(`GET`, url, requestOptions);
});
}
updateProfileField(profileFieldId, data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileField/${profileFieldId}`;
return requests_1.default(`PUT`, url, requestOptions);
});
}
deleteProfileField(profileFieldId) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileField/${profileFieldId}`;
return requests_1.default(`DELETE`, url, requestOptions);
});
}
createProfileData(data) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign(Object.assign({}, this.options), { data });
const url = `ProfileData/add/profiledata`;
return requests_1.default(`POST`, url, requestOptions);
});
}
getAllProfileData() {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileData`;
return requests_1.default(`GET`, url, requestOptions);
});
}
setupProfile() {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = Object.assign({}, this.options);
const url = `ProfileSetup`;
return requests_1.default(`GET`, url, requestOptions);
});
}
}
exports.default = Profile;