@cinerino/sdk 5.12.0-alpha.2 → 5.12.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import * as client from '../../../lib/';
3
+ import * as auth from '../auth/authAsAdmin';
4
+
5
+ const project = { id: String(process.env.PROJECT_ID) };
6
+
7
+ async function main() {
8
+ const authClient = await auth.login();
9
+ await authClient.refreshAccessToken();
10
+ const loginTicket = authClient.verifyIdToken({});
11
+ console.log('username is', loginTicket.getUsername());
12
+
13
+ const reservationService = await (await client.loadChevre({
14
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
15
+ auth: authClient
16
+ })).createReservationInstance({
17
+ project,
18
+ seller: { id: '' }
19
+ });
20
+
21
+ const reservation = await reservationService.findByCode({
22
+ object: {
23
+ id: '589701779538948-0'
24
+ },
25
+ instrument: {
26
+ code: '068cb0ba-8529-4a2b-8cf5-890d5af9c536'
27
+ }
28
+ });
29
+ // tslint:disable-next-line:no-null-keyword
30
+ console.dir(reservation, { depth: null });
31
+ console.log('ticketType.identifier:', reservation.reservedTicket.ticketType.identifier);
32
+ }
33
+
34
+ main()
35
+ .then(() => {
36
+ console.log('main processed.');
37
+ })
38
+ .catch(console.error);
@@ -7,3 +7,24 @@ export interface IUseAction {
7
7
  typeOf: factory.actionType.UseAction;
8
8
  location?: factory.action.consume.use.reservation.ILocation;
9
9
  }
10
+ interface IOfferAsFindByCodeResult {
11
+ /**
12
+ * オファーコード
13
+ */
14
+ identifier: string;
15
+ /**
16
+ * オファー名称
17
+ */
18
+ name?: {
19
+ ja?: string;
20
+ };
21
+ }
22
+ /**
23
+ * コードによる予約照会結果
24
+ */
25
+ export declare type IFindByCodeResult = Pick<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'id' | 'additionalTicketText' | 'reservationStatus'> & {
26
+ reservedTicket: {
27
+ ticketType: IOfferAsFindByCodeResult;
28
+ };
29
+ };
30
+ export {};
@@ -1,9 +1,27 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
+ import { IFindByCodeResult } from './reservation/factory';
3
4
  /**
4
5
  * 予約サービス
5
6
  */
6
7
  export declare class ReservationService extends Service {
8
+ /**
9
+ * コードによる予約照会
10
+ */
11
+ findByCode(params: {
12
+ object: {
13
+ /**
14
+ * 予約ID
15
+ */
16
+ id: string;
17
+ };
18
+ instrument: {
19
+ /**
20
+ * 注文コード
21
+ */
22
+ code: string;
23
+ };
24
+ }): Promise<IFindByCodeResult>;
7
25
  /**
8
26
  * 注文に含まれる予約照会
9
27
  */
@@ -62,6 +62,25 @@ var ReservationService = /** @class */ (function (_super) {
62
62
  function ReservationService() {
63
63
  return _super !== null && _super.apply(this, arguments) || this;
64
64
  }
65
+ /**
66
+ * コードによる予約照会
67
+ */
68
+ ReservationService.prototype.findByCode = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/reservations/findByCode',
74
+ method: 'POST',
75
+ body: params,
76
+ expectedStatusCodes: [http_status_1.OK]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
65
84
  /**
66
85
  * 注文に含まれる予約照会
67
86
  */
package/lib/bundle.js CHANGED
@@ -3724,6 +3724,25 @@ var ReservationService = /** @class */ (function (_super) {
3724
3724
  function ReservationService() {
3725
3725
  return _super !== null && _super.apply(this, arguments) || this;
3726
3726
  }
3727
+ /**
3728
+ * コードによる予約照会
3729
+ */
3730
+ ReservationService.prototype.findByCode = function (params) {
3731
+ return __awaiter(this, void 0, void 0, function () {
3732
+ var _this = this;
3733
+ return __generator(this, function (_a) {
3734
+ return [2 /*return*/, this.fetch({
3735
+ uri: '/reservations/findByCode',
3736
+ method: 'POST',
3737
+ body: params,
3738
+ expectedStatusCodes: [http_status_1.OK]
3739
+ })
3740
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
3741
+ return [2 /*return*/, response.json()];
3742
+ }); }); })];
3743
+ });
3744
+ });
3745
+ };
3727
3746
  /**
3728
3747
  * 注文に含まれる予約照会
3729
3748
  */
@@ -18549,8 +18568,95 @@ var ProductService = /** @class */ (function (_super) {
18549
18568
  exports.ProductService = ProductService;
18550
18569
 
18551
18570
  },{"../service":99,"http-status":330}],115:[function(require,module,exports){
18552
- arguments[4][27][0].apply(exports,arguments)
18553
- },{"../service":99,"dup":27,"http-status":330}],116:[function(require,module,exports){
18571
+ "use strict";
18572
+ var __extends = (this && this.__extends) || (function () {
18573
+ var extendStatics = function (d, b) {
18574
+ extendStatics = Object.setPrototypeOf ||
18575
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
18576
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
18577
+ return extendStatics(d, b);
18578
+ };
18579
+ return function (d, b) {
18580
+ if (typeof b !== "function" && b !== null)
18581
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
18582
+ extendStatics(d, b);
18583
+ function __() { this.constructor = d; }
18584
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18585
+ };
18586
+ })();
18587
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18588
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18589
+ return new (P || (P = Promise))(function (resolve, reject) {
18590
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18591
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18592
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18593
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18594
+ });
18595
+ };
18596
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18597
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
18598
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
18599
+ function verb(n) { return function (v) { return step([n, v]); }; }
18600
+ function step(op) {
18601
+ if (f) throw new TypeError("Generator is already executing.");
18602
+ while (_) try {
18603
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18604
+ if (y = 0, t) op = [op[0] & 2, t.value];
18605
+ switch (op[0]) {
18606
+ case 0: case 1: t = op; break;
18607
+ case 4: _.label++; return { value: op[1], done: false };
18608
+ case 5: _.label++; y = op[1]; op = [0]; continue;
18609
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
18610
+ default:
18611
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
18612
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
18613
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
18614
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
18615
+ if (t[2]) _.ops.pop();
18616
+ _.trys.pop(); continue;
18617
+ }
18618
+ op = body.call(thisArg, _);
18619
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
18620
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
18621
+ }
18622
+ };
18623
+ Object.defineProperty(exports, "__esModule", { value: true });
18624
+ exports.ReservationService = void 0;
18625
+ var http_status_1 = require("http-status");
18626
+ var service_1 = require("../service");
18627
+ /**
18628
+ * 予約サービス
18629
+ */
18630
+ var ReservationService = /** @class */ (function (_super) {
18631
+ __extends(ReservationService, _super);
18632
+ function ReservationService() {
18633
+ return _super !== null && _super.apply(this, arguments) || this;
18634
+ }
18635
+ /**
18636
+ * 注文に含まれる予約照会
18637
+ */
18638
+ ReservationService.prototype.searchByOrder = function (params, qs) {
18639
+ return __awaiter(this, void 0, void 0, function () {
18640
+ var _this = this;
18641
+ return __generator(this, function (_a) {
18642
+ return [2 /*return*/, this.fetch({
18643
+ uri: '/reservations/searchByOrder',
18644
+ method: 'POST',
18645
+ body: params,
18646
+ qs: qs,
18647
+ expectedStatusCodes: [http_status_1.OK]
18648
+ })
18649
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
18650
+ return [2 /*return*/, response.json()];
18651
+ }); }); })];
18652
+ });
18653
+ });
18654
+ };
18655
+ return ReservationService;
18656
+ }(service_1.Service));
18657
+ exports.ReservationService = ReservationService;
18658
+
18659
+ },{"../service":99,"http-status":330}],116:[function(require,module,exports){
18554
18660
  arguments[4][28][0].apply(exports,arguments)
18555
18661
  },{"../service":99,"dup":28,"http-status":330}],117:[function(require,module,exports){
18556
18662
  arguments[4][29][0].apply(exports,arguments)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "5.12.0-alpha.2",
3
+ "version": "5.12.0-alpha.3",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {