mongodb-stitch
Version:
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
55 lines • 3.12 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports", "mongodb-stitch-core-sdk", "./Resources", "./StitchAdminAuth", "./StitchAdminAuthRoutes", "./StitchAdminUserProfile"], factory);
}
})(function (require, exports) {
"use strict";
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