UNPKG

845 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const guards_1 = require("../guards");
4const http_1 = require("./http");
5class AuthClient extends http_1.ResourceClient {
6 constructor(e) {
7 super();
8 this.e = e;
9 this.connections = new AuthConnectionClient(e);
10 }
11}
12exports.AuthClient = AuthClient;
13class AuthConnectionClient extends http_1.ResourceClient {
14 constructor(e) {
15 super();
16 this.e = e;
17 }
18 async load(email) {
19 const { req } = await this.e.client.make('GET', `/auth/connections/${email}`);
20 const res = await this.e.client.do(req);
21 if (!guards_1.isAuthConnectionResponse(res)) {
22 throw http_1.createFatalAPIFormat(req, res);
23 }
24 return res.data;
25 }
26}
27exports.AuthConnectionClient = AuthConnectionClient;