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)

40 lines 2.09 kB
import { FetchTransport, MemoryStorage, Method, StitchAuthRequest, StitchRequestClient } from "mongodb-stitch-core-sdk"; import { Apps } from "./Resources"; import StitchAdminAuth from "./StitchAdminAuth"; import StitchAdminAuthRoutes from "./StitchAdminAuthRoutes"; import { StitchAdminUserProfileCodec } from "./StitchAdminUserProfile"; var StitchAdminClient = (function () { function StitchAdminClient(baseUrl, transport, requestTimeout) { if (baseUrl === void 0) { baseUrl = StitchAdminClient.defaultServerUrl; } if (transport === void 0) { transport = new FetchTransport(); } if (requestTimeout === void 0) { requestTimeout = StitchAdminClient.defaultRequestTimeout; } var requestClient = new StitchRequestClient(baseUrl, transport); this.authRoutes = new StitchAdminAuthRoutes(); this.adminAuth = new StitchAdminAuth(requestClient, this.authRoutes, new MemoryStorage("<admin>")); } StitchAdminClient.prototype.adminProfile = function () { var req = new StitchAuthRequest.Builder() .withMethod(Method.GET) .withPath(this.authRoutes.profileRoute) .build(); return this.adminAuth.doAuthenticatedRequestWithDecoder(req, new StitchAdminUserProfileCodec()); }; StitchAdminClient.prototype.apps = function (groupId) { return new 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; }()); export default StitchAdminClient; //# sourceMappingURL=StitchAdminClient.js.map