UNPKG

baasic-sdk-javascript

Version:

JavaScript SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

79 lines (78 loc) 3.88 kB
"use strict"; /* globals module */ /** * @module userSocialLoginClient * @description User Social Login Client provides an easy way to consume User REST API end-points. In order to obtain needed routes `userSocialLoginClient` uses `userSocialLoginRoute`. */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var inversify_1 = require("inversify"); ; var httpApi_1 = require("../../httpApi"); var _1 = require("./"); var UserSocialLoginClient = /** @class */ (function () { function UserSocialLoginClient(userSocialLoginRoute, apiClient) { this.userSocialLoginRoute = userSocialLoginRoute; this.apiClient = apiClient; } Object.defineProperty(UserSocialLoginClient.prototype, "routeDefinition", { /** * Provides direct access to `userSocialLoginRoute`. * @method * @example userSocialLoginClient.routeDefinition.get().expand(expandObject); **/ get: function () { return this.userSocialLoginRoute; }, enumerable: true, configurable: true }); /** * Returns a promise that is resolved once the get action has been performed. Success response returns a list user resource connected social login providers. * @param username A username or id which uniquely identifies user resource whose social login connections need to be retrieved. * @returns A promise that is resolved once the get action has been performed. * @method * @example userSocialLoginClient.get('<username>') .then(function (collection) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ UserSocialLoginClient.prototype.get = function (username) { return this.apiClient.get(this.routeDefinition.get(username)); }; /** * Returns a promise that is resolved once the remove action has been performed. This action removes the user resource social login connection from the specified provider. * @param username A username or id which uniquely identifies user resource whose social login connection needs to be removed. * @param provider A value which uniquely identifies provider from which the user resource needs to be disconnected. * @returns A promise that is resolved once the remove action has been performed. * @method * @example userSocialLoginClient.remove('<username>', '<provider>') .then(function (collection) { // perform success action here }, function (response, status, headers, config) { // perform error handling here }); **/ UserSocialLoginClient.prototype.remove = function (username, provider) { return this.apiClient.delete(this.userSocialLoginRoute.remove(username, provider)); }; UserSocialLoginClient = tslib_1.__decorate([ inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(_1.TYPES.UserSocialLoginRoute)), tslib_1.__param(1, inversify_1.inject(httpApi_1.httpTYPES.ApiClient)), tslib_1.__metadata("design:paramtypes", [_1.UserSocialLoginRoute, httpApi_1.ApiClient]) ], UserSocialLoginClient); return UserSocialLoginClient; }()); exports.UserSocialLoginClient = UserSocialLoginClient; /** * @overview ***Notes:** - Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points. - All end-point objects are transformed by the associated route definition. */