reservations_response.js 607 B

12345678910111213141516171819202122232425262728
  1. import { bool_response } from "./bool_response";
  2. import { reservation } from "./reservation.js";
  3. export class reservations_response extends bool_response {
  4. #collection;
  5. constructor(target) {
  6. super(target);
  7. if (!this.result) {
  8. return;
  9. }
  10. this.#collection = new Array();
  11. target["reservations"].forEach(count => {
  12. this.#collection.push(new reservation(count));
  13. });
  14. }
  15. get collection() {
  16. if (!this.result) {
  17. throw new Error(this.cause)
  18. }
  19. return this.#collection;
  20. }
  21. }