@cinerino/sdk 12.13.0 → 12.14.0-alpha.0

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,40 @@
1
+ // tslint:disable:no-implicit-dependencies no-console
2
+ import * as client from '../../../../lib/index';
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 client.auth.ClientCredentials.createInstance({
9
+ domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
10
+ clientId: <string>process.env.CHEVRE_CLIENT_ID,
11
+ clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
12
+ scopes: [],
13
+ state: ''
14
+ });
15
+
16
+ const eventService = await (await client.loadChevre({
17
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
18
+ auth: authClient
19
+ })).createEventInstance({
20
+ project: { id: PROJECT_ID },
21
+ seller: { id: '' }
22
+ });
23
+
24
+ const offers = await eventService.findSeatOffersDeprecated(
25
+ {
26
+ id: '691ed47f249a02f4f078a2f9'
27
+ // branchCode: { $in: ['A-3', 'A-4'] }
28
+ },
29
+ { useDefaultSection: true }
30
+ );
31
+ // tslint:disable-next-line:no-null-keyword
32
+ console.dir(offers, { depth: null });
33
+ console.log(offers.length, 'offers returned');
34
+ }
35
+
36
+ main()
37
+ .then(() => {
38
+ console.log('success!');
39
+ })
40
+ .catch(console.error);
@@ -175,12 +175,13 @@ async function authorizeSeatReservationByEvent(params: {
175
175
  .join('\n'));
176
176
 
177
177
  // 空席検索
178
- const searchSeatOffersResult = await eventService.searchSeats({
178
+ const searchSeatOffersResult = await eventService.findSeatOffersDeprecated({
179
179
  event: { id: screeningEvent.id },
180
180
  limit: 100,
181
181
  page: 1
182
182
  });
183
183
  const seatOffers = searchSeatOffersResult.data;
184
+ const sectionCode = searchSeatOffersResult.sectionCode;
184
185
  // console.log(seatOffers.length, 'seatOffers found');
185
186
  // const seatOffers = offers[0].containsPlace;
186
187
  console.log(seatOffers.length, 'seatOffers found');
@@ -208,7 +209,7 @@ async function authorizeSeatReservationByEvent(params: {
208
209
  console.log('ticket offer selected', selectedTicketOffer.id, selectedTicketOffer.identifier, selectedTicketOffer.name.ja);
209
210
 
210
211
  // 座席をランダムに選択
211
- const selectedScreeningRoomSection = String(availableSeatOffers[0].containedInPlace?.branchCode);
212
+ const selectedScreeningRoomSection = String(sectionCode);
212
213
  console.log('screening room section selected', selectedScreeningRoomSection);
213
214
  console.log(selectedScreeningRoomSection);
214
215
  const selectedSeatOffers = availableSeatOffers.slice(0, 1);
@@ -180,12 +180,13 @@ async function authorizeSeatReservationByEvent(params: {
180
180
  .join('\n'));
181
181
 
182
182
  // 空席検索
183
- const searchSeatOffersResult = await eventService.searchSeats({
183
+ const searchSeatOffersResult = await eventService.findSeatOffersDeprecated({
184
184
  event: { id: screeningEvent.id },
185
185
  limit: 100,
186
186
  page: 1
187
187
  });
188
188
  const seatOffers = searchSeatOffersResult.data;
189
+ const sectionCode = searchSeatOffersResult.sectionCode;
189
190
  console.log(seatOffers.length, 'seatOffers found');
190
191
  const availableSeatOffers
191
192
  = seatOffers.filter((o) => o.offers?.shift()?.availability === client.factory.itemAvailability.InStock);
@@ -211,7 +212,7 @@ async function authorizeSeatReservationByEvent(params: {
211
212
  console.log('ticket offer selected', selectedTicketOffer.id, selectedTicketOffer.identifier, selectedTicketOffer.name.ja);
212
213
 
213
214
  // 座席をランダムに選択
214
- const selectedScreeningRoomSection = String(availableSeatOffers[0].containedInPlace?.branchCode);
215
+ const selectedScreeningRoomSection = String(sectionCode);
215
216
  console.log('screening room section selected', selectedScreeningRoomSection);
216
217
  console.log(selectedScreeningRoomSection);
217
218
  const selectedSeatOffers = availableSeatOffers.slice(0, 1);
@@ -369,12 +369,13 @@ async function authorizeSeatReservationByEvent(params: {
369
369
  .join('\n'));
370
370
 
371
371
  // 空席検索
372
- const searchSeatOffersResult = await eventService.searchSeats({
372
+ const searchSeatOffersResult = await eventService.findSeatOffersDeprecated({
373
373
  event: { id: screeningEvent.id },
374
374
  limit: 100,
375
375
  page: 1
376
376
  });
377
377
  const seatOffers = searchSeatOffersResult.data;
378
+ const sectionCode = searchSeatOffersResult.sectionCode;
378
379
  // console.log(seatOffers.length, 'seatOffers found');
379
380
  // const seatOffers = offers[0].containsPlace;
380
381
  console.log(seatOffers.length, 'seatOffers found');
@@ -402,7 +403,7 @@ async function authorizeSeatReservationByEvent(params: {
402
403
  console.log('ticket offer selected', selectedTicketOffer.id, selectedTicketOffer.identifier, selectedTicketOffer.name.ja);
403
404
 
404
405
  // 座席をランダムに選択
405
- const selectedScreeningRoomSection = String(availableSeatOffers[0].containedInPlace?.branchCode);
406
+ const selectedScreeningRoomSection = String(sectionCode);
406
407
  console.log('screening room section selected', selectedScreeningRoomSection);
407
408
  console.log(selectedScreeningRoomSection);
408
409
  const selectedSeatOffers = availableSeatOffers.slice(0, 1);
@@ -292,12 +292,13 @@ async function authorizeSeatReservationByEvent(params: {
292
292
  .join('\n'));
293
293
 
294
294
  // 空席検索
295
- const searchSeatOffersResult = await eventService.searchSeats({
295
+ const searchSeatOffersResult = await eventService.findSeatOffersDeprecated({
296
296
  event: { id: screeningEvent.id },
297
297
  limit: 100,
298
298
  page: 1
299
299
  });
300
300
  const seatOffers = searchSeatOffersResult.data;
301
+ const sectionCode = searchSeatOffersResult.sectionCode;
301
302
  // console.log(seatOffers.length, 'seatOffers found');
302
303
  // const seatOffers = offers[0].containsPlace;
303
304
  console.log(seatOffers.length, 'seatOffers found');
@@ -325,7 +326,7 @@ async function authorizeSeatReservationByEvent(params: {
325
326
  console.log('ticket offer selected', selectedTicketOffer.id, selectedTicketOffer.identifier, selectedTicketOffer.name.ja);
326
327
 
327
328
  // 座席をランダムに選択
328
- const selectedScreeningRoomSection = String(availableSeatOffers[0].containedInPlace?.branchCode);
329
+ const selectedScreeningRoomSection = String(sectionCode);
329
330
  console.log('screening room section selected', selectedScreeningRoomSection);
330
331
  console.log(selectedScreeningRoomSection);
331
332
  const selectedSeatOffers = availableSeatOffers.slice(0, 1);
@@ -12,10 +12,10 @@ async function main() {
12
12
  seller: { id: '' }
13
13
  });
14
14
 
15
- const result = await eventService.searchSeats({
16
- event: { id: 'bm2bfj55r' },
15
+ const result = await eventService.findSeatOffersDeprecated({
16
+ event: { id: '691ed47f249a02f4f078a2f9' },
17
17
  page: 1,
18
- limit: 1
18
+ limit: 100
19
19
  });
20
20
  // tslint:disable-next-line:no-null-keyword
21
21
  console.dir(result, { depth: null });
@@ -1,7 +1,7 @@
1
1
  // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
2
  import * as client from '../../../../lib/index';
3
3
 
4
- const eventId = 'cmd2cxcw5';
4
+ const eventId = '691ed47f249a02f4f078a2f9';
5
5
 
6
6
  let auth: client.auth.ClientCredentials | undefined;
7
7
 
@@ -25,7 +25,9 @@ async function main() {
25
25
  uri: '/events/ScreeningEventSeries',
26
26
  method: 'GET',
27
27
  qs: {
28
- limit: 100
28
+ limit: 100,
29
+ locationBranchCode: '118',
30
+ workPerformedIdentifier: '1622100'
29
31
  },
30
32
  expectedStatusCodes: [httpStatus.OK]
31
33
  })
@@ -0,0 +1,47 @@
1
+ // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
+ import * as httpStatus from 'http-status';
3
+
4
+ import * as client from '../../../../lib/index';
5
+
6
+ // tslint:disable-next-line:max-func-body-length
7
+ async function main() {
8
+ const auth = await client.auth.ClientCredentials.createInstance({
9
+ domain: <string>process.env.ST_AUTHORIZE_SERVER_DOMAIN,
10
+ clientId: <string>process.env.ST_CLIENT_ID,
11
+ clientSecret: <string>process.env.ST_CLIENT_SECRET,
12
+ scopes: [],
13
+ state: 'teststate'
14
+ });
15
+
16
+ const sellerService = new (await client.loadService()).Seller({
17
+ endpoint: <string>process.env.ST_API_V2_ENDPOINT,
18
+ auth: auth,
19
+ project: { id: '' }
20
+ });
21
+
22
+ console.log('イベントを検索しています...');
23
+ const searchResult = await sellerService.fetch({
24
+ uri: '/event/screeningEventSeries/search',
25
+ method: 'GET',
26
+ qs: {
27
+ limit: 10,
28
+ locationBranchCode: '118',
29
+ workPerformedIdentifier: '1622100',
30
+ sellerId: '59d20831e53ebc2b4e774466'
31
+ // clientId: 'xx'
32
+ },
33
+ expectedStatusCodes: [httpStatus.OK]
34
+ })
35
+ .then(async (response) => response.json());
36
+ // tslint:disable-next-line:no-null-keyword
37
+ console.dir(searchResult, { depth: null });
38
+ console.log(searchResult.length);
39
+ }
40
+
41
+ main()
42
+ .then(() => {
43
+ console.log('main processed.');
44
+ })
45
+ .catch((err) => {
46
+ console.error(err);
47
+ });
@@ -172,8 +172,11 @@ export declare class EventService extends Service {
172
172
  }): Promise<IEvent>;
173
173
  /**
174
174
  * イベントに対する座席検索
175
+ * ルームの複数セクション非対応
176
+ * 自動的にルームのひとつめのセクションが選択されます
177
+ * @deprecated use SeatOfferService
175
178
  */
176
- searchSeats(params: {
179
+ findSeatOffersDeprecated(params: {
177
180
  /**
178
181
  * イベント
179
182
  */
@@ -184,7 +187,12 @@ export declare class EventService extends Service {
184
187
  page: number;
185
188
  }, options?: {
186
189
  useDefaultSection?: boolean;
187
- }): Promise<ISearchResult<ISeatAsEventOffer[]>>;
190
+ }): Promise<ISearchResult<Omit<ISeatAsEventOffer, 'containedInPlace'>[]> & {
191
+ /**
192
+ * デフォルトセクションコード
193
+ */
194
+ sectionCode?: string;
195
+ }>;
188
196
  /**
189
197
  * 興行オファー検索
190
198
  * サブカタログ設定有無による違いについては、includedInDataCatalogパラメータの説明を参照してください
@@ -215,8 +215,11 @@ var EventService = /** @class */ (function (_super) {
215
215
  };
216
216
  /**
217
217
  * イベントに対する座席検索
218
+ * ルームの複数セクション非対応
219
+ * 自動的にルームのひとつめのセクションが選択されます
220
+ * @deprecated use SeatOfferService
218
221
  */
219
- EventService.prototype.searchSeats = function (params, options) {
222
+ EventService.prototype.findSeatOffersDeprecated = function (params, options) {
220
223
  return __awaiter(this, void 0, void 0, function () {
221
224
  var event, query, useDefaultSection;
222
225
  var _this = this;
@@ -230,14 +233,17 @@ var EventService = /** @class */ (function (_super) {
230
233
  expectedStatusCodes: [http_status_1.OK]
231
234
  })
232
235
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
236
+ var seatOffers;
233
237
  var _a;
234
238
  return __generator(this, function (_b) {
235
239
  switch (_b.label) {
236
- case 0:
237
- _a = {};
238
- return [4 /*yield*/, response.json()];
239
- case 1: return [2 /*return*/, (_a.data = _b.sent(),
240
- _a)];
240
+ case 0: return [4 /*yield*/, response.json()];
241
+ case 1:
242
+ seatOffers = _b.sent();
243
+ return [2 /*return*/, {
244
+ data: seatOffers,
245
+ sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
246
+ }];
241
247
  }
242
248
  });
243
249
  }); })];
package/lib/bundle.js CHANGED
@@ -21715,8 +21715,11 @@ var EventService = /** @class */ (function (_super) {
21715
21715
  };
21716
21716
  /**
21717
21717
  * イベントに対する座席検索
21718
+ * ルームの複数セクション非対応
21719
+ * 自動的にルームのひとつめのセクションが選択されます
21720
+ * @deprecated use SeatOfferService
21718
21721
  */
21719
- EventService.prototype.searchSeats = function (params, options) {
21722
+ EventService.prototype.findSeatOffersDeprecated = function (params, options) {
21720
21723
  return __awaiter(this, void 0, void 0, function () {
21721
21724
  var event, query, useDefaultSection;
21722
21725
  var _this = this;
@@ -21730,14 +21733,17 @@ var EventService = /** @class */ (function (_super) {
21730
21733
  expectedStatusCodes: [http_status_1.OK]
21731
21734
  })
21732
21735
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
21736
+ var seatOffers;
21733
21737
  var _a;
21734
21738
  return __generator(this, function (_b) {
21735
21739
  switch (_b.label) {
21736
- case 0:
21737
- _a = {};
21738
- return [4 /*yield*/, response.json()];
21739
- case 1: return [2 /*return*/, (_a.data = _b.sent(),
21740
- _a)];
21740
+ case 0: return [4 /*yield*/, response.json()];
21741
+ case 1:
21742
+ seatOffers = _b.sent();
21743
+ return [2 /*return*/, {
21744
+ data: seatOffers,
21745
+ sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
21746
+ }];
21741
21747
  }
21742
21748
  });
21743
21749
  }); })];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "12.13.0",
3
+ "version": "12.14.0-alpha.0",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {