@cinerino/sdk 12.8.0-alpha.0 → 12.8.0-alpha.2

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.
@@ -6,7 +6,7 @@ import * as auth from '../../auth/authAsAdmin';
6
6
  const PROJECT_ID = String(process.env.PROJECT_ID);
7
7
  const SELLER_ID = '59d20831e53ebc2b4e774466';
8
8
  const OFFER_IDENTIFIER = '20251115eventOffer01';
9
- const itemOfferedIdentifier = '20251113ABC12345102300';
9
+ const itemOfferedId = '69151228ad580da66c8b5068';
10
10
 
11
11
  // tslint:disable-next-line:max-func-body-length
12
12
  async function main() {
@@ -34,7 +34,7 @@ async function main() {
34
34
  }
35
35
  ],
36
36
  {
37
- itemOfferedIdentifier
37
+ itemOfferedId
38
38
  }
39
39
  );
40
40
  console.log('created.');
@@ -49,7 +49,7 @@ async function main() {
49
49
  }
50
50
  ],
51
51
  {
52
- itemOfferedIdentifier
52
+ itemOfferedId
53
53
  }
54
54
  );
55
55
  console.log('updated.');
@@ -58,7 +58,7 @@ async function main() {
58
58
  limit: 10,
59
59
  page: 1,
60
60
  // itemOfferedId: '691511df7d9f0e2df3d6dcf7'
61
- itemOfferedId: '69151228ad580da66c8b5068'
61
+ itemOfferedId: itemOfferedId
62
62
  });
63
63
  // tslint:disable-next-line:no-null-keyword
64
64
  console.dir(offers, { depth: null });
@@ -0,0 +1,29 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ export interface IFindParams {
4
+ /**
5
+ * max: 20
6
+ */
7
+ limit: number;
8
+ page: number;
9
+ /**
10
+ * アプリケーションコード
11
+ */
12
+ availableAtOrFromIdentifier?: string;
13
+ /**
14
+ * イベントID
15
+ */
16
+ itemOfferedId?: string;
17
+ /**
18
+ * イベントIDリスト
19
+ * max length: 10
20
+ */
21
+ itemOfferedIds?: string[];
22
+ }
23
+ export declare type IEventOfferAsFindResult = Pick<factory.eventOffer.IEventOffer, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough'>;
24
+ /**
25
+ * 拡張イベントオファーサービス
26
+ */
27
+ export declare class EventOfferService extends Service {
28
+ findEventOffers(params: IFindParams): Promise<IEventOfferAsFindResult[]>;
29
+ }
@@ -0,0 +1,84 @@
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.EventOfferService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ var BASE_URI = '/eventOffers';
58
+ /**
59
+ * 拡張イベントオファーサービス
60
+ */
61
+ var EventOfferService = /** @class */ (function (_super) {
62
+ __extends(EventOfferService, _super);
63
+ function EventOfferService() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ EventOfferService.prototype.findEventOffers = function (params) {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var _this = this;
69
+ return __generator(this, function (_a) {
70
+ return [2 /*return*/, this.fetch({
71
+ uri: BASE_URI,
72
+ method: 'GET',
73
+ qs: params,
74
+ expectedStatusCodes: [http_status_1.OK]
75
+ })
76
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
77
+ return [2 /*return*/, response.json()];
78
+ }); }); })];
79
+ });
80
+ });
81
+ };
82
+ return EventOfferService;
83
+ }(service_1.Service));
84
+ exports.EventOfferService = EventOfferService;
@@ -3,6 +3,7 @@ import type { CategoryCodeService } from './chevre/categoryCode';
3
3
  import type { CreativeWorkService } from './chevre/creativeWork';
4
4
  import type { EmailMessageService } from './chevre/emailMessage';
5
5
  import type { EventService } from './chevre/event';
6
+ import type { EventOfferService } from './chevre/eventOffer';
6
7
  import type { EventSeriesService } from './chevre/eventSeries';
7
8
  import type { NoteService } from './chevre/note';
8
9
  import type { PaymentProductService } from './chevre/paymentService';
@@ -42,6 +43,13 @@ export declare namespace service {
42
43
  namespace Event {
43
44
  let svc: typeof EventService | undefined;
44
45
  }
46
+ /**
47
+ * イベントオファーサービス
48
+ */
49
+ type EventOffer = EventOfferService;
50
+ namespace EventOffer {
51
+ let svc: typeof EventOfferService | undefined;
52
+ }
45
53
  /**
46
54
  * 施設コンテンツサービス
47
55
  */
@@ -118,6 +126,7 @@ export declare class Chevre {
118
126
  createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
119
127
  createEmailMessageInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EmailMessageService>;
120
128
  createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
129
+ createEventOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventOfferService>;
121
130
  createEventSeriesInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventSeriesService>;
122
131
  createNoteInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<NoteService>;
123
132
  createPaymentProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentProductService>;
@@ -62,6 +62,9 @@ var service;
62
62
  var Event;
63
63
  (function (Event) {
64
64
  })(Event = service.Event || (service.Event = {}));
65
+ var EventOffer;
66
+ (function (EventOffer) {
67
+ })(EventOffer = service.EventOffer || (service.EventOffer = {}));
65
68
  var EventSeries;
66
69
  (function (EventSeries) {
67
70
  })(EventSeries = service.EventSeries || (service.EventSeries = {}));
@@ -168,6 +171,23 @@ var Chevre = /** @class */ (function () {
168
171
  });
169
172
  });
170
173
  };
174
+ Chevre.prototype.createEventOfferInstance = function (params) {
175
+ return __awaiter(this, void 0, void 0, function () {
176
+ var _a;
177
+ return __generator(this, function (_b) {
178
+ switch (_b.label) {
179
+ case 0:
180
+ if (!(service.EventOffer.svc === undefined)) return [3 /*break*/, 2];
181
+ _a = service.EventOffer;
182
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/eventOffer'); })];
183
+ case 1:
184
+ _a.svc = (_b.sent()).EventOfferService;
185
+ _b.label = 2;
186
+ case 2: return [2 /*return*/, new service.EventOffer.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
187
+ }
188
+ });
189
+ });
190
+ };
171
191
  Chevre.prototype.createEventSeriesInstance = function (params) {
172
192
  return __awaiter(this, void 0, void 0, function () {
173
193
  var _a;
@@ -7,6 +7,10 @@ export interface IFindParams {
7
7
  */
8
8
  limit: number;
9
9
  page: number;
10
+ /**
11
+ * アプリケーションコード
12
+ */
13
+ availableAtOrFromIdentifier?: string;
10
14
  /**
11
15
  * イベントID
12
16
  */
@@ -33,9 +37,9 @@ export declare class EventOfferService extends Service {
33
37
  */
34
38
  params: ICreatingEventOffer[], options: {
35
39
  /**
36
- * イベント識別子
40
+ * イベントID
37
41
  */
38
- itemOfferedIdentifier: string;
42
+ itemOfferedId: string;
39
43
  }): Promise<void>;
40
44
  updateEventOfferByIdentifier(
41
45
  /**
@@ -43,9 +47,9 @@ export declare class EventOfferService extends Service {
43
47
  */
44
48
  params: ICreatingEventOffer[], options: {
45
49
  /**
46
- * イベント識別子
50
+ * イベントID
47
51
  */
48
- itemOfferedIdentifier: string;
52
+ itemOfferedId: string;
49
53
  }): Promise<void>;
50
54
  findEventOffers(params: IFindParams): Promise<(Omit<factory.eventOffer.IEventOffer, 'project'> & {
51
55
  id: string;
@@ -69,16 +69,16 @@ var EventOfferService = /** @class */ (function (_super) {
69
69
  */
70
70
  params, options) {
71
71
  return __awaiter(this, void 0, void 0, function () {
72
- var itemOfferedIdentifier;
72
+ var itemOfferedId;
73
73
  return __generator(this, function (_a) {
74
74
  switch (_a.label) {
75
75
  case 0:
76
- itemOfferedIdentifier = options.itemOfferedIdentifier;
76
+ itemOfferedId = options.itemOfferedId;
77
77
  return [4 /*yield*/, this.fetch({
78
78
  uri: BASE_URI,
79
79
  method: 'POST',
80
80
  body: params,
81
- qs: { itemOfferedIdentifier: itemOfferedIdentifier },
81
+ qs: { itemOfferedId: itemOfferedId },
82
82
  expectedStatusCodes: [http_status_1.NO_CONTENT]
83
83
  })];
84
84
  case 1:
@@ -94,16 +94,16 @@ var EventOfferService = /** @class */ (function (_super) {
94
94
  */
95
95
  params, options) {
96
96
  return __awaiter(this, void 0, void 0, function () {
97
- var itemOfferedIdentifier;
97
+ var itemOfferedId;
98
98
  return __generator(this, function (_a) {
99
99
  switch (_a.label) {
100
100
  case 0:
101
- itemOfferedIdentifier = options.itemOfferedIdentifier;
101
+ itemOfferedId = options.itemOfferedId;
102
102
  return [4 /*yield*/, this.fetch({
103
103
  uri: BASE_URI,
104
104
  method: 'PUT',
105
105
  body: params,
106
- qs: { itemOfferedIdentifier: itemOfferedIdentifier },
106
+ qs: { itemOfferedId: itemOfferedId },
107
107
  expectedStatusCodes: [http_status_1.NO_CONTENT]
108
108
  })];
109
109
  case 1: