UNPKG

@wireapp/api-client

Version:

Wire API Client to send and receive data.

56 lines (55 loc) 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ConnectionAPI = (function () { function ConnectionAPI(client) { this.client = client; } Object.defineProperty(ConnectionAPI, "URL", { get: function () { return { CONNECTIONS: '/connections', }; }, enumerable: true, configurable: true }); ConnectionAPI.prototype.getConnection = function (userId) { var config = { method: 'get', url: ConnectionAPI.URL.CONNECTIONS + "/" + userId, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; ConnectionAPI.prototype.getConnections = function (limit, connectionId) { if (limit === void 0) { limit = 100; } var config = { method: 'get', params: { size: limit, }, url: ConnectionAPI.URL.CONNECTIONS, }; if (connectionId) { config.params.start = connectionId; } return this.client.sendJSON(config).then(function (response) { return response.data; }); }; ConnectionAPI.prototype.postConnection = function (connectionRequestData) { var config = { data: connectionRequestData, method: 'post', url: ConnectionAPI.URL.CONNECTIONS, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; ConnectionAPI.prototype.putConnection = function (updatedConnection) { var config = { data: updatedConnection, method: 'put', url: ConnectionAPI.URL.CONNECTIONS, }; return this.client.sendJSON(config).then(function (response) { return response.data; }); }; return ConnectionAPI; }()); exports.ConnectionAPI = ConnectionAPI;