@cinerino/sdk 12.3.0-alpha.5 → 12.3.0-alpha.7

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,103 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as moment from 'moment-timezone';
4
+ import * as client from '../../../../lib/index';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '5a392dfdfca1c8737fb6da42';
8
+ const EVENT_SERVICE_ID = '630b139e4dd0621c0496a30c';
9
+ const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
10
+ const ADDITIONAL_PROPERTY_NAME = 'oldEventId';
11
+ const SUPER_EVENT_ID = '7kaf1djmz';
12
+ const LOCATION_BRANCH_CODE = '01';
13
+
14
+ // tslint:disable-next-line:max-func-body-length
15
+ async function main() {
16
+ const authClient = await client.auth.ClientCredentials.createInstance({
17
+ domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
18
+ clientId: <string>process.env.CHEVRE_CLIENT_ID,
19
+ clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
20
+ scopes: [],
21
+ state: ''
22
+ });
23
+
24
+ const eventService = await (await client.loadChevreAdmin({
25
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
26
+ auth: authClient
27
+ })).createEventInstance({
28
+ project: { id: PROJECT_ID },
29
+ seller: { id: SELLER_ID }
30
+ });
31
+
32
+ const today = moment()
33
+ .tz('Asia/Tokyo')
34
+ .format('YYYY-MM-DD');
35
+ const identifier = '250909001001010900';
36
+ await eventService.createIfNotExistByIdentifier(
37
+ [
38
+ {
39
+ identifier,
40
+ doorTime: moment(`${today}T13:00:00Z`)
41
+ .toDate(),
42
+ startDate: moment(`${today}T13:00:00Z`)
43
+ .toDate(),
44
+ endDate: moment(`${today}T14:00:00Z`)
45
+ .toDate(),
46
+ eventStatus: client.factory.eventStatusType.EventScheduled,
47
+ additionalProperty: [
48
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
49
+ ],
50
+ offers: {
51
+ unacceptedPaymentMethod: [],
52
+ eligibleQuantity: {
53
+ maxValue: 6
54
+ },
55
+ itemOffered: {
56
+ id: EVENT_SERVICE_ID
57
+ },
58
+ seller: {
59
+ makesOffer: [
60
+ {
61
+ typeOf: client.factory.offerType.Offer,
62
+ availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
63
+ availabilityStarts: moment(`${today}T00:00:00+09:00`)
64
+ .toDate(),
65
+ availabilityEnds: moment(`${today}T14:00:00Z`)
66
+ .toDate(),
67
+ validFrom: moment(`${today}T00:00:00+09:00`)
68
+ .toDate(),
69
+ validThrough: moment(`${today}T14:00:00Z`)
70
+ .toDate()
71
+ }
72
+ ]
73
+ // makesOfferDefaultを指定するとmakesOfferよりも優先される
74
+ // makesOfferDefault: {
75
+ // typeOf: client.factory.offerType.Offer,
76
+ // availabilityStarts: moment('2024-05-11T00:00:00.000Z')
77
+ // .toDate(),
78
+ // availabilityEnds: moment('2024-05-12T00:00:00.000Z')
79
+ // .toDate(),
80
+ // validFrom: moment('2024-05-11T00:00:00.000Z')
81
+ // .toDate(),
82
+ // validThrough: moment('2024-05-12T00:00:00.000Z')
83
+ // .toDate()
84
+ // }
85
+ }
86
+ }
87
+ }
88
+ ],
89
+ {
90
+ locationBranchCode: LOCATION_BRANCH_CODE,
91
+ superEventId: SUPER_EVENT_ID,
92
+ hasTicketedSeat: true,
93
+ typeOf: client.factory.eventType.ScreeningEvent
94
+ }
95
+ );
96
+ console.log('created.');
97
+ }
98
+
99
+ main()
100
+ .then(() => {
101
+ console.log('success!');
102
+ })
103
+ .catch(console.error);
@@ -0,0 +1,71 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as client from '../../../../lib/index';
4
+ import * as auth from '../../auth/authAsAdmin';
5
+
6
+ const PROJECT_ID = String(process.env.PROJECT_ID);
7
+ const SELLER_ID = '59d20831e53ebc2b4e774466';
8
+ const EVENT_SERVICE_ID = '656038908b1cd5ce629f5992';
9
+ // const EVENT_SERVICE_ID = '656038908b1cd5ce629f5991';
10
+
11
+ // tslint:disable-next-line:max-func-body-length
12
+ async function main() {
13
+ const authClient = await auth.login();
14
+ await authClient.refreshAccessToken();
15
+ const loginTicket = authClient.verifyIdToken({});
16
+ console.log('username is', loginTicket.getUsername());
17
+
18
+ const noteService = await (await client.loadChevreAdmin({
19
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
20
+ auth: authClient
21
+ })).createNoteInstance({
22
+ project: { id: PROJECT_ID },
23
+ seller: { id: SELLER_ID }
24
+ });
25
+
26
+ await noteService.createNotesByIdentifier(
27
+ [
28
+ {
29
+ about: { id: EVENT_SERVICE_ID },
30
+ identifier: 'abcdefgh',
31
+ text: 'sample note text...'
32
+ }
33
+ ],
34
+ {
35
+ aboutTypeOf: client.factory.product.ProductType.EventService
36
+ }
37
+ );
38
+ console.log('created.');
39
+
40
+ await noteService.updateNotesByIdentifier(
41
+ [
42
+ {
43
+ about: { id: EVENT_SERVICE_ID },
44
+ identifier: 'abcdefgh',
45
+ text: 'updated text xxxxx'
46
+ }
47
+ ],
48
+ {
49
+ aboutTypeOf: client.factory.product.ProductType.EventService
50
+ }
51
+ );
52
+ console.log('updated.');
53
+
54
+ const notes = await noteService.findNotes({
55
+ limit: 10,
56
+ page: 1,
57
+ aboutTypeOf: client.factory.product.ProductType.EventService,
58
+ inclusion: ['id', 'identifier', 'text', 'about']
59
+ // aboutIds: [EVENT_SERVICE_ID],
60
+ // identifiers: ['abcdefgh', 'xxx']
61
+ });
62
+ // tslint:disable-next-line:no-null-keyword
63
+ console.dir(notes, { depth: null });
64
+ console.log(notes.length, 'notes found');
65
+ }
66
+
67
+ main()
68
+ .then(() => {
69
+ console.log('success!');
70
+ })
71
+ .catch(console.error);
@@ -0,0 +1,102 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as moment from 'moment-timezone';
4
+ import * as client from '../../../../lib/index';
5
+ // import * as auth from '../../auth/authAsAdmin';
6
+ import { auth } from '../../auth/clientCredentials';
7
+
8
+ const PROJECT_ID = String(process.env.PROJECT_ID);
9
+ const SELLER_ID = '5a392dfdfca1c8737fb6da42';
10
+ const EVENT_SERVICE_ID = '630b139e4dd0621c0496a30c';
11
+ const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
12
+ const ADDITIONAL_PROPERTY_NAME = 'oldEventId';
13
+ const SUPER_EVENT_ID = '7kaf1djmz';
14
+ const LOCATION_BRANCH_CODE = '01';
15
+
16
+ // tslint:disable-next-line:max-func-body-length
17
+ async function main() {
18
+ // const authClient = await auth.login();
19
+ // await authClient.refreshAccessToken();
20
+ // const loginTicket = authClient.verifyIdToken({});
21
+ // console.log('username is', loginTicket.getUsername());
22
+
23
+ const eventService = await (await client.loadCloudAdmin({
24
+ endpoint: <string>process.env.API_ADMIN_ENDPOINT,
25
+ auth: await auth()
26
+ })).createEventInstance({
27
+ project: { id: PROJECT_ID },
28
+ seller: { id: SELLER_ID }
29
+ });
30
+
31
+ const today = moment()
32
+ .tz('Asia/Tokyo')
33
+ .format('YYYY-MM-DD');
34
+ const identifier = '250909001001010900';
35
+ await eventService.createIfNotExistByIdentifier(
36
+ [
37
+ {
38
+ identifier,
39
+ doorTime: moment(`${today}T13:00:00Z`)
40
+ .toDate(),
41
+ startDate: moment(`${today}T13:00:00Z`)
42
+ .toDate(),
43
+ endDate: moment(`${today}T14:00:00Z`)
44
+ .toDate(),
45
+ eventStatus: client.factory.eventStatusType.EventScheduled,
46
+ additionalProperty: [
47
+ { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
48
+ ],
49
+ offers: {
50
+ unacceptedPaymentMethod: [],
51
+ eligibleQuantity: {
52
+ maxValue: 6
53
+ },
54
+ itemOffered: {
55
+ id: EVENT_SERVICE_ID
56
+ },
57
+ seller: {
58
+ makesOffer: [
59
+ {
60
+ typeOf: client.factory.offerType.Offer,
61
+ availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
62
+ availabilityStarts: moment(`${today}T00:00:00+09:00`)
63
+ .toDate(),
64
+ availabilityEnds: moment(`${today}T14:00:00Z`)
65
+ .toDate(),
66
+ validFrom: moment(`${today}T00:00:00+09:00`)
67
+ .toDate(),
68
+ validThrough: moment(`${today}T14:00:00Z`)
69
+ .toDate()
70
+ }
71
+ ]
72
+ // makesOfferDefaultを指定するとmakesOfferよりも優先される
73
+ // makesOfferDefault: {
74
+ // typeOf: client.factory.offerType.Offer,
75
+ // availabilityStarts: moment('2024-05-11T00:00:00.000Z')
76
+ // .toDate(),
77
+ // availabilityEnds: moment('2024-05-12T00:00:00.000Z')
78
+ // .toDate(),
79
+ // validFrom: moment('2024-05-11T00:00:00.000Z')
80
+ // .toDate(),
81
+ // validThrough: moment('2024-05-12T00:00:00.000Z')
82
+ // .toDate()
83
+ // }
84
+ }
85
+ }
86
+ }
87
+ ],
88
+ {
89
+ locationBranchCode: LOCATION_BRANCH_CODE,
90
+ superEventId: SUPER_EVENT_ID,
91
+ hasTicketedSeat: true,
92
+ typeOf: client.factory.eventType.ScreeningEvent
93
+ }
94
+ );
95
+ console.log('created.');
96
+ }
97
+
98
+ main()
99
+ .then(() => {
100
+ console.log('success!');
101
+ })
102
+ .catch(console.error);
@@ -14,9 +14,9 @@ async function main() {
14
14
  seller: { id: '' }
15
15
  });
16
16
  const orders = await orderService.findByConfirmationNumber({
17
- confirmationNumber: '96678',
17
+ confirmationNumber: '74441',
18
18
  customer: {
19
- telephone: '+819012345678'
19
+ telephone: '+819011111111'
20
20
  }
21
21
  });
22
22
  // tslint:disable-next-line:no-null-keyword
@@ -19,7 +19,8 @@ async function main() {
19
19
  page: 1,
20
20
  typeOf: factory.product.ProductType.EventService
21
21
  });
22
- console.log(result);
22
+ // tslint:disable-next-line:no-null-keyword
23
+ console.dir(result, { depth: null });
23
24
  console.log(result.length, 'data found');
24
25
  }
25
26
 
@@ -3,13 +3,13 @@ import { Service } from '../service';
3
3
  declare type ISendEmailMessageOnEventUpdated = Pick<factory.action.transfer.send.message.email.IAttributes, 'purpose' | 'recipient'> & {
4
4
  object: factory.action.transfer.send.message.email.IObjectAsEmailMessage;
5
5
  };
6
- declare type ICreateParamsByIdentifier = Pick<factory.event.ICreateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
6
+ export declare type ICreateParamsByIdentifier = Pick<factory.event.ICreateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
7
7
  identifier: string;
8
8
  offers: Pick<factory.event.screeningEvent.IOffers4create, 'eligibleQuantity' | 'seller' | 'unacceptedPaymentMethod'> & {
9
9
  itemOffered: Pick<factory.event.screeningEvent.IItemOffered, 'id'>;
10
10
  };
11
11
  };
12
- declare type IUpdateParamsByIdentifier = Pick<factory.event.IUpdateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
12
+ export declare type IUpdateParamsByIdentifier = Pick<factory.event.IUpdateParams<factory.eventType.ScreeningEvent>, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
13
13
  identifier: string;
14
14
  offers: Pick<factory.event.screeningEvent.IOffers4create, 'eligibleQuantity' | 'seller' | 'unacceptedPaymentMethod'> & {
15
15
  itemOffered: Pick<factory.event.screeningEvent.IItemOffered, 'id'>;
@@ -1,21 +1,61 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
3
  declare type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
4
- declare type IKeyOfProjection = keyof INoteDigitalDocument;
5
- declare type ICreateParams = Pick<INoteDigitalDocument, 'identifier' | 'text'> & {
6
- about: Pick<factory.creativeWork.noteDigitalDocument.IAbout, 'id' | 'typeOf'>;
7
- };
4
+ interface ICreateParams {
5
+ /**
6
+ * メモ識別子
7
+ */
8
+ identifier: string;
9
+ /**
10
+ * メモコンテンツ
11
+ */
12
+ text: string;
13
+ about: {
14
+ /**
15
+ * メモの主題リソースID
16
+ */
17
+ id: string;
18
+ };
19
+ }
20
+ interface IDeleteParams {
21
+ id: string;
22
+ }
23
+ export interface IFindParams {
24
+ limit: number;
25
+ page: number;
26
+ inclusion?: (keyof factory.creativeWork.noteDigitalDocument.INoteDigitalDocument)[];
27
+ /**
28
+ * 主題リソースタイプ
29
+ */
30
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
31
+ /**
32
+ * 主題リソースIDリスト
33
+ * max: 10
34
+ */
35
+ aboutIds?: string[];
36
+ /**
37
+ * メモ識別子リスト
38
+ * max: 10
39
+ */
40
+ identifiers?: string[];
41
+ /**
42
+ * メモID
43
+ */
44
+ id?: string;
45
+ }
8
46
  /**
9
47
  * メモサービス
10
48
  */
11
49
  export declare class NoteService extends Service {
12
- upsertByIdentifier(params: ICreateParams[]): Promise<void>;
13
- search(params: Omit<factory.creativeWork.noteDigitalDocument.ISearchConditions, 'project'> & {
14
- inclusion: IKeyOfProjection[];
15
- exclusion: IKeyOfProjection[];
16
- }): Promise<(INoteDigitalDocument & {
50
+ createNotesByIdentifier(params: ICreateParams[], options: {
51
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
52
+ }): Promise<void>;
53
+ updateNotesByIdentifier(params: ICreateParams[], options: {
54
+ aboutTypeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
55
+ }): Promise<void>;
56
+ findNotes(params: IFindParams): Promise<(INoteDigitalDocument & {
17
57
  id: string;
18
58
  })[]>;
19
- updateById(id: string, body: Pick<INoteDigitalDocument, 'text'>): Promise<void>;
59
+ deleteNotesByIds(params: IDeleteParams[]): Promise<void>;
20
60
  }
21
61
  export {};
@@ -54,6 +54,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.NoteService = void 0;
55
55
  var http_status_1 = require("http-status");
56
56
  var service_1 = require("../service");
57
+ var BASE_URI = '/creativeWorks/noteDigitalDocument';
57
58
  /**
58
59
  * メモサービス
59
60
  */
@@ -62,16 +63,41 @@ var NoteService = /** @class */ (function (_super) {
62
63
  function NoteService() {
63
64
  return _super !== null && _super.apply(this, arguments) || this;
64
65
  }
65
- NoteService.prototype.upsertByIdentifier = function (params) {
66
+ NoteService.prototype.createNotesByIdentifier = function (params, options) {
66
67
  return __awaiter(this, void 0, void 0, function () {
68
+ var aboutTypeOf;
67
69
  return __generator(this, function (_a) {
68
70
  switch (_a.label) {
69
- case 0: return [4 /*yield*/, this.fetch({
70
- uri: '/notes',
71
- method: 'PUT',
72
- body: params,
73
- expectedStatusCodes: [http_status_1.NO_CONTENT]
74
- })];
71
+ case 0:
72
+ aboutTypeOf = options.aboutTypeOf;
73
+ return [4 /*yield*/, this.fetch({
74
+ uri: BASE_URI,
75
+ method: 'POST',
76
+ body: params,
77
+ qs: { aboutTypeOf: aboutTypeOf },
78
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
79
+ })];
80
+ case 1:
81
+ _a.sent();
82
+ return [2 /*return*/];
83
+ }
84
+ });
85
+ });
86
+ };
87
+ NoteService.prototype.updateNotesByIdentifier = function (params, options) {
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ var aboutTypeOf;
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0:
93
+ aboutTypeOf = options.aboutTypeOf;
94
+ return [4 /*yield*/, this.fetch({
95
+ uri: BASE_URI,
96
+ method: 'PUT',
97
+ body: params,
98
+ qs: { aboutTypeOf: aboutTypeOf },
99
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
100
+ })];
75
101
  case 1:
76
102
  _a.sent();
77
103
  return [2 /*return*/];
@@ -79,12 +105,12 @@ var NoteService = /** @class */ (function (_super) {
79
105
  });
80
106
  });
81
107
  };
82
- NoteService.prototype.search = function (params) {
108
+ NoteService.prototype.findNotes = function (params) {
83
109
  return __awaiter(this, void 0, void 0, function () {
84
110
  var _this = this;
85
111
  return __generator(this, function (_a) {
86
112
  return [2 /*return*/, this.fetch({
87
- uri: '/notes',
113
+ uri: BASE_URI,
88
114
  method: 'GET',
89
115
  qs: params,
90
116
  expectedStatusCodes: [http_status_1.OK]
@@ -95,19 +121,16 @@ var NoteService = /** @class */ (function (_super) {
95
121
  });
96
122
  });
97
123
  };
98
- NoteService.prototype.updateById = function (id, body) {
124
+ NoteService.prototype.deleteNotesByIds = function (params) {
99
125
  return __awaiter(this, void 0, void 0, function () {
100
- var text;
101
126
  return __generator(this, function (_a) {
102
127
  switch (_a.label) {
103
- case 0:
104
- text = body.text;
105
- return [4 /*yield*/, this.fetch({
106
- uri: "/notes/" + String(id),
107
- method: 'PUT',
108
- body: { text: text },
109
- expectedStatusCodes: [http_status_1.NO_CONTENT]
110
- })];
128
+ case 0: return [4 /*yield*/, this.fetch({
129
+ uri: BASE_URI,
130
+ method: 'DELETE',
131
+ body: params,
132
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
133
+ })];
111
134
  case 1:
112
135
  _a.sent();
113
136
  return [2 /*return*/];
@@ -0,0 +1,21 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ declare type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
4
+ declare type IKeyOfProjection = keyof INoteDigitalDocument;
5
+ declare type ICreateParams = Pick<INoteDigitalDocument, 'identifier' | 'text'> & {
6
+ about: Pick<factory.creativeWork.noteDigitalDocument.IAbout, 'id' | 'typeOf'>;
7
+ };
8
+ /**
9
+ * 注文メモサービス
10
+ */
11
+ export declare class NoteAboutOrderService extends Service {
12
+ upsertByIdentifier(params: ICreateParams[]): Promise<void>;
13
+ search(params: Omit<factory.creativeWork.noteDigitalDocument.ISearchConditions, 'project'> & {
14
+ inclusion: IKeyOfProjection[];
15
+ exclusion: IKeyOfProjection[];
16
+ }): Promise<(INoteDigitalDocument & {
17
+ id: string;
18
+ })[]>;
19
+ updateById(id: string, body: Pick<INoteDigitalDocument, 'text'>): Promise<void>;
20
+ }
21
+ export {};
@@ -0,0 +1,120 @@
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.NoteAboutOrderService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 注文メモサービス
59
+ */
60
+ var NoteAboutOrderService = /** @class */ (function (_super) {
61
+ __extends(NoteAboutOrderService, _super);
62
+ function NoteAboutOrderService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ NoteAboutOrderService.prototype.upsertByIdentifier = function (params) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0: return [4 /*yield*/, this.fetch({
70
+ uri: '/notes',
71
+ method: 'PUT',
72
+ body: params,
73
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
74
+ })];
75
+ case 1:
76
+ _a.sent();
77
+ return [2 /*return*/];
78
+ }
79
+ });
80
+ });
81
+ };
82
+ NoteAboutOrderService.prototype.search = function (params) {
83
+ return __awaiter(this, void 0, void 0, function () {
84
+ var _this = this;
85
+ return __generator(this, function (_a) {
86
+ return [2 /*return*/, this.fetch({
87
+ uri: '/notes',
88
+ method: 'GET',
89
+ qs: params,
90
+ expectedStatusCodes: [http_status_1.OK]
91
+ })
92
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
93
+ return [2 /*return*/, response.json()];
94
+ }); }); })];
95
+ });
96
+ });
97
+ };
98
+ NoteAboutOrderService.prototype.updateById = function (id, body) {
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ var text;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0:
104
+ text = body.text;
105
+ return [4 /*yield*/, this.fetch({
106
+ uri: "/notes/" + String(id),
107
+ method: 'PUT',
108
+ body: { text: text },
109
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
110
+ })];
111
+ case 1:
112
+ _a.sent();
113
+ return [2 /*return*/];
114
+ }
115
+ });
116
+ });
117
+ };
118
+ return NoteAboutOrderService;
119
+ }(service_1.Service));
120
+ exports.NoteAboutOrderService = NoteAboutOrderService;