UNPKG

scryfall-client

Version:
40 lines (39 loc) 1.65 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import ArrayLike from "./array-like"; import { get } from "../lib/api-request"; var List = /** @class */ (function (_super) { __extends(List, _super); function List(scrfallResponse) { var _this = _super.call(this, scrfallResponse) || this; _this.object = scrfallResponse.object; _this.has_more = scrfallResponse.has_more; _this.next_page = scrfallResponse.next_page; _this.total_cards = scrfallResponse.total_cards; _this.warnings = scrfallResponse.warnings || []; _this.not_found = scrfallResponse.not_found || []; return _this; } List.prototype.next = function () { if (!this.has_more || !this.next_page) { return Promise.reject(new Error("No additional pages.")); } return get(this.next_page); }; return List; }(ArrayLike)); export default List;