@cinerino/sdk 12.12.0-alpha.5 → 12.12.0-alpha.6

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,39 @@
1
+ // tslint:disable:no-implicit-dependencies no-console
2
+
3
+ import * as client from '../../../../lib/index';
4
+
5
+ const { PROJECT_ID } = process.env;
6
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
7
+
8
+ async function main() {
9
+ const authClient = await client.auth.ClientCredentials.createInstance({
10
+ domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
11
+ clientId: <string>process.env.CHEVRE_CLIENT_ID,
12
+ clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
13
+ scopes: [],
14
+ state: ''
15
+ });
16
+
17
+ const seatOfferService = await (await client.loadChevre({
18
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
19
+ auth: authClient
20
+ })).createSeatOfferInstance({
21
+ project: { id: String(PROJECT_ID) },
22
+ seller: { id: SELLER_ID }
23
+ });
24
+
25
+ const result = await seatOfferService.findEventSeatOffersBySection({
26
+ limit: 10,
27
+ page: 1,
28
+ eventId: '691ed47f249a02f4f078a2d6',
29
+ sectionCode: 'Default02'
30
+ });
31
+ console.log(result);
32
+ console.log(result.length, 'offers returned');
33
+ }
34
+
35
+ main()
36
+ .then(() => {
37
+ console.log('success!');
38
+ })
39
+ .catch(console.error);
@@ -0,0 +1,41 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ /**
4
+ * 座席オファー
5
+ */
6
+ interface ISeatOfferBySection {
7
+ /**
8
+ * 在庫状態
9
+ */
10
+ availability: factory.itemAvailability.InStock | factory.itemAvailability.OutOfStock;
11
+ itemOffered: {
12
+ /**
13
+ * 座席コード
14
+ */
15
+ branchCode: string;
16
+ };
17
+ }
18
+ /**
19
+ * 座席オファーサービス
20
+ */
21
+ export declare class SeatOfferService extends Service {
22
+ /**
23
+ * イベントとセクション指定で座席在庫検索
24
+ */
25
+ findEventSeatOffersBySection(params: {
26
+ /**
27
+ * max: 100
28
+ */
29
+ limit: number;
30
+ page: number;
31
+ /**
32
+ * イベントID
33
+ */
34
+ eventId: string;
35
+ /**
36
+ * セクションコード
37
+ */
38
+ sectionCode: string;
39
+ }): Promise<ISeatOfferBySection[]>;
40
+ }
41
+ export {};
@@ -0,0 +1,88 @@
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ 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;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.SeatOfferService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 座席オファーサービス
59
+ */
60
+ var SeatOfferService = /** @class */ (function (_super) {
61
+ __extends(SeatOfferService, _super);
62
+ function SeatOfferService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * イベントとセクション指定で座席在庫検索
67
+ */
68
+ SeatOfferService.prototype.findEventSeatOffersBySection = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var limit, page, eventId, sectionCode;
71
+ var _this = this;
72
+ return __generator(this, function (_a) {
73
+ limit = params.limit, page = params.page, eventId = params.eventId, sectionCode = params.sectionCode;
74
+ return [2 /*return*/, this.fetch({
75
+ uri: '/seatOffers',
76
+ method: 'GET',
77
+ qs: { limit: limit, page: page, eventId: eventId, sectionCode: sectionCode },
78
+ expectedStatusCodes: [http_status_1.OK]
79
+ })
80
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
81
+ return [2 /*return*/, response.json()];
82
+ }); }); })];
83
+ });
84
+ });
85
+ };
86
+ return SeatOfferService;
87
+ }(service_1.Service));
88
+ exports.SeatOfferService = SeatOfferService;
@@ -11,6 +11,7 @@ import type { PlaceService } from './chevre/place';
11
11
  import type { HasPOSService } from './chevre/place/hasPOS';
12
12
  import type { ProductService } from './chevre/product';
13
13
  import type { ProductOfferService } from './chevre/productOffer';
14
+ import type { SeatOfferService } from './chevre/seatOffer';
14
15
  import type { SellerService } from './chevre/seller';
15
16
  import type { TripService } from './chevre/trip';
16
17
  export declare namespace service {
@@ -101,6 +102,13 @@ export declare namespace service {
101
102
  namespace ProductOffer {
102
103
  let svc: typeof ProductOfferService | undefined;
103
104
  }
105
+ /**
106
+ * 座席オファーサービス
107
+ */
108
+ type SeatOffer = SeatOfferService;
109
+ namespace SeatOffer {
110
+ let svc: typeof SeatOfferService | undefined;
111
+ }
104
112
  /**
105
113
  * 販売者サービス
106
114
  */
@@ -134,6 +142,7 @@ export declare class Chevre {
134
142
  createHasPOSInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<HasPOSService>;
135
143
  createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
136
144
  createProductOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductOfferService>;
145
+ createSeatOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SeatOfferService>;
137
146
  createSellerInstance(params: Pick<IOptions, 'project'>): Promise<SellerService>;
138
147
  createTripInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TripService>;
139
148
  }
@@ -89,6 +89,9 @@ var service;
89
89
  var ProductOffer;
90
90
  (function (ProductOffer) {
91
91
  })(ProductOffer = service.ProductOffer || (service.ProductOffer = {}));
92
+ var SeatOffer;
93
+ (function (SeatOffer) {
94
+ })(SeatOffer = service.SeatOffer || (service.SeatOffer = {}));
92
95
  var Seller;
93
96
  (function (Seller) {
94
97
  })(Seller = service.Seller || (service.Seller = {}));
@@ -307,6 +310,23 @@ var Chevre = /** @class */ (function () {
307
310
  });
308
311
  });
309
312
  };
313
+ Chevre.prototype.createSeatOfferInstance = function (params) {
314
+ return __awaiter(this, void 0, void 0, function () {
315
+ var _a;
316
+ return __generator(this, function (_b) {
317
+ switch (_b.label) {
318
+ case 0:
319
+ if (!(service.SeatOffer.svc === undefined)) return [3 /*break*/, 2];
320
+ _a = service.SeatOffer;
321
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/seatOffer'); })];
322
+ case 1:
323
+ _a.svc = (_b.sent()).SeatOfferService;
324
+ _b.label = 2;
325
+ case 2: return [2 /*return*/, new service.SeatOffer.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
326
+ }
327
+ });
328
+ });
329
+ };
310
330
  Chevre.prototype.createSellerInstance = function (params) {
311
331
  return __awaiter(this, void 0, void 0, function () {
312
332
  var _a;