UNPKG

backendless

Version:

Backendless JavaScript SDK for Node.js and the browser

538 lines (526 loc) 15.9 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var Urls = /*#__PURE__*/function () { function Urls(app) { (0, _classCallCheck2["default"])(this, Urls); this.app = app; } (0, _createClass2["default"])(Urls, [{ key: "root", value: function root() { if (!this.app.appPath) { throw new Error('Backendless API is not configured, make sure you run Backendless.initApp(...) ' + 'before the operation'); } return this.app.appPath; } // app info }, { key: "appInfo", value: function appInfo() { return "".concat(this.root(), "/info"); } //automations }, { key: "automation", value: function automation() { return "".concat(this.app.automationPath, "/automation"); } }, { key: "automationFlow", value: function automationFlow() { return "".concat(this.automation(), "/flow"); } }, { key: "automationFlowExecutionContext", value: function automationFlowExecutionContext(executionId) { return "".concat(this.automation(), "/flow/execution-context/").concat(executionId); } }, { key: "automationFlowTrigger", value: function automationFlowTrigger() { return "".concat(this.automationFlow(), "/trigger"); } //bl }, { key: "blServices", value: function blServices() { return "".concat(this.root(), "/services"); } }, { key: "blServiceMethod", value: function blServiceMethod(name, method) { return "".concat(this.blServices(), "/").concat(name, "/").concat(method); } }, { key: "blEvent", value: function blEvent(eventName) { return "".concat(this.root(), "/servercode/events/").concat(eventName); } //logging }, { key: "logging", value: function logging() { return "".concat(this.root(), "/log"); } }, { key: "loggingLevels", value: function loggingLevels() { return "".concat(this.logging(), "/logger"); } //cache }, { key: "cache", value: function cache() { return "".concat(this.root(), "/cache"); } }, { key: "cacheItem", value: function cacheItem(key) { return "".concat(this.cache(), "/").concat(key); } }, { key: "cacheItemExpireIn", value: function cacheItemExpireIn(key) { return "".concat(this.cacheItem(key), "/expireIn"); } }, { key: "cacheItemExpireAt", value: function cacheItemExpireAt(key) { return "".concat(this.cacheItem(key), "/expireAt"); } }, { key: "cacheItemCheck", value: function cacheItemCheck(key) { return "".concat(this.cacheItem(key), "/check"); } //counters }, { key: "counters", value: function counters() { return "".concat(this.root(), "/counters"); } }, { key: "countersList", value: function countersList(pattern) { return "".concat(this.counters(), "/").concat(pattern || '*', "/list"); } }, { key: "counter", value: function counter(name) { return "".concat(this.counters(), "/").concat(name); } }, { key: "counterAddAndGet", value: function counterAddAndGet(name) { return "".concat(this.counter(name), "/incrementby/get"); } }, { key: "counterGetAndAdd", value: function counterGetAndAdd(name) { return "".concat(this.counter(name), "/get/incrementby"); } }, { key: "counterIncrementAndGet", value: function counterIncrementAndGet(name) { return "".concat(this.counter(name), "/increment/get"); } }, { key: "counterDecrementAndGet", value: function counterDecrementAndGet(name) { return "".concat(this.counter(name), "/decrement/get"); } }, { key: "counterGetAndDecrement", value: function counterGetAndDecrement(name) { return "".concat(this.counter(name), "/get/decrement"); } }, { key: "counterGetAndIncrement", value: function counterGetAndIncrement(name) { return "".concat(this.counter(name), "/get/increment"); } }, { key: "counterCompareAndSet", value: function counterCompareAndSet(name) { return "".concat(this.counter(name), "/get/compareandset"); } }, { key: "counterReset", value: function counterReset(name) { return "".concat(this.counter(name), "/reset"); } //data }, { key: "data", value: function data() { return "".concat(this.root(), "/data"); } }, { key: "dataGrouping", value: function dataGrouping(className) { return "".concat(this.data(), "/data-grouping/").concat(className); } }, { key: "dataTable", value: function dataTable(tableName) { return "".concat(this.data(), "/").concat(tableName); } }, { key: "dataTableUpsert", value: function dataTableUpsert(tableName) { return "".concat(this.data(), "/").concat(tableName, "/upsert"); } }, { key: "dataTableDeepSave", value: function dataTableDeepSave(tableName) { return "".concat(this.data(), "/").concat(tableName, "/deep-save"); } }, { key: "dataTableFind", value: function dataTableFind(tableName) { return "".concat(this.dataTable(tableName), "/find"); } }, { key: "dataTablePrimaryKey", value: function dataTablePrimaryKey(tableName) { return "".concat(this.dataTable(tableName), "/pk"); } }, { key: "dataTableObject", value: function dataTableObject(tableName, objectId) { return "".concat(this.dataTable(tableName), "/").concat(encodeURIComponent(objectId)); } }, { key: "dataTableObjectRelation", value: function dataTableObjectRelation(tableName, objectId, columnName) { return "".concat(this.dataTableObject(tableName, objectId), "/").concat(columnName); } }, { key: "dataTableCount", value: function dataTableCount(tableName) { return "".concat(this.dataTable(tableName), "/count"); } }, { key: "dataTableProps", value: function dataTableProps(tableName) { return "".concat(this.dataTable(tableName), "/properties"); } }, { key: "dataBulkTable", value: function dataBulkTable(tableName) { return "".concat(this.data(), "/bulk/").concat(tableName); } }, { key: "dataBulkTableUpsert", value: function dataBulkTableUpsert(tableName) { return "".concat(this.data(), "/bulkupsert/").concat(tableName); } }, { key: "dataBulkTableDelete", value: function dataBulkTableDelete(tableName) { return "".concat(this.dataBulkTable(tableName), "/delete"); } }, { key: "dataObjectPermission", value: function dataObjectPermission(tableName, permissionType, objectId) { return "".concat(this.dataTable(tableName), "/permissions/").concat(permissionType, "/").concat(objectId); } }, { key: "dataTableNameById", value: function dataTableNameById(tableId) { return "".concat(this.data(), "/").concat(tableId, "/table-name"); } }, { key: "transactions", value: function transactions() { return "".concat(this.root(), "/transaction/unit-of-work"); } }, { key: "dataHives", value: function dataHives() { return "".concat(this.root(), "/hive"); } }, { key: "dataHive", value: function dataHive(name) { return "".concat(this.dataHives(), "/").concat(name); } }, { key: "hiveStore", value: function hiveStore(name, storeType) { return "".concat(this.dataHive(name), "/").concat(storeType); } }, { key: "messaging", value: function messaging() { return "".concat(this.root(), "/messaging"); } }, { key: "messagingPush", value: function messagingPush() { return "".concat(this.messaging(), "/push"); } }, { key: "messagingPushTemplates", value: function messagingPushTemplates(deviceType) { return "".concat(this.messaging(), "/pushtemplates/").concat(deviceType); } }, { key: "messagingPushWithTemplate", value: function messagingPushWithTemplate(templateName) { return "".concat(this.messagingPush(), "/").concat(templateName); } }, { key: "messagingEmail", value: function messagingEmail() { return "".concat(this.messaging(), "/email"); } }, { key: "messagingChannel", value: function messagingChannel(channel) { return "".concat(this.messaging(), "/").concat(channel); } }, { key: "messagingChannels", value: function messagingChannels() { return "".concat(this.messaging(), "/channels"); } }, { key: "messagingChannelName", value: function messagingChannelName(channelName) { return "".concat(this.messagingChannels(), "/").concat(channelName); } }, { key: "messagingMessage", value: function messagingMessage(messageId) { return "".concat(this.messaging(), "/").concat(messageId); } }, { key: "messagingRegistrations", value: function messagingRegistrations() { return "".concat(this.messaging(), "/registrations"); } }, { key: "messagingRegistrationDevice", value: function messagingRegistrationDevice(deviceId) { return "".concat(this.messagingRegistrations(), "/").concat(deviceId); } }, { key: "emailTemplate", value: function emailTemplate() { return "".concat(this.root(), "/emailtemplate"); } }, { key: "emailTemplateSend", value: function emailTemplateSend() { return "".concat(this.emailTemplate(), "/send"); } //commerce }, { key: "commerce", value: function commerce() { return "".concat(this.root(), "/commerce/googleplay"); } }, { key: "commerceValidate", value: function commerceValidate(name, productId, token) { return "".concat(this.commerce(), "/validate/").concat(name, "/inapp/").concat(productId, "/purchases/").concat(token); } }, { key: "commerceSubCancel", value: function commerceSubCancel(name, subId, token) { return "".concat(this.commerce(), "/").concat(name, "/subscription/").concat(subId, "/purchases/").concat(token, "/cancel"); } }, { key: "commerceSubStatus", value: function commerceSubStatus(name, subId, token) { return "".concat(this.commerce(), "/").concat(name, "/subscription/").concat(subId, "/purchases/").concat(token); } //files }, { key: "files", value: function files() { return "".concat(this.root(), "/files"); } }, { key: "filePath", value: function filePath(path) { return "".concat(this.files(), "/").concat(path); } }, { key: "directoryPath", value: function directoryPath(path) { return "".concat(this.files(), "/").concat(path, "/"); } }, { key: "fileCopy", value: function fileCopy() { return "".concat(this.files(), "/copy"); } }, { key: "fileMove", value: function fileMove() { return "".concat(this.files(), "/move"); } }, { key: "fileRename", value: function fileRename() { return "".concat(this.files(), "/rename"); } }, { key: "filePermissions", value: function filePermissions() { return "".concat(this.files(), "/permissions"); } }, { key: "filePermission", value: function filePermission(type, url) { return "".concat(this.filePermissions(), "/").concat(type, "/").concat(encodeURIComponent(url)); } }, { key: "fileBinaryPath", value: function fileBinaryPath(path) { return "".concat(this.files(), "/binary/").concat(path); } }, { key: "fileAppendPath", value: function fileAppendPath(path) { return "".concat(this.files(), "/append/").concat(path); } }, { key: "fileAppendBinaryPath", value: function fileAppendBinaryPath(path) { return "".concat(this.files(), "/append/binary/").concat(path); } //users }, { key: "users", value: function users() { return "".concat(this.root(), "/users"); } }, { key: "userObject", value: function userObject(objectId) { return "".concat(this.users(), "/").concat(objectId); } }, { key: "userRegister", value: function userRegister() { return "".concat(this.users(), "/register"); } }, { key: "userLogin", value: function userLogin() { return "".concat(this.users(), "/login"); } }, { key: "userLogout", value: function userLogout() { return "".concat(this.users(), "/logout"); } }, { key: "userRoles", value: function userRoles(userId) { return "".concat(this.users(), "/userroles").concat(userId ? "/".concat(userId) : ''); } }, { key: "usersRole", value: function usersRole(roleName) { return "".concat(this.users(), "/role/").concat(roleName); } }, { key: "userRoleOperation", value: function userRoleOperation(operation) { return "".concat(this.users(), "/").concat(operation); } }, { key: "userClassProps", value: function userClassProps() { return "".concat(this.users(), "/userclassprops"); } }, { key: "userRestorePassword", value: function userRestorePassword(identity) { return "".concat(this.users(), "/restorepassword/").concat(encodeURIComponent(identity)); } }, { key: "userTokenCheck", value: function userTokenCheck(token) { return "".concat(this.users(), "/isvalidusertoken/").concat(token); } }, { key: "userVerifyPassowrd", value: function userVerifyPassowrd() { return "".concat(this.users(), "/verifypassowrd"); } }, { key: "userResendConfirmation", value: function userResendConfirmation(identity) { return "".concat(this.users(), "/resendconfirmation/").concat(identity); } }, { key: "userCreateConfirmationURL", value: function userCreateConfirmationURL(identity) { return "".concat(this.users(), "/createEmailConfirmationURL/").concat(identity); } }, { key: "userSocial", value: function userSocial() { return "".concat(this.users(), "/social"); } }, { key: "userSocialOAuth", value: function userSocialOAuth(socialType) { return "".concat(this.userSocial(), "/oauth/").concat(socialType.toLowerCase(), "/request_url"); } }, { key: "userSocialLogin", value: function userSocialLogin(socialType) { return "".concat(this.userSocial(), "/").concat(socialType.toLowerCase(), "/sdk/login"); } }, { key: "userOAuthLogin", value: function userOAuthLogin(providerCode) { return "".concat(this.userSocial(), "/").concat(providerCode.toLowerCase(), "/login"); } }, { key: "userAuthorizationURL", value: function userAuthorizationURL(providerCode) { return "".concat(this.users(), "/oauth/").concat(providerCode.toLowerCase(), "/request_url"); } }, { key: "guestLogin", value: function guestLogin() { return "".concat(this.users(), "/register/guest"); } }, { key: "userStatus", value: function userStatus(userId) { return "".concat(this.userObject(userId), "/status"); } //management }, { key: "management", value: function management() { return "".concat(this.root(), "/management"); } }, { key: "managementData", value: function managementData() { return "".concat(this.management(), "/data"); } }, { key: "managementDataTable", value: function managementDataTable() { return "".concat(this.managementData(), "/table"); } }]); return Urls; }(); exports["default"] = Urls;