@cinerino/sdk 3.155.0 → 3.157.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,41 @@
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 ORDER_ID = '645ad3bc3b53c4bb44e9b631';
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 commentService = new client.service.Comment({
15
+ endpoint: <string>process.env.API_ENDPOINT,
16
+ auth: authClient,
17
+ project: { id: 'cinerino' }
18
+ });
19
+
20
+ const createdComment = await commentService.create({
21
+ about: {
22
+ id: ORDER_ID, // Order ID
23
+ typeOf: client.factory.order.OrderType.Order
24
+ },
25
+ author: { name: 'sample author name' },
26
+ text: 'some comments by examples'
27
+ });
28
+ console.log('comment created,', createdComment);
29
+
30
+ const { data } = await commentService.search({
31
+ about: { id: { $eq: ORDER_ID } }
32
+ });
33
+ console.log(data);
34
+ console.log(data.length, 'comments found');
35
+ }
36
+
37
+ main()
38
+ .then(() => {
39
+ console.log('success!');
40
+ })
41
+ .catch(console.error);
@@ -22,7 +22,10 @@ export declare class CommentService extends Service {
22
22
  /**
23
23
  * 検索
24
24
  */
25
- search(params: Omit<factory.creativeWork.comment.ISearchConditions, 'project'>): Promise<{
25
+ search(params: Omit<factory.creativeWork.comment.ISearchConditions, 'project'> & {
26
+ inclusion: string[];
27
+ exclusion: string[];
28
+ }): Promise<{
26
29
  data: factory.creativeWork.comment.IComment[];
27
30
  }>;
28
31
  }
@@ -0,0 +1,18 @@
1
+ import * as factory from '../factory';
2
+ import { IUnset, Service } from '../service';
3
+ /**
4
+ * アイテムコンディションサービス
5
+ */
6
+ export declare class OfferItemConditionService extends Service {
7
+ create(params: factory.offerItemCondition.IOfferItemCondition): Promise<factory.offerItemCondition.IOfferItemCondition>;
8
+ search(params: factory.offerItemCondition.ISearchConditions): Promise<{
9
+ data: factory.offerItemCondition.IOfferItemCondition[];
10
+ }>;
11
+ findById(params: {
12
+ id: string;
13
+ }): Promise<factory.offerItemCondition.IOfferItemCondition>;
14
+ update(params: factory.offerItemCondition.IOfferItemCondition & IUnset): Promise<void>;
15
+ deleteById(params: {
16
+ id: string;
17
+ }): Promise<void>;
18
+ }
@@ -0,0 +1,156 @@
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.OfferItemConditionService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * アイテムコンディションサービス
59
+ */
60
+ var OfferItemConditionService = /** @class */ (function (_super) {
61
+ __extends(OfferItemConditionService, _super);
62
+ function OfferItemConditionService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ OfferItemConditionService.prototype.create = 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: '/offerItemConditions',
71
+ method: 'POST',
72
+ body: params,
73
+ expectedStatusCodes: [http_status_1.CREATED]
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
+ OfferItemConditionService.prototype.search = function (params) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var _this = this;
84
+ return __generator(this, function (_a) {
85
+ return [2 /*return*/, this.fetch({
86
+ uri: '/offerItemConditions',
87
+ method: 'GET',
88
+ qs: params,
89
+ expectedStatusCodes: [http_status_1.OK]
90
+ })
91
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
92
+ var _a;
93
+ return __generator(this, function (_b) {
94
+ switch (_b.label) {
95
+ case 0:
96
+ _a = {};
97
+ return [4 /*yield*/, response.json()];
98
+ case 1: return [2 /*return*/, (_a.data = _b.sent(),
99
+ _a)];
100
+ }
101
+ });
102
+ }); })];
103
+ });
104
+ });
105
+ };
106
+ OfferItemConditionService.prototype.findById = function (params) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ var _this = this;
109
+ return __generator(this, function (_a) {
110
+ return [2 /*return*/, this.fetch({
111
+ uri: "/offerItemConditions/" + encodeURIComponent(String(params.id)),
112
+ method: 'GET',
113
+ expectedStatusCodes: [http_status_1.OK]
114
+ })
115
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
116
+ return [2 /*return*/, response.json()];
117
+ }); }); })];
118
+ });
119
+ });
120
+ };
121
+ OfferItemConditionService.prototype.update = function (params) {
122
+ return __awaiter(this, void 0, void 0, function () {
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0: return [4 /*yield*/, this.fetch({
126
+ uri: "/offerItemConditions/" + encodeURIComponent(String(params.id)),
127
+ method: 'PUT',
128
+ body: params,
129
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
130
+ })];
131
+ case 1:
132
+ _a.sent();
133
+ return [2 /*return*/];
134
+ }
135
+ });
136
+ });
137
+ };
138
+ OfferItemConditionService.prototype.deleteById = function (params) {
139
+ return __awaiter(this, void 0, void 0, function () {
140
+ return __generator(this, function (_a) {
141
+ switch (_a.label) {
142
+ case 0: return [4 /*yield*/, this.fetch({
143
+ uri: "/offerItemConditions/" + encodeURIComponent(String(params.id)),
144
+ method: 'DELETE',
145
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
146
+ })];
147
+ case 1:
148
+ _a.sent();
149
+ return [2 /*return*/];
150
+ }
151
+ });
152
+ });
153
+ };
154
+ return OfferItemConditionService;
155
+ }(service_1.Service));
156
+ exports.OfferItemConditionService = OfferItemConditionService;
@@ -30,6 +30,7 @@ import { MeService } from './chevre/me';
30
30
  import { MerchantReturnPolicyService } from './chevre/merchantReturnPolicy';
31
31
  import { OfferService } from './chevre/offer';
32
32
  import { OfferCatalogService } from './chevre/offerCatalog';
33
+ import { OfferItemConditionService } from './chevre/offerItemCondition';
33
34
  import { OrderService } from './chevre/order';
34
35
  import { OrderNumberService } from './chevre/orderNumber';
35
36
  import { OwnershipInfoService } from './chevre/ownershipInfo';
@@ -216,6 +217,11 @@ export declare namespace service {
216
217
  */
217
218
  class OfferCatalog extends OfferCatalogService {
218
219
  }
220
+ /**
221
+ * アイテムコンディションサービス
222
+ */
223
+ class OfferItemCondition extends OfferItemConditionService {
224
+ }
219
225
  /**
220
226
  * 販売者サービス
221
227
  */
@@ -48,6 +48,7 @@ var me_1 = require("./chevre/me");
48
48
  var merchantReturnPolicy_1 = require("./chevre/merchantReturnPolicy");
49
49
  var offer_1 = require("./chevre/offer");
50
50
  var offerCatalog_1 = require("./chevre/offerCatalog");
51
+ var offerItemCondition_1 = require("./chevre/offerItemCondition");
51
52
  var order_1 = require("./chevre/order");
52
53
  var orderNumber_1 = require("./chevre/orderNumber");
53
54
  var ownershipInfo_1 = require("./chevre/ownershipInfo");
@@ -428,6 +429,17 @@ var service;
428
429
  return OfferCatalog;
429
430
  }(offerCatalog_1.OfferCatalogService));
430
431
  service.OfferCatalog = OfferCatalog;
432
+ /**
433
+ * アイテムコンディションサービス
434
+ */
435
+ var OfferItemCondition = /** @class */ (function (_super) {
436
+ __extends(OfferItemCondition, _super);
437
+ function OfferItemCondition() {
438
+ return _super !== null && _super.apply(this, arguments) || this;
439
+ }
440
+ return OfferItemCondition;
441
+ }(offerItemCondition_1.OfferItemConditionService));
442
+ service.OfferItemCondition = OfferItemCondition;
431
443
  /**
432
444
  * 販売者サービス
433
445
  */
@@ -12,6 +12,7 @@ import * as ReservationServiceFactory from './service/reservation/factory';
12
12
  import * as PlaceOrderTransactionServiceFactory from './chevre/transaction/placeOrder/factory';
13
13
  import { AccountService } from './service/account';
14
14
  import { CategoryCodeService } from './service/categoryCode';
15
+ import { CommentService } from './service/comment';
15
16
  import { CreativeWorkService } from './service/creativeWork';
16
17
  import { CustomerService } from './service/customer';
17
18
  import { DeliveryService } from './service/delivery';
@@ -77,6 +78,11 @@ export declare namespace service {
77
78
  */
78
79
  class CategoryCode extends CategoryCodeService {
79
80
  }
81
+ /**
82
+ * コメントサービス
83
+ */
84
+ class Comment extends CommentService {
85
+ }
80
86
  /**
81
87
  * 作品サービス
82
88
  */
@@ -31,12 +31,12 @@ var ReservationServiceFactory = require("./service/reservation/factory");
31
31
  var PlaceOrderTransactionServiceFactory = require("./chevre/transaction/placeOrder/factory");
32
32
  var account_1 = require("./service/account");
33
33
  var categoryCode_1 = require("./service/categoryCode");
34
+ var comment_1 = require("./service/comment");
34
35
  var creativeWork_1 = require("./service/creativeWork");
35
36
  var customer_1 = require("./service/customer");
36
37
  var delivery_1 = require("./service/delivery");
37
38
  var emailMessage_1 = require("./service/emailMessage");
38
39
  var event_1 = require("./service/event");
39
- // import { IAMService } from './service/iam';
40
40
  var offer_1 = require("./service/offer");
41
41
  var order_1 = require("./service/order");
42
42
  var payment_1 = require("./service/payment");
@@ -133,6 +133,17 @@ var service;
133
133
  return CategoryCode;
134
134
  }(categoryCode_1.CategoryCodeService));
135
135
  service.CategoryCode = CategoryCode;
136
+ /**
137
+ * コメントサービス
138
+ */
139
+ var Comment = /** @class */ (function (_super) {
140
+ __extends(Comment, _super);
141
+ function Comment() {
142
+ return _super !== null && _super.apply(this, arguments) || this;
143
+ }
144
+ return Comment;
145
+ }(comment_1.CommentService));
146
+ service.Comment = Comment;
136
147
  /**
137
148
  * 作品サービス
138
149
  */
@@ -0,0 +1,37 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ /**
4
+ * コメントサービス
5
+ */
6
+ export declare class CommentService extends Service {
7
+ /**
8
+ * 作成
9
+ */
10
+ create(params: {
11
+ about: {
12
+ /**
13
+ * コメント対象オブジェクトID
14
+ */
15
+ id: string;
16
+ typeOf: factory.order.OrderType.Order;
17
+ };
18
+ author?: {
19
+ /**
20
+ * コメント作成者名称
21
+ * maxlength: 128
22
+ */
23
+ name?: string;
24
+ };
25
+ /**
26
+ * コメント内容
27
+ * maxlength: 1024
28
+ */
29
+ text: string;
30
+ }): Promise<Pick<factory.creativeWork.comment.IComment, 'id' | 'dateCreated'>>;
31
+ /**
32
+ * 検索
33
+ */
34
+ search(params: Omit<factory.creativeWork.comment.ISearchConditions, 'project'>): Promise<{
35
+ data: Pick<factory.creativeWork.comment.IComment, 'id' | 'about' | 'author' | 'text' | 'dateCreated'>[];
36
+ }>;
37
+ }
@@ -0,0 +1,114 @@
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.CommentService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * コメントサービス
59
+ */
60
+ var CommentService = /** @class */ (function (_super) {
61
+ __extends(CommentService, _super);
62
+ function CommentService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * 作成
67
+ */
68
+ CommentService.prototype.create = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/comments',
74
+ method: 'POST',
75
+ body: params,
76
+ expectedStatusCodes: [http_status_1.CREATED]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
84
+ /**
85
+ * 検索
86
+ */
87
+ CommentService.prototype.search = function (params) {
88
+ return __awaiter(this, void 0, void 0, function () {
89
+ var _this = this;
90
+ return __generator(this, function (_a) {
91
+ return [2 /*return*/, this.fetch({
92
+ uri: '/comments',
93
+ method: 'GET',
94
+ qs: params,
95
+ expectedStatusCodes: [http_status_1.OK]
96
+ })
97
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
98
+ var _a;
99
+ return __generator(this, function (_b) {
100
+ switch (_b.label) {
101
+ case 0:
102
+ _a = {};
103
+ return [4 /*yield*/, response.json()];
104
+ case 1: return [2 /*return*/, (_a.data = _b.sent(),
105
+ _a)];
106
+ }
107
+ });
108
+ }); })];
109
+ });
110
+ });
111
+ };
112
+ return CommentService;
113
+ }(service_1.Service));
114
+ exports.CommentService = CommentService;