auth.js 919 B

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