@cinerino/sdk 3.155.0 → 3.156.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/src/createCommentOnOrder.ts +41 -0
- package/lib/abstract/chevre/comment.d.ts +4 -1
- package/lib/abstract/index.d.ts +6 -0
- package/lib/abstract/index.js +12 -1
- package/lib/abstract/service/comment.d.ts +37 -0
- package/lib/abstract/service/comment.js +114 -0
- package/lib/bundle.js +254 -241
- package/package.json +1 -1
|
@@ -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'>
|
|
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
|
}
|
package/lib/abstract/index.d.ts
CHANGED
|
@@ -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
|
*/
|
package/lib/abstract/index.js
CHANGED
|
@@ -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;
|