@cinerino/sdk 12.1.0 → 12.3.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,67 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import { loadChevreConsole } from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ const authClient = await auth.login();
10
+ await authClient.refreshAccessToken();
11
+ const loginTicket = authClient.verifyIdToken({});
12
+ console.log('username is', loginTicket.getUsername());
13
+
14
+ const sellerMakesOfferService = await (await loadChevreConsole({
15
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
16
+ auth: authClient
17
+ })).createSellerMakesOfferInstance({
18
+ project,
19
+ seller: { id: '' }
20
+ });
21
+
22
+ await sellerMakesOfferService.deleteOffersIfExists([
23
+ {
24
+ availableAtOrFrom: {
25
+ id: 'xxx'
26
+ },
27
+ offeredBy: {
28
+ id: '11a11111e11aaa1b1a111111'
29
+ }
30
+ }
31
+ ]);
32
+ console.log('deleted');
33
+
34
+ await sellerMakesOfferService.createOffersIfNotExists([
35
+ {
36
+ availableAtOrFrom: {
37
+ id: 'xxx'
38
+ },
39
+ offeredBy: {
40
+ id: '11a11111e11aaa1b1a111111'
41
+ },
42
+ eligibleTransactionDuration: { maxValue: 900 }
43
+ }
44
+ ]);
45
+ console.log('upserted');
46
+
47
+ const offers = await sellerMakesOfferService.findOffers(
48
+ {
49
+ qs: {
50
+ limit: 10,
51
+ page: 1
52
+ // availableAtOrFrom: {
53
+ // id: 'xxx'
54
+ // },
55
+ // offeredBy: {
56
+ // id: 'xxx'
57
+ // }
58
+ }
59
+ });
60
+ console.log(offers);
61
+ }
62
+
63
+ main()
64
+ .then(() => {
65
+ console.log('success!');
66
+ })
67
+ .catch(console.error);
@@ -13,11 +13,12 @@ declare type IUnset<T extends factory.eventType> = {
13
13
  */
14
14
  export declare class EventService extends Service {
15
15
  /**
16
- * 上映イベント複数作成
16
+ * 興行イベント複数作成
17
17
  */
18
18
  createScreeningEvents(params: factory.event.ICreateParams<factory.eventType.ScreeningEvent>[], options: {
19
19
  superEventId: string;
20
20
  locationBranchCode: string;
21
+ hasTicketedSeat: boolean;
21
22
  }): Promise<void>;
22
23
  /**
23
24
  * イベント複数作成
@@ -39,13 +40,22 @@ export declare class EventService extends Service {
39
40
  id: string;
40
41
  typeOf: T;
41
42
  }): Promise<factory.event.IEvent<T>>;
43
+ /**
44
+ * 興行イベント更新
45
+ */
46
+ updateScreeningEventById(params: {
47
+ id: string;
48
+ attributes: factory.event.screeningEvent.IUpdateParams & {
49
+ $unset?: IUnset<factory.eventType.ScreeningEvent>;
50
+ };
51
+ }): Promise<void>;
42
52
  /**
43
53
  * イベント更新
44
54
  */
45
- updateById<T extends factory.eventType.Event | factory.eventType.ScreeningEvent>(params: {
55
+ updateAnyEventById(params: {
46
56
  id: string;
47
- attributes: factory.event.IUpdateParams<T> & {
48
- $unset?: IUnset<T>;
57
+ attributes: factory.event.IUpdateParams<factory.eventType.Event> & {
58
+ $unset?: IUnset<factory.eventType.Event>;
49
59
  };
50
60
  }): Promise<void>;
51
61
  }
@@ -64,7 +64,7 @@ var EventService = /** @class */ (function (_super) {
64
64
  return _super !== null && _super.apply(this, arguments) || this;
65
65
  }
66
66
  /**
67
- * 上映イベント複数作成
67
+ * 興行イベント複数作成
68
68
  */
69
69
  EventService.prototype.createScreeningEvents = function (params,
70
70
  // add options(2025-08-26~)
@@ -164,10 +164,33 @@ var EventService = /** @class */ (function (_super) {
164
164
  });
165
165
  });
166
166
  };
167
+ /**
168
+ * 興行イベント更新
169
+ */
170
+ EventService.prototype.updateScreeningEventById = function (params) {
171
+ return __awaiter(this, void 0, void 0, function () {
172
+ return __generator(this, function (_a) {
173
+ switch (_a.label) {
174
+ case 0: return [4 /*yield*/, this.fetch({
175
+ uri: "/events/" + encodeURIComponent(String(params.id)),
176
+ method: 'PUT',
177
+ body: params.attributes,
178
+ qs: {
179
+ typeOf: factory.eventType.ScreeningEvent
180
+ },
181
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
182
+ })];
183
+ case 1:
184
+ _a.sent();
185
+ return [2 /*return*/];
186
+ }
187
+ });
188
+ });
189
+ };
167
190
  /**
168
191
  * イベント更新
169
192
  */
170
- EventService.prototype.updateById = function (params) {
193
+ EventService.prototype.updateAnyEventById = function (params) {
171
194
  return __awaiter(this, void 0, void 0, function () {
172
195
  return __generator(this, function (_a) {
173
196
  switch (_a.label) {
@@ -175,7 +198,9 @@ var EventService = /** @class */ (function (_super) {
175
198
  uri: "/events/" + encodeURIComponent(String(params.id)),
176
199
  method: 'PUT',
177
200
  body: params.attributes,
178
- // qs: params.qs,
201
+ qs: {
202
+ typeOf: factory.eventType.Event
203
+ },
179
204
  expectedStatusCodes: [http_status_1.NO_CONTENT]
180
205
  })];
181
206
  case 1:
@@ -0,0 +1,51 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ declare type IMakesOffer = Pick<factory.seller.IMakesOffer, 'typeOf' | 'availableAtOrFrom' | 'eligibleTransactionDuration'>;
4
+ declare type IMakesOfferAsFindResult = IMakesOffer & {
5
+ offeredBy: {
6
+ id: string;
7
+ name: {
8
+ ja: string;
9
+ };
10
+ };
11
+ };
12
+ /**
13
+ * 販売者提供オファーサービス
14
+ */
15
+ export declare class SellerMakesOfferService extends Service {
16
+ findOffers(params: {
17
+ /**
18
+ * 検索条件
19
+ */
20
+ qs: {
21
+ limit: number;
22
+ page: number;
23
+ offeredBy?: {
24
+ id?: string;
25
+ };
26
+ availableAtOrFrom?: {
27
+ id?: string;
28
+ };
29
+ };
30
+ }): Promise<IMakesOfferAsFindResult[]>;
31
+ createOffersIfNotExists(params: {
32
+ availableAtOrFrom: {
33
+ id: string;
34
+ };
35
+ offeredBy: {
36
+ id: string;
37
+ };
38
+ eligibleTransactionDuration: {
39
+ maxValue: number;
40
+ };
41
+ }[]): Promise<void>;
42
+ deleteOffersIfExists(params: {
43
+ availableAtOrFrom: {
44
+ id: string;
45
+ };
46
+ offeredBy: {
47
+ id: string;
48
+ };
49
+ }[]): Promise<void>;
50
+ }
51
+ export {};
@@ -0,0 +1,117 @@
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.SellerMakesOfferService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 販売者提供オファーサービス
59
+ */
60
+ var SellerMakesOfferService = /** @class */ (function (_super) {
61
+ __extends(SellerMakesOfferService, _super);
62
+ function SellerMakesOfferService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ SellerMakesOfferService.prototype.findOffers = function (params) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var _this = this;
68
+ return __generator(this, function (_a) {
69
+ return [2 /*return*/, this.fetch({
70
+ uri: '/sellerMakesOffer',
71
+ method: 'GET',
72
+ qs: params.qs,
73
+ expectedStatusCodes: [http_status_1.OK]
74
+ })
75
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
76
+ return [2 /*return*/, response.json()];
77
+ }); }); })];
78
+ });
79
+ });
80
+ };
81
+ SellerMakesOfferService.prototype.createOffersIfNotExists = function (params) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
85
+ case 0: return [4 /*yield*/, this.fetch({
86
+ uri: '/sellerMakesOffer',
87
+ method: 'PUT',
88
+ body: params,
89
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
90
+ })];
91
+ case 1:
92
+ _a.sent();
93
+ return [2 /*return*/];
94
+ }
95
+ });
96
+ });
97
+ };
98
+ SellerMakesOfferService.prototype.deleteOffersIfExists = function (params) {
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ return __generator(this, function (_a) {
101
+ switch (_a.label) {
102
+ case 0: return [4 /*yield*/, this.fetch({
103
+ uri: '/sellerMakesOffer',
104
+ method: 'DELETE',
105
+ body: params,
106
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
107
+ })];
108
+ case 1:
109
+ _a.sent();
110
+ return [2 /*return*/];
111
+ }
112
+ });
113
+ });
114
+ };
115
+ return SellerMakesOfferService;
116
+ }(service_1.Service));
117
+ exports.SellerMakesOfferService = SellerMakesOfferService;
@@ -56,6 +56,7 @@ import type { ProjectService } from './chevreConsole/project';
56
56
  import type { ProjectMakesOfferService } from './chevreConsole/projectMakesOffer';
57
57
  import type { ReservationService } from './chevreConsole/reservation';
58
58
  import type { SellerService } from './chevreConsole/seller';
59
+ import type { SellerMakesOfferService } from './chevreConsole/sellerMakesOffer';
59
60
  import type { SellerReturnPolicyService } from './chevreConsole/sellerReturnPolicy';
60
61
  import type { TaskService } from './chevreConsole/task';
61
62
  import type { TicketService } from './chevreConsole/ticket';
@@ -437,6 +438,13 @@ export declare namespace service {
437
438
  namespace Seller {
438
439
  let svc: typeof SellerService | undefined;
439
440
  }
441
+ /**
442
+ * 販売者提供オファーサービス
443
+ */
444
+ type SellerMakesOffer = SellerMakesOfferService;
445
+ namespace SellerMakesOffer {
446
+ let svc: typeof SellerMakesOfferService | undefined;
447
+ }
440
448
  /**
441
449
  * 販売者返品ポリシーサービス
442
450
  */
@@ -615,6 +623,7 @@ export declare class ChevreConsole {
615
623
  createOfferCatalogItemInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogItemService>;
616
624
  createOfferItemConditionInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferItemConditionService>;
617
625
  createSellerInstance(params: Pick<IOptions, 'project'>): Promise<SellerService>;
626
+ createSellerMakesOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SellerMakesOfferService>;
618
627
  createSellerReturnPolicyInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<SellerReturnPolicyService>;
619
628
  createTaskInstance(params: Pick<IOptions, 'project'>): Promise<TaskService>;
620
629
  createTicketInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TicketService>;
@@ -213,6 +213,9 @@ var service;
213
213
  var Seller;
214
214
  (function (Seller) {
215
215
  })(Seller = service.Seller || (service.Seller = {}));
216
+ var SellerMakesOffer;
217
+ (function (SellerMakesOffer) {
218
+ })(SellerMakesOffer = service.SellerMakesOffer || (service.SellerMakesOffer = {}));
216
219
  var SellerReturnPolicy;
217
220
  (function (SellerReturnPolicy) {
218
221
  })(SellerReturnPolicy = service.SellerReturnPolicy || (service.SellerReturnPolicy = {}));
@@ -1163,6 +1166,23 @@ var ChevreConsole = /** @class */ (function () {
1163
1166
  });
1164
1167
  });
1165
1168
  };
1169
+ ChevreConsole.prototype.createSellerMakesOfferInstance = function (params) {
1170
+ return __awaiter(this, void 0, void 0, function () {
1171
+ var _a;
1172
+ return __generator(this, function (_b) {
1173
+ switch (_b.label) {
1174
+ case 0:
1175
+ if (!(service.SellerMakesOffer.svc === undefined)) return [3 /*break*/, 2];
1176
+ _a = service.SellerMakesOffer;
1177
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreConsole/sellerMakesOffer'); })];
1178
+ case 1:
1179
+ _a.svc = (_b.sent()).SellerMakesOfferService;
1180
+ _b.label = 2;
1181
+ case 2: return [2 /*return*/, new service.SellerMakesOffer.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
1182
+ }
1183
+ });
1184
+ });
1185
+ };
1166
1186
  ChevreConsole.prototype.createSellerReturnPolicyInstance = function (params) {
1167
1187
  return __awaiter(this, void 0, void 0, function () {
1168
1188
  var _a;
package/lib/browser.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * API Javascript Client
3
3
  */
4
- import { factory, loadCloudAdmin, loadCloudAsset, loadCloudPay, loadCloudTxc, loadCloudTxn, loadService, service, transporters } from './abstract';
4
+ import { factory, loadCloudAdmin, loadCloudAsset, loadCloudPay, loadCloudSearch, loadCloudTxc, loadCloudTxn, loadService, service, transporters } from './abstract';
5
5
  import { ImplicitGrantClient, IOptions as IImplicitGrantClientOptions } from './auth/implicitGrantClient';
6
- export { loadCloudAdmin, loadCloudAsset, loadCloudPay, loadCloudTxc, loadCloudTxn, loadService, factory, service, transporters };
6
+ export { loadCloudAdmin, loadCloudAsset, loadCloudPay, loadCloudSearch, loadCloudTxc, loadCloudTxn, loadService, factory, service, transporters };
7
7
  /**
8
8
  * create OAuth2 client instance using implicit grant
9
9
  */
package/lib/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAuthInstance = exports.transporters = exports.factory = exports.loadService = exports.loadCloudTxn = exports.loadCloudTxc = exports.loadCloudPay = exports.loadCloudAsset = exports.loadCloudAdmin = void 0;
3
+ exports.createAuthInstance = exports.transporters = exports.factory = exports.loadService = exports.loadCloudTxn = exports.loadCloudTxc = exports.loadCloudSearch = exports.loadCloudPay = exports.loadCloudAsset = exports.loadCloudAdmin = void 0;
4
4
  /**
5
5
  * API Javascript Client
6
6
  */
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "factory", { enumerable: true, get: function () {
9
9
  Object.defineProperty(exports, "loadCloudAdmin", { enumerable: true, get: function () { return abstract_1.loadCloudAdmin; } });
10
10
  Object.defineProperty(exports, "loadCloudAsset", { enumerable: true, get: function () { return abstract_1.loadCloudAsset; } });
11
11
  Object.defineProperty(exports, "loadCloudPay", { enumerable: true, get: function () { return abstract_1.loadCloudPay; } });
12
+ Object.defineProperty(exports, "loadCloudSearch", { enumerable: true, get: function () { return abstract_1.loadCloudSearch; } });
12
13
  Object.defineProperty(exports, "loadCloudTxc", { enumerable: true, get: function () { return abstract_1.loadCloudTxc; } });
13
14
  Object.defineProperty(exports, "loadCloudTxn", { enumerable: true, get: function () { return abstract_1.loadCloudTxn; } });
14
15
  Object.defineProperty(exports, "loadService", { enumerable: true, get: function () { return abstract_1.loadService; } });