base.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.BaseClient = exports.BaseResponse = void 0;
  4. class BaseResponse {
  5. /**
  6. * Returns whether the response has an ok'ish status code
  7. */
  8. get ok() {
  9. return this.status >= 200 && this.status <= 299;
  10. }
  11. /**
  12. * Returns the status code of the response
  13. */
  14. get status() {
  15. throw new Error('not implemented');
  16. }
  17. /**
  18. * Returns the value of the specified header
  19. * @param {string} headerName the header name
  20. * @returns {string} the header value
  21. */
  22. getHeader(headerName) {
  23. throw new Error('not implemented');
  24. }
  25. /**
  26. * @returns {ArrayBuffer} the response data of the request
  27. */
  28. async getData() {
  29. throw new Error('not implemented');
  30. }
  31. }
  32. exports.BaseResponse = BaseResponse;
  33. class BaseClient {
  34. constructor(url) {
  35. this.url = url;
  36. }
  37. /**
  38. * Send a request with the options
  39. * @param {object} [options]
  40. */
  41. async request({ headers, credentials, signal } = {}) {
  42. throw new Error('request is not implemented');
  43. }
  44. }
  45. exports.BaseClient = BaseClient;
  46. //# sourceMappingURL=base.js.map