UNPKG

@wireapp/api-client

Version:

Wire API Client to send and receive data.

125 lines (124 loc) 4.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SelfAPI = (function () { function SelfAPI(client) { this.client = client; } Object.defineProperty(SelfAPI, "URL", { get: function () { return { EMAIL: 'email', HANDLE: 'handle', LOCALE: 'locale', NAME: 'name', PASSWORD: 'password', PHONE: 'phone', SEARCHABLE: 'searchable', SELF: '/self', }; }, enumerable: true, configurable: true }); SelfAPI.prototype.deleteEmail = function () { var config = { method: 'delete', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.EMAIL, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.deletePhone = function () { var config = { method: 'delete', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.PHONE, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.deleteSelf = function (deleteData) { var config = { data: deleteData, method: 'delete', url: SelfAPI.URL.SELF, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.getName = function () { var config = { method: 'get', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.NAME, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.getSearchable = function () { var config = { method: 'get', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.SEARCHABLE, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.getSelf = function () { var config = { method: 'get', url: SelfAPI.URL.SELF, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putEmail = function (emailData) { var config = { data: emailData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.EMAIL, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putHandle = function (handleData) { var config = { data: handleData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.HANDLE, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putLocale = function (localeData) { var config = { data: localeData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.LOCALE, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putPassword = function (passwordData) { var config = { data: passwordData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.PASSWORD, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putPhone = function (phoneData) { var config = { data: phoneData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.PHONE, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; SelfAPI.prototype.putSearchable = function (statusData) { var config = { data: statusData, method: 'put', url: SelfAPI.URL.SELF + "/" + SelfAPI.URL.SEARCHABLE, }; return this.client.sendJSON(config).then(function () { return ({}); }); }; SelfAPI.prototype.putSelf = function (profileData) { var config = { data: profileData, method: 'put', url: SelfAPI.URL.SELF, }; return this.client.sendJSON(config).then(function () { return ({}); }); }; return SelfAPI; }()); exports.SelfAPI = SelfAPI;