@cinerino/sdk 5.4.0-alpha.6 → 5.4.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.
- package/example/playground/public/lib/bundle.js +2 -1
- package/example/src/adminOfferCatalogs.ts +46 -0
- package/example/src/adminOffers.ts +31 -10
- package/lib/abstract/admin/creativeWork.d.ts +6 -3
- package/lib/abstract/admin/creativeWork.js +6 -3
- package/lib/abstract/admin/event.d.ts +6 -3
- package/lib/abstract/admin/event.js +6 -3
- package/lib/abstract/admin/offer.d.ts +8 -0
- package/lib/abstract/admin/offer.js +25 -0
- package/lib/abstract/admin/offerCatalog.d.ts +15 -0
- package/lib/abstract/admin/offerCatalog.js +92 -0
- package/lib/abstract/admin.d.ts +9 -0
- package/lib/abstract/admin.js +20 -0
- package/lib/abstract/chevreAdmin/offerCatalog.d.ts +1 -1
- package/lib/abstract/chevreAdmin/product.d.ts +16 -5
- package/lib/abstract/chevreAdmin/product.js +39 -3
- package/lib/browser.d.ts +2 -2
- package/lib/browser.js +2 -1
- package/lib/bundle.js +644 -462
- package/package.json +2 -2
|
@@ -19847,12 +19847,13 @@ exports.default = OAuth2client;
|
|
|
19847
19847
|
},{"../abstract/transporters":115,"./loginTicket":126,"buffer":309,"crypto":308,"debug":313,"http-status":321,"isomorphic-fetch":324,"querystring":334}],128:[function(require,module,exports){
|
|
19848
19848
|
"use strict";
|
|
19849
19849
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19850
|
-
exports.createAuthInstance = exports.transporters = exports.loadService = exports.
|
|
19850
|
+
exports.createAuthInstance = exports.transporters = exports.factory = exports.loadService = exports.loadAdmin = void 0;
|
|
19851
19851
|
/**
|
|
19852
19852
|
* API Javascript Client
|
|
19853
19853
|
*/
|
|
19854
19854
|
var abstract_1 = require("./abstract");
|
|
19855
19855
|
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return abstract_1.factory; } });
|
|
19856
|
+
Object.defineProperty(exports, "loadAdmin", { enumerable: true, get: function () { return abstract_1.loadAdmin; } });
|
|
19856
19857
|
Object.defineProperty(exports, "loadService", { enumerable: true, get: function () { return abstract_1.loadService; } });
|
|
19857
19858
|
Object.defineProperty(exports, "transporters", { enumerable: true, get: function () { return abstract_1.transporters; } });
|
|
19858
19859
|
var implicitGrantClient_1 = require("./auth/implicitGrantClient");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import { factory, loadAdmin } 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 auth.login();
|
|
9
|
+
await authClient.refreshAccessToken();
|
|
10
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
11
|
+
console.log('username is', loginTicket.getUsername());
|
|
12
|
+
|
|
13
|
+
const offerCatalogService = await (await loadAdmin({
|
|
14
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
15
|
+
auth: authClient
|
|
16
|
+
})).createOfferCatalogInstance({
|
|
17
|
+
project,
|
|
18
|
+
seller: { id: '' }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
await offerCatalogService.upsertByIdentifier([
|
|
22
|
+
{
|
|
23
|
+
identifier: '2023121801',
|
|
24
|
+
itemListElement: [
|
|
25
|
+
{ id: '1001', typeOf: factory.offerType.Offer }
|
|
26
|
+
],
|
|
27
|
+
itemOffered: { typeOf: factory.product.ProductType.EventService },
|
|
28
|
+
name: {
|
|
29
|
+
en: 'xxx',
|
|
30
|
+
ja: 'xxx'
|
|
31
|
+
},
|
|
32
|
+
description: {
|
|
33
|
+
en: 'xxx',
|
|
34
|
+
ja: 'xxx'
|
|
35
|
+
},
|
|
36
|
+
additionalProperty: []
|
|
37
|
+
}
|
|
38
|
+
]);
|
|
39
|
+
console.log('upserted');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
main()
|
|
43
|
+
.then(() => {
|
|
44
|
+
console.log('success!');
|
|
45
|
+
})
|
|
46
|
+
.catch(console.error);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
|
|
3
|
-
// import * as moment from 'moment';
|
|
4
|
-
import { loadAdmin } from '../../lib/index';
|
|
2
|
+
import { factory, loadAdmin } from '../../lib/index';
|
|
5
3
|
import * as auth from './auth/authAsAdmin';
|
|
6
4
|
|
|
5
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
6
|
+
|
|
7
7
|
async function main() {
|
|
8
8
|
const authClient = await auth.login();
|
|
9
9
|
await authClient.refreshAccessToken();
|
|
@@ -14,16 +14,37 @@ async function main() {
|
|
|
14
14
|
endpoint: <string>process.env.API_ENDPOINT,
|
|
15
15
|
auth: authClient
|
|
16
16
|
})).createOfferInstance({
|
|
17
|
-
project
|
|
17
|
+
project,
|
|
18
18
|
seller: { id: '' }
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
await offerService.upsertByIdentifier([
|
|
22
|
+
{
|
|
23
|
+
// additionalProperty: [],
|
|
24
|
+
alternateName: { en: '', ja: 'xxx' },
|
|
25
|
+
availability: factory.itemAvailability.InStock,
|
|
26
|
+
// availableAtOrFrom: [],
|
|
27
|
+
itemOffered: {
|
|
28
|
+
typeOf: factory.product.ProductType.EventService
|
|
29
|
+
},
|
|
30
|
+
name: { ja: 'xxx', en: 'xxx' },
|
|
31
|
+
priceSpecification: {
|
|
32
|
+
price: 1,
|
|
33
|
+
referenceQuantity: {
|
|
34
|
+
typeOf: 'QuantitativeValue',
|
|
35
|
+
value: 1,
|
|
36
|
+
unitCode: factory.unitCode.C62
|
|
37
|
+
},
|
|
38
|
+
accounting: {
|
|
39
|
+
accountsReceivable: 1
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
description: { en: '', ja: 'xxx' },
|
|
43
|
+
// hasMerchantReturnPolicy: [],
|
|
44
|
+
identifier: '20231218'
|
|
45
|
+
}
|
|
46
|
+
]);
|
|
47
|
+
console.log('upserted');
|
|
27
48
|
}
|
|
28
49
|
|
|
29
50
|
main()
|
|
@@ -5,8 +5,11 @@ import { Service } from '../service';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class CreativeWorkService extends Service {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* 存在しなければ作成し、存在すれば置換
|
|
8
|
+
* コードによる冪等置換
|
|
10
9
|
*/
|
|
11
|
-
upsertMoviesByIdentifier(
|
|
10
|
+
upsertMoviesByIdentifier(
|
|
11
|
+
/**
|
|
12
|
+
* 最大長:20
|
|
13
|
+
*/
|
|
14
|
+
params: factory.creativeWork.movie.ICreateParams[]): Promise<void>;
|
|
12
15
|
}
|
|
@@ -63,10 +63,13 @@ var CreativeWorkService = /** @class */ (function (_super) {
|
|
|
63
63
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* 存在しなければ作成し、存在すれば置換
|
|
66
|
+
* コードによる冪等置換
|
|
68
67
|
*/
|
|
69
|
-
CreativeWorkService.prototype.upsertMoviesByIdentifier = function (
|
|
68
|
+
CreativeWorkService.prototype.upsertMoviesByIdentifier = function (
|
|
69
|
+
/**
|
|
70
|
+
* 最大長:20
|
|
71
|
+
*/
|
|
72
|
+
params) {
|
|
70
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
74
|
return __generator(this, function (_a) {
|
|
72
75
|
switch (_a.label) {
|
|
@@ -27,8 +27,11 @@ export declare class EventService extends Service {
|
|
|
27
27
|
};
|
|
28
28
|
}): Promise<void>;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
* 存在しなければ作成し、存在すれば置換
|
|
30
|
+
* [施設+コンテンツ+バージョン]による施設コンテンツ冪等置換
|
|
32
31
|
*/
|
|
33
|
-
upsertScreeningEventSeriesByVersion(
|
|
32
|
+
upsertScreeningEventSeriesByVersion(
|
|
33
|
+
/**
|
|
34
|
+
* 最大長:20
|
|
35
|
+
*/
|
|
36
|
+
params: factory.event.ICreateParams<factory.eventType.ScreeningEventSeries>[]): Promise<void>;
|
|
34
37
|
}
|
|
@@ -105,10 +105,13 @@ var EventService = /** @class */ (function (_super) {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
* 存在しなければ作成し、存在すれば置換
|
|
108
|
+
* [施設+コンテンツ+バージョン]による施設コンテンツ冪等置換
|
|
110
109
|
*/
|
|
111
|
-
EventService.prototype.upsertScreeningEventSeriesByVersion = function (
|
|
110
|
+
EventService.prototype.upsertScreeningEventSeriesByVersion = function (
|
|
111
|
+
/**
|
|
112
|
+
* 最大長:20
|
|
113
|
+
*/
|
|
114
|
+
params) {
|
|
112
115
|
return __awaiter(this, void 0, void 0, function () {
|
|
113
116
|
return __generator(this, function (_a) {
|
|
114
117
|
switch (_a.label) {
|
|
@@ -29,5 +29,13 @@ export declare class OfferService extends Service {
|
|
|
29
29
|
* 管理者権限が必要です
|
|
30
30
|
*/
|
|
31
31
|
search(params: ISearchConditions): Promise<IUnitPriceOfferAsSearchResult[]>;
|
|
32
|
+
/**
|
|
33
|
+
* コードによる冪等置換
|
|
34
|
+
*/
|
|
35
|
+
upsertByIdentifier(
|
|
36
|
+
/**
|
|
37
|
+
* 最大長:20
|
|
38
|
+
*/
|
|
39
|
+
params: Pick<factory.unitPriceOffer.ICreateParams, 'acceptedPaymentMethod' | 'addOn' | 'additionalProperty' | 'advanceBookingRequirement' | 'alternateName' | 'availability' | 'availableAtOrFrom' | 'category' | 'color' | 'description' | 'eligibleSeatingType' | 'hasMerchantReturnPolicy' | 'identifier' | 'itemOffered' | 'name' | 'priceSpecification' | 'settings' | 'validFrom' | 'validThrough'>[]): Promise<void>;
|
|
32
40
|
}
|
|
33
41
|
export {};
|
|
@@ -82,6 +82,31 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* コードによる冪等置換
|
|
87
|
+
*/
|
|
88
|
+
OfferService.prototype.upsertByIdentifier = function (
|
|
89
|
+
/**
|
|
90
|
+
* 最大長:20
|
|
91
|
+
*/
|
|
92
|
+
params) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
97
|
+
uri: '/offers',
|
|
98
|
+
method: 'PUT',
|
|
99
|
+
body: params,
|
|
100
|
+
qs: {},
|
|
101
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
102
|
+
})];
|
|
103
|
+
case 1:
|
|
104
|
+
_a.sent();
|
|
105
|
+
return [2 /*return*/];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
};
|
|
85
110
|
return OfferService;
|
|
86
111
|
}(service_1.Service));
|
|
87
112
|
exports.OfferService = OfferService;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as factory from '../factory';
|
|
2
|
+
import { Service } from '../service';
|
|
3
|
+
/**
|
|
4
|
+
* カタログサービス
|
|
5
|
+
*/
|
|
6
|
+
export declare class OfferCatalogService extends Service {
|
|
7
|
+
/**
|
|
8
|
+
* コードによる冪等置換
|
|
9
|
+
*/
|
|
10
|
+
upsertByIdentifier(
|
|
11
|
+
/**
|
|
12
|
+
* 最大長:20
|
|
13
|
+
*/
|
|
14
|
+
params: Pick<factory.offerCatalog.IOfferCatalog, 'additionalProperty' | 'description' | 'identifier' | 'itemListElement' | 'itemOffered' | 'name'>[]): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
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.OfferCatalogService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../service");
|
|
57
|
+
/**
|
|
58
|
+
* カタログサービス
|
|
59
|
+
*/
|
|
60
|
+
var OfferCatalogService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(OfferCatalogService, _super);
|
|
62
|
+
function OfferCatalogService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* コードによる冪等置換
|
|
67
|
+
*/
|
|
68
|
+
OfferCatalogService.prototype.upsertByIdentifier = function (
|
|
69
|
+
/**
|
|
70
|
+
* 最大長:20
|
|
71
|
+
*/
|
|
72
|
+
params) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
77
|
+
uri: '/offerCatalogs',
|
|
78
|
+
method: 'PUT',
|
|
79
|
+
body: params,
|
|
80
|
+
qs: {},
|
|
81
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
82
|
+
})];
|
|
83
|
+
case 1:
|
|
84
|
+
_a.sent();
|
|
85
|
+
return [2 /*return*/];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
return OfferCatalogService;
|
|
91
|
+
}(service_1.Service));
|
|
92
|
+
exports.OfferCatalogService = OfferCatalogService;
|
package/lib/abstract/admin.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from './servi
|
|
|
2
2
|
import type { CreativeWorkService } from './admin/creativeWork';
|
|
3
3
|
import type { EventService } from './admin/event';
|
|
4
4
|
import type { OfferService } from './admin/offer';
|
|
5
|
+
import type { OfferCatalogService } from './admin/offerCatalog';
|
|
5
6
|
export declare namespace service {
|
|
6
7
|
type IUnset = IUnsetOnService;
|
|
7
8
|
/**
|
|
@@ -25,6 +26,13 @@ export declare namespace service {
|
|
|
25
26
|
namespace Offer {
|
|
26
27
|
let svc: typeof OfferService | undefined;
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* カタログサービス
|
|
31
|
+
*/
|
|
32
|
+
type OffeCatalogr = OfferCatalogService;
|
|
33
|
+
namespace OfferCatalog {
|
|
34
|
+
let svc: typeof OfferCatalogService | undefined;
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
30
38
|
* 管理サービス
|
|
@@ -35,4 +43,5 @@ export declare class Admin {
|
|
|
35
43
|
createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
|
|
36
44
|
createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
|
|
37
45
|
createOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferService>;
|
|
46
|
+
createOfferCatalogInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogService>;
|
|
38
47
|
}
|
package/lib/abstract/admin.js
CHANGED
|
@@ -59,6 +59,9 @@ var service;
|
|
|
59
59
|
var Offer;
|
|
60
60
|
(function (Offer) {
|
|
61
61
|
})(Offer = service.Offer || (service.Offer = {}));
|
|
62
|
+
var OfferCatalog;
|
|
63
|
+
(function (OfferCatalog) {
|
|
64
|
+
})(OfferCatalog = service.OfferCatalog || (service.OfferCatalog = {}));
|
|
62
65
|
})(service = exports.service || (exports.service = {}));
|
|
63
66
|
/**
|
|
64
67
|
* 管理サービス
|
|
@@ -118,6 +121,23 @@ var Admin = /** @class */ (function () {
|
|
|
118
121
|
});
|
|
119
122
|
});
|
|
120
123
|
};
|
|
124
|
+
Admin.prototype.createOfferCatalogInstance = function (params) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
var _a;
|
|
127
|
+
return __generator(this, function (_b) {
|
|
128
|
+
switch (_b.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
if (!(service.OfferCatalog.svc === undefined)) return [3 /*break*/, 2];
|
|
131
|
+
_a = service.OfferCatalog;
|
|
132
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./admin/offerCatalog'); })];
|
|
133
|
+
case 1:
|
|
134
|
+
_a.svc = (_b.sent()).OfferCatalogService;
|
|
135
|
+
_b.label = 2;
|
|
136
|
+
case 2: return [2 /*return*/, new service.OfferCatalog.svc(__assign(__assign({}, this.options), params))];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
121
141
|
return Admin;
|
|
122
142
|
}());
|
|
123
143
|
exports.Admin = Admin;
|
|
@@ -34,7 +34,7 @@ export declare class OfferCatalogService extends Service {
|
|
|
34
34
|
update(params: Omit<factory.offerCatalog.IOfferCatalog, 'project' | 'typeOf' | 'relatedOffer'> & {
|
|
35
35
|
id: string;
|
|
36
36
|
}): Promise<void>;
|
|
37
|
-
upsertByIdentifier(params:
|
|
37
|
+
upsertByIdentifier(params: Pick<factory.offerCatalog.IOfferCatalog, 'additionalProperty' | 'description' | 'identifier' | 'itemListElement' | 'itemOffered' | 'name'>[]): Promise<void>;
|
|
38
38
|
/**
|
|
39
39
|
* カタログ複数編集
|
|
40
40
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
import {
|
|
2
|
+
import { Service } from '../service';
|
|
3
3
|
export declare type IProduct = Omit<factory.product.IProduct, 'offers'> | Omit<factory.service.paymentService.IService, 'provider'>;
|
|
4
4
|
export declare type IProductWithoutCredentials = Omit<factory.product.IProduct, 'availableChannel' | 'offers'>;
|
|
5
5
|
export declare type IPaymentServiceWithoutCredentials = Omit<factory.service.paymentService.IService, 'availableChannel' | 'provider'>;
|
|
@@ -16,15 +16,21 @@ interface IProjectionSearchConditions {
|
|
|
16
16
|
*/
|
|
17
17
|
export declare class ProductService extends Service {
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* プロダクト作成
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
createProduct(params: factory.product.ICreateParams): Promise<{
|
|
22
|
+
id: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* 決済サービス作成
|
|
26
|
+
*/
|
|
27
|
+
createPaymentService(params: Omit<factory.service.paymentService.IService, 'provider'>): Promise<{
|
|
22
28
|
id: string;
|
|
23
29
|
}>;
|
|
24
30
|
/**
|
|
25
31
|
* プロダクトタイプでなければ作成
|
|
26
32
|
*/
|
|
27
|
-
createIfNotExist(params:
|
|
33
|
+
createIfNotExist(params: factory.product.ICreateParams): Promise<{
|
|
28
34
|
id: string;
|
|
29
35
|
}>;
|
|
30
36
|
/**
|
|
@@ -36,7 +42,12 @@ export declare class ProductService extends Service {
|
|
|
36
42
|
findById(params: {
|
|
37
43
|
id: string;
|
|
38
44
|
} & IProjectionSearchConditions): Promise<IProduct>;
|
|
39
|
-
|
|
45
|
+
updateProduct(params: factory.product.ICreateParams & {
|
|
46
|
+
id: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
updatePaymentService(params: Omit<factory.service.paymentService.IService, 'provider'> & {
|
|
49
|
+
id: string;
|
|
50
|
+
}): Promise<void>;
|
|
40
51
|
deleteById(params: {
|
|
41
52
|
id: string;
|
|
42
53
|
}): Promise<void>;
|
|
@@ -74,9 +74,28 @@ var ProductService = /** @class */ (function (_super) {
|
|
|
74
74
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* プロダクト作成
|
|
78
78
|
*/
|
|
79
|
-
ProductService.prototype.
|
|
79
|
+
ProductService.prototype.createProduct = function (params) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var _this = this;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
return [2 /*return*/, this.fetch({
|
|
84
|
+
uri: '/products',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
body: params,
|
|
87
|
+
expectedStatusCodes: [http_status_1.CREATED]
|
|
88
|
+
})
|
|
89
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
90
|
+
return [2 /*return*/, response.json()];
|
|
91
|
+
}); }); })];
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* 決済サービス作成
|
|
97
|
+
*/
|
|
98
|
+
ProductService.prototype.createPaymentService = function (params) {
|
|
80
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
81
100
|
var _this = this;
|
|
82
101
|
return __generator(this, function (_a) {
|
|
@@ -158,7 +177,24 @@ var ProductService = /** @class */ (function (_super) {
|
|
|
158
177
|
});
|
|
159
178
|
});
|
|
160
179
|
};
|
|
161
|
-
ProductService.prototype.
|
|
180
|
+
ProductService.prototype.updateProduct = function (params) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
182
|
+
return __generator(this, function (_a) {
|
|
183
|
+
switch (_a.label) {
|
|
184
|
+
case 0: return [4 /*yield*/, this.fetch({
|
|
185
|
+
uri: "/products/" + encodeURIComponent(String(params.id)),
|
|
186
|
+
method: 'PUT',
|
|
187
|
+
body: params,
|
|
188
|
+
expectedStatusCodes: [http_status_1.NO_CONTENT]
|
|
189
|
+
})];
|
|
190
|
+
case 1:
|
|
191
|
+
_a.sent();
|
|
192
|
+
return [2 /*return*/];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
ProductService.prototype.updatePaymentService = function (params) {
|
|
162
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
163
199
|
return __generator(this, function (_a) {
|
|
164
200
|
switch (_a.label) {
|
package/lib/browser.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* API Javascript Client
|
|
3
3
|
*/
|
|
4
|
-
import { factory, loadService, service, transporters } from './abstract';
|
|
4
|
+
import { admin, factory, loadAdmin, loadService, service, transporters } from './abstract';
|
|
5
5
|
import { ImplicitGrantClient, IOptions as IImplicitGrantClientOptions } from './auth/implicitGrantClient';
|
|
6
|
-
export {
|
|
6
|
+
export { loadAdmin, loadService, admin, factory, service, transporters };
|
|
7
7
|
/**
|
|
8
8
|
* create OAuth2 client instance using implicit grant
|
|
9
9
|
*/
|
package/lib/browser.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAuthInstance = exports.transporters = exports.loadService = exports.
|
|
3
|
+
exports.createAuthInstance = exports.transporters = exports.factory = exports.loadService = exports.loadAdmin = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* API Javascript Client
|
|
6
6
|
*/
|
|
7
7
|
var abstract_1 = require("./abstract");
|
|
8
8
|
Object.defineProperty(exports, "factory", { enumerable: true, get: function () { return abstract_1.factory; } });
|
|
9
|
+
Object.defineProperty(exports, "loadAdmin", { enumerable: true, get: function () { return abstract_1.loadAdmin; } });
|
|
9
10
|
Object.defineProperty(exports, "loadService", { enumerable: true, get: function () { return abstract_1.loadService; } });
|
|
10
11
|
Object.defineProperty(exports, "transporters", { enumerable: true, get: function () { return abstract_1.transporters; } });
|
|
11
12
|
var implicitGrantClient_1 = require("./auth/implicitGrantClient");
|