1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | };
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | var __assign = (this && this.__assign) || function () {
|
16 | __assign = Object.assign || function(t) {
|
17 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
18 | s = arguments[i];
|
19 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
20 | t[p] = s[p];
|
21 | }
|
22 | return t;
|
23 | };
|
24 | return __assign.apply(this, arguments);
|
25 | };
|
26 | Object.defineProperty(exports, "__esModule", { value: true });
|
27 | var rest_client_1 = require("@nativecode/rest-client");
|
28 | var HistorySortKey;
|
29 | (function (HistorySortKey) {
|
30 | HistorySortKey["Date"] = "date";
|
31 | HistorySortKey["Title"] = "movie.title";
|
32 | })(HistorySortKey = exports.HistorySortKey || (exports.HistorySortKey = {}));
|
33 | var HistoryResource = (function (_super) {
|
34 | __extends(HistoryResource, _super);
|
35 | function HistoryResource(url, apikey, logger) {
|
36 | var _this = _super.call(this, url, logger) || this;
|
37 | _this.setHeader('X-Api-Key', apikey);
|
38 | return _this;
|
39 | }
|
40 | HistoryResource.prototype.page = function (page, options) {
|
41 | if (page === void 0) { page = 1; }
|
42 | var merged = __assign({ pageSize: 0 }, options);
|
43 | return this._get('history', [
|
44 | {
|
45 | key: 'page',
|
46 | type: rest_client_1.ResourceRouteParamType.Query,
|
47 | value: page,
|
48 | },
|
49 | {
|
50 | key: 'pageSize',
|
51 | type: rest_client_1.ResourceRouteParamType.Query,
|
52 | value: merged.pageSize,
|
53 | },
|
54 | {
|
55 | key: 'sortDir',
|
56 | type: rest_client_1.ResourceRouteParamType.Query,
|
57 | value: merged.sortDir,
|
58 | },
|
59 | {
|
60 | key: 'sortKey',
|
61 | type: rest_client_1.ResourceRouteParamType.Query,
|
62 | value: merged.sortKey,
|
63 | },
|
64 | ]);
|
65 | };
|
66 | return HistoryResource;
|
67 | }(rest_client_1.Resource));
|
68 | exports.HistoryResource = HistoryResource;
|
69 |
|
\ | No newline at end of file |