@cinerino/sdk 12.6.0-alpha.2 → 12.6.0-alpha.3
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,110 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as moment from 'moment';
|
|
4
|
+
import { factory, loadChevreConsole } from '../../../../lib/index';
|
|
5
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
|
+
async function main() {
|
|
11
|
+
const authClient = await auth.login();
|
|
12
|
+
await authClient.refreshAccessToken();
|
|
13
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
14
|
+
console.log('username is', loginTicket.getUsername());
|
|
15
|
+
|
|
16
|
+
const eventService = await (await loadChevreConsole({
|
|
17
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
18
|
+
auth: authClient
|
|
19
|
+
})).createEventInstance({
|
|
20
|
+
project,
|
|
21
|
+
seller: { id: '' }
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const availabilityEnds = moment('2025-10-26T05:20:00.000Z')
|
|
25
|
+
.toDate();
|
|
26
|
+
const availabilityStarts = moment('2025-10-23T15:00:00.000Z')
|
|
27
|
+
.toDate();
|
|
28
|
+
const validFrom = moment('2025-10-12T15:00:00.000Z')
|
|
29
|
+
.toDate();
|
|
30
|
+
const validThrough = moment('2025-10-26T05:20:00.000Z')
|
|
31
|
+
.toDate();
|
|
32
|
+
await eventService.updateEventSellerMakesOfferById({
|
|
33
|
+
id: 'bmf595x5y',
|
|
34
|
+
attributes: {
|
|
35
|
+
offers: {
|
|
36
|
+
seller: {
|
|
37
|
+
makesOffer: [
|
|
38
|
+
{
|
|
39
|
+
typeOf: factory.offerType.Offer,
|
|
40
|
+
availableAtOrFrom: {
|
|
41
|
+
id: '3eo6okferrsdpfd9j2ce1iv9k7'
|
|
42
|
+
},
|
|
43
|
+
availabilityEnds,
|
|
44
|
+
availabilityStarts,
|
|
45
|
+
validFrom,
|
|
46
|
+
validThrough
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
typeOf: factory.offerType.Offer,
|
|
50
|
+
availableAtOrFrom: {
|
|
51
|
+
id: '51qbjcfr72h62m06vtv5kkhgje'
|
|
52
|
+
},
|
|
53
|
+
availabilityEnds,
|
|
54
|
+
availabilityStarts,
|
|
55
|
+
validFrom,
|
|
56
|
+
validThrough
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
typeOf: factory.offerType.Offer,
|
|
60
|
+
availableAtOrFrom: {
|
|
61
|
+
id: '5h3gs22mu9j3ok7o63uog9o9i3'
|
|
62
|
+
},
|
|
63
|
+
availabilityEnds,
|
|
64
|
+
availabilityStarts,
|
|
65
|
+
validFrom,
|
|
66
|
+
validThrough
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
typeOf: factory.offerType.Offer,
|
|
70
|
+
availableAtOrFrom: {
|
|
71
|
+
id: '66e7p2g713675v96nrhdm975kg'
|
|
72
|
+
},
|
|
73
|
+
availabilityEnds,
|
|
74
|
+
availabilityStarts,
|
|
75
|
+
validFrom,
|
|
76
|
+
validThrough
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
typeOf: factory.offerType.Offer,
|
|
80
|
+
availableAtOrFrom: {
|
|
81
|
+
id: '7divuoimobsfgq95tp1csorjqq'
|
|
82
|
+
},
|
|
83
|
+
availabilityEnds,
|
|
84
|
+
availabilityStarts,
|
|
85
|
+
validFrom,
|
|
86
|
+
validThrough
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
typeOf: factory.offerType.Offer,
|
|
90
|
+
availableAtOrFrom: {
|
|
91
|
+
id: 'ckevmf3fueqcunnideu6artt'
|
|
92
|
+
},
|
|
93
|
+
availabilityEnds,
|
|
94
|
+
availabilityStarts,
|
|
95
|
+
validFrom,
|
|
96
|
+
validThrough
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
console.log('updated');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
main()
|
|
107
|
+
.then(() => {
|
|
108
|
+
console.log('success!');
|
|
109
|
+
})
|
|
110
|
+
.catch(console.error);
|
|
@@ -35,13 +35,27 @@ export declare class EventService extends Service {
|
|
|
35
35
|
typeOf: factory.eventType.ScreeningEvent;
|
|
36
36
|
}): Promise<factory.event.screeningEvent.IEvent>;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* 興行イベント編集
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
updateEventById(params: {
|
|
41
41
|
id: string;
|
|
42
42
|
attributes: factory.event.screeningEvent.IUpdateParams & {
|
|
43
43
|
$unset?: IUnset;
|
|
44
44
|
};
|
|
45
|
+
options: {
|
|
46
|
+
disableOverwriteMakesOffer: boolean;
|
|
47
|
+
};
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* イベントのアプリケーションオファー編集
|
|
51
|
+
*/
|
|
52
|
+
updateEventSellerMakesOfferById(params: {
|
|
53
|
+
id: string;
|
|
54
|
+
attributes: {
|
|
55
|
+
offers: {
|
|
56
|
+
seller: Pick<factory.event.screeningEvent.ISeller4create, 'makesOffer'>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
45
59
|
}): Promise<void>;
|
|
46
60
|
}
|
|
47
61
|
export {};
|
|
@@ -136,21 +136,44 @@ var EventService = /** @class */ (function (_super) {
|
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* 興行イベント編集
|
|
140
140
|
*/
|
|
141
|
-
EventService.prototype.
|
|
141
|
+
EventService.prototype.updateEventById = function (params) {
|
|
142
|
+
var _a;
|
|
142
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
return __generator(this, function (
|
|
144
|
-
switch (
|
|
144
|
+
return __generator(this, function (_b) {
|
|
145
|
+
switch (_b.label) {
|
|
145
146
|
case 0: return [4 /*yield*/, this.fetch({
|
|
146
147
|
uri: "/events/" + encodeURIComponent(String(params.id)),
|
|
147
148
|
method: 'PUT',
|
|
148
149
|
body: params.attributes,
|
|
149
150
|
qs: {
|
|
150
|
-
typeOf: factory.eventType.ScreeningEvent
|
|
151
|
+
typeOf: factory.eventType.ScreeningEvent,
|
|
152
|
+
// support disableOverwriteMakesOffer(2025-10-26~)
|
|
153
|
+
disableOverwriteMakesOffer: ((_a = params.options) === null || _a === void 0 ? void 0 : _a.disableOverwriteMakesOffer) === true
|
|
151
154
|
},
|
|
152
155
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
153
156
|
})];
|
|
157
|
+
case 1:
|
|
158
|
+
_b.sent();
|
|
159
|
+
return [2 /*return*/];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* イベントのアプリケーションオファー編集
|
|
166
|
+
*/
|
|
167
|
+
EventService.prototype.updateEventSellerMakesOfferById = function (params) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
169
|
+
return __generator(this, function (_a) {
|
|
170
|
+
switch (_a.label) {
|
|
171
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
172
|
+
uri: "/events/" + encodeURIComponent(String(params.id)) + "/sellerMakesOffer",
|
|
173
|
+
method: 'PUT',
|
|
174
|
+
body: params.attributes,
|
|
175
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
176
|
+
})];
|
|
154
177
|
case 1:
|
|
155
178
|
_a.sent();
|
|
156
179
|
return [2 /*return*/];
|
package/lib/bundle.js
CHANGED
|
@@ -10342,21 +10342,44 @@ var EventService = /** @class */ (function (_super) {
|
|
|
10342
10342
|
});
|
|
10343
10343
|
};
|
|
10344
10344
|
/**
|
|
10345
|
-
*
|
|
10345
|
+
* 興行イベント編集
|
|
10346
10346
|
*/
|
|
10347
|
-
EventService.prototype.
|
|
10347
|
+
EventService.prototype.updateEventById = function (params) {
|
|
10348
|
+
var _a;
|
|
10348
10349
|
return __awaiter(this, void 0, void 0, function () {
|
|
10349
|
-
return __generator(this, function (
|
|
10350
|
-
switch (
|
|
10350
|
+
return __generator(this, function (_b) {
|
|
10351
|
+
switch (_b.label) {
|
|
10351
10352
|
case 0: return [4 /*yield*/, this.fetch({
|
|
10352
10353
|
uri: "/events/" + encodeURIComponent(String(params.id)),
|
|
10353
10354
|
method: 'PUT',
|
|
10354
10355
|
body: params.attributes,
|
|
10355
10356
|
qs: {
|
|
10356
|
-
typeOf: factory.eventType.ScreeningEvent
|
|
10357
|
+
typeOf: factory.eventType.ScreeningEvent,
|
|
10358
|
+
// support disableOverwriteMakesOffer(2025-10-26~)
|
|
10359
|
+
disableOverwriteMakesOffer: ((_a = params.options) === null || _a === void 0 ? void 0 : _a.disableOverwriteMakesOffer) === true
|
|
10357
10360
|
},
|
|
10358
10361
|
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
10359
10362
|
})];
|
|
10363
|
+
case 1:
|
|
10364
|
+
_b.sent();
|
|
10365
|
+
return [2 /*return*/];
|
|
10366
|
+
}
|
|
10367
|
+
});
|
|
10368
|
+
});
|
|
10369
|
+
};
|
|
10370
|
+
/**
|
|
10371
|
+
* イベントのアプリケーションオファー編集
|
|
10372
|
+
*/
|
|
10373
|
+
EventService.prototype.updateEventSellerMakesOfferById = function (params) {
|
|
10374
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
10375
|
+
return __generator(this, function (_a) {
|
|
10376
|
+
switch (_a.label) {
|
|
10377
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
10378
|
+
uri: "/events/" + encodeURIComponent(String(params.id)) + "/sellerMakesOffer",
|
|
10379
|
+
method: 'PUT',
|
|
10380
|
+
body: params.attributes,
|
|
10381
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
10382
|
+
})];
|
|
10360
10383
|
case 1:
|
|
10361
10384
|
_a.sent();
|
|
10362
10385
|
return [2 /*return*/];
|