UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

45 lines 2.49 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var mongodb_stitch_core_sdk_1 = require("mongodb-stitch-core-sdk"); var Resources_1 = require("./Resources"); var StitchAdminAuth_1 = __importDefault(require("./StitchAdminAuth")); var StitchAdminAuthRoutes_1 = __importDefault(require("./StitchAdminAuthRoutes")); var StitchAdminUserProfile_1 = require("./StitchAdminUserProfile"); var StitchAdminClient = (function () { function StitchAdminClient(baseUrl, transport, requestTimeout) { if (baseUrl === void 0) { baseUrl = StitchAdminClient.defaultServerUrl; } if (transport === void 0) { transport = new mongodb_stitch_core_sdk_1.FetchTransport(); } if (requestTimeout === void 0) { requestTimeout = StitchAdminClient.defaultRequestTimeout; } var requestClient = new mongodb_stitch_core_sdk_1.StitchRequestClient(baseUrl, transport); this.authRoutes = new StitchAdminAuthRoutes_1.default(); this.adminAuth = new StitchAdminAuth_1.default(requestClient, this.authRoutes, new mongodb_stitch_core_sdk_1.MemoryStorage("<admin>")); } StitchAdminClient.prototype.adminProfile = function () { var req = new mongodb_stitch_core_sdk_1.StitchAuthRequest.Builder() .withMethod(mongodb_stitch_core_sdk_1.Method.GET) .withPath(this.authRoutes.profileRoute) .build(); return this.adminAuth.doAuthenticatedRequestWithDecoder(req, new StitchAdminUserProfile_1.StitchAdminUserProfileCodec()); }; StitchAdminClient.prototype.apps = function (groupId) { return new Resources_1.Apps(this.adminAuth, StitchAdminClient.apiPath + "/groups/" + groupId + "/apps"); }; StitchAdminClient.prototype.loginWithCredential = function (credential) { return this.adminAuth.loginWithCredentialInternal(credential); }; StitchAdminClient.prototype.logout = function () { return this.adminAuth.logoutInternal(); }; StitchAdminClient.prototype.close = function () { this.adminAuth.close(); }; StitchAdminClient.apiPath = "/api/admin/v3.0"; StitchAdminClient.defaultServerUrl = "http://localhost:9090"; StitchAdminClient.defaultRequestTimeout = 15.0; return StitchAdminClient; }()); exports.default = StitchAdminClient; //# sourceMappingURL=StitchAdminClient.js.map