fishpi 0.0.3 → 0.0.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,31 @@
1
+ import { ApiResponse, CommentPost, VoteStatus } from './typing';
2
+ declare class Comment {
3
+ private _apiKey;
4
+ constructor(token?: string);
5
+ /**
6
+ * 重新设置请求 Token
7
+ * @param apiKey 接口 API Key
8
+ */
9
+ setToken(token: string): void;
10
+ send(data: CommentPost): Promise<ApiResponse<undefined>>;
11
+ update(id: string, data: CommentPost): Promise<{
12
+ code: number;
13
+ msg?: string;
14
+ /**
15
+ * 评论内容 HTML
16
+ */
17
+ commentContent?: string;
18
+ }>;
19
+ vote(id: string): Promise<{
20
+ code: number;
21
+ msg?: string;
22
+ type?: VoteStatus;
23
+ }>;
24
+ thank(id: string): Promise<ApiResponse<undefined>>;
25
+ remove(id: string): Promise<{
26
+ code: number;
27
+ msg?: string;
28
+ commentId?: string;
29
+ }>;
30
+ }
31
+ export default Comment;
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ var utils_1 = require("./utils");
51
+ var Comment = /** @class */ (function () {
52
+ function Comment(token) {
53
+ if (token === void 0) { token = ''; }
54
+ this._apiKey = '';
55
+ if (!token) {
56
+ return;
57
+ }
58
+ this._apiKey = token;
59
+ }
60
+ /**
61
+ * 重新设置请求 Token
62
+ * @param apiKey 接口 API Key
63
+ */
64
+ Comment.prototype.setToken = function (token) {
65
+ this._apiKey = token;
66
+ };
67
+ Comment.prototype.send = function (data) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var rsp, e_1;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ _a.trys.push([0, 2, , 3]);
74
+ return [4 /*yield*/, (0, utils_1.request)({
75
+ url: "/comment",
76
+ method: 'post',
77
+ data: __assign(__assign({}, data), { apiKey: this._apiKey }),
78
+ })];
79
+ case 1:
80
+ rsp = _a.sent();
81
+ if (rsp.status === 401) {
82
+ return [2 /*return*/, { code: -1, msg: '登录已失效,请重新登录!' }];
83
+ }
84
+ return [2 /*return*/, rsp.data];
85
+ case 2:
86
+ e_1 = _a.sent();
87
+ throw e_1;
88
+ case 3: return [2 /*return*/];
89
+ }
90
+ });
91
+ });
92
+ };
93
+ Comment.prototype.update = function (id, data) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ var rsp, e_2;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0:
99
+ _a.trys.push([0, 2, , 3]);
100
+ return [4 /*yield*/, (0, utils_1.request)({
101
+ url: "/comment/".concat(id),
102
+ method: 'put',
103
+ data: __assign(__assign({}, data), { apiKey: this._apiKey }),
104
+ })];
105
+ case 1:
106
+ rsp = _a.sent();
107
+ if (rsp.status === 401) {
108
+ return [2 /*return*/, { code: -1, msg: '登录已失效,请重新登录!' }];
109
+ }
110
+ return [2 /*return*/, rsp.data];
111
+ case 2:
112
+ e_2 = _a.sent();
113
+ throw e_2;
114
+ case 3: return [2 /*return*/];
115
+ }
116
+ });
117
+ });
118
+ };
119
+ Comment.prototype.vote = function (id) {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ var rsp, e_3;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0:
125
+ _a.trys.push([0, 2, , 3]);
126
+ return [4 /*yield*/, (0, utils_1.request)({
127
+ url: "/vote/up/comment",
128
+ method: 'post',
129
+ data: {
130
+ dataId: id,
131
+ apiKey: this._apiKey
132
+ },
133
+ })];
134
+ case 1:
135
+ rsp = _a.sent();
136
+ if (rsp.status === 401) {
137
+ return [2 /*return*/, { code: -1, msg: '登录已失效,请重新登录!' }];
138
+ }
139
+ return [2 /*return*/, rsp.data];
140
+ case 2:
141
+ e_3 = _a.sent();
142
+ throw e_3;
143
+ case 3: return [2 /*return*/];
144
+ }
145
+ });
146
+ });
147
+ };
148
+ Comment.prototype.thank = function (id) {
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var rsp, e_4;
151
+ return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0:
154
+ _a.trys.push([0, 2, , 3]);
155
+ return [4 /*yield*/, (0, utils_1.request)({
156
+ url: "/comment/thank",
157
+ method: 'post',
158
+ data: {
159
+ apiKey: this._apiKey,
160
+ commentId: id
161
+ },
162
+ })];
163
+ case 1:
164
+ rsp = _a.sent();
165
+ if (rsp.status === 401) {
166
+ return [2 /*return*/, { code: -1, msg: '登录已失效,请重新登录!' }];
167
+ }
168
+ return [2 /*return*/, rsp.data];
169
+ case 2:
170
+ e_4 = _a.sent();
171
+ throw e_4;
172
+ case 3: return [2 /*return*/];
173
+ }
174
+ });
175
+ });
176
+ };
177
+ Comment.prototype.remove = function (id) {
178
+ return __awaiter(this, void 0, void 0, function () {
179
+ var rsp, e_5;
180
+ return __generator(this, function (_a) {
181
+ switch (_a.label) {
182
+ case 0:
183
+ _a.trys.push([0, 2, , 3]);
184
+ return [4 /*yield*/, (0, utils_1.request)({
185
+ url: "/comment/".concat(id, "/remove"),
186
+ method: 'post',
187
+ data: {
188
+ apiKey: this._apiKey
189
+ },
190
+ })];
191
+ case 1:
192
+ rsp = _a.sent();
193
+ if (rsp.status === 401) {
194
+ return [2 /*return*/, { code: -1, msg: '登录已失效,请重新登录!' }];
195
+ }
196
+ return [2 /*return*/, rsp.data];
197
+ case 2:
198
+ e_5 = _a.sent();
199
+ throw e_5;
200
+ case 3: return [2 /*return*/];
201
+ }
202
+ });
203
+ });
204
+ };
205
+ return Comment;
206
+ }());
207
+ exports.default = Comment;
@@ -0,0 +1,197 @@
1
+ declare class Emoji {
2
+ private _apiKey;
3
+ constructor(token?: string);
4
+ /**
5
+ * 重新设置请求 Token
6
+ * @param apiKey 接口 API Key
7
+ */
8
+ setToken(token: string): void;
9
+ get default(): {
10
+ doge: string;
11
+ trollface: string;
12
+ huaji: string;
13
+ octocat: string;
14
+ wulian: string;
15
+ smile: string;
16
+ laughing: string;
17
+ blush: string;
18
+ smiley: string;
19
+ relaxed: string;
20
+ smirk: string;
21
+ heart_eyes: string;
22
+ kissing_heart: string;
23
+ kissing_closed_eyes: string;
24
+ flushed: string;
25
+ relieved: string;
26
+ satisfied: string;
27
+ grin: string;
28
+ wink: string;
29
+ stuck_out_tongue_winking_eye: string;
30
+ stuck_out_tongue_closed_eyes: string;
31
+ grinning: string;
32
+ kissing: string;
33
+ kissing_smiling_eyes: string;
34
+ stuck_out_tongue: string;
35
+ sleeping: string;
36
+ worried: string;
37
+ frowning: string;
38
+ anguished: string;
39
+ open_mouth: string;
40
+ grimacing: string;
41
+ confused: string;
42
+ hushed: string;
43
+ expressionless: string;
44
+ unamused: string;
45
+ sweat_smile: string;
46
+ sweat: string;
47
+ disappointed_relieved: string;
48
+ weary: string;
49
+ pensive: string;
50
+ disappointed: string;
51
+ confounded: string;
52
+ fearful: string;
53
+ cold_sweat: string;
54
+ persevere: string;
55
+ cry: string;
56
+ sob: string;
57
+ joy: string;
58
+ astonished: string;
59
+ scream: string;
60
+ tired_face: string;
61
+ angry: string;
62
+ rage: string;
63
+ triumph: string;
64
+ sleepy: string;
65
+ yum: string;
66
+ mask: string;
67
+ sunglasses: string;
68
+ dizzy_face: string;
69
+ imp: string;
70
+ smiling_imp: string;
71
+ neutral_face: string;
72
+ no_mouth: string;
73
+ innocent: string;
74
+ alien: string;
75
+ yellow_heart: string;
76
+ blue_heart: string;
77
+ purple_heart: string;
78
+ heart: string;
79
+ green_heart: string;
80
+ broken_heart: string;
81
+ heartbeat: string;
82
+ heartpulse: string;
83
+ two_hearts: string;
84
+ revolving_hearts: string;
85
+ cupid: string;
86
+ sparkling_heart: string;
87
+ sparkles: string;
88
+ star: string;
89
+ star2: string;
90
+ dizzy: string;
91
+ boom: string;
92
+ collision: string;
93
+ anger: string;
94
+ exclamation: string;
95
+ question: string;
96
+ grey_exclamation: string;
97
+ grey_question: string;
98
+ zzz: string;
99
+ dash: string;
100
+ sweat_drops: string;
101
+ notes: string;
102
+ musical_note: string;
103
+ fire: string;
104
+ poop: string;
105
+ "+1": string;
106
+ thumbsup: string;
107
+ "-1": string;
108
+ thumbsdown: string;
109
+ ok_hand: string;
110
+ punch: string;
111
+ facepunch: string;
112
+ fist: string;
113
+ v: string;
114
+ wave: string;
115
+ hand: string;
116
+ raised_hand: string;
117
+ open_hands: string;
118
+ point_up: string;
119
+ point_down: string;
120
+ point_left: string;
121
+ point_right: string;
122
+ raised_hands: string;
123
+ pray: string;
124
+ point_up_2: string;
125
+ clap: string;
126
+ muscle: string;
127
+ couple: string;
128
+ family: string;
129
+ two_men_holding_hands: string;
130
+ two_women_holding_hands: string;
131
+ dancer: string;
132
+ dancers: string;
133
+ ok_woman: string;
134
+ no_good: string;
135
+ information_desk_person: string;
136
+ raising_hand: string;
137
+ bride_with_veil: string;
138
+ person_with_pouting_face: string;
139
+ person_frowning: string;
140
+ bow: string;
141
+ couplekiss: string;
142
+ couple_with_heart: string;
143
+ massage: string;
144
+ haircut: string;
145
+ nail_care: string;
146
+ boy: string;
147
+ girl: string;
148
+ woman: string;
149
+ man: string;
150
+ baby: string;
151
+ older_woman: string;
152
+ older_man: string;
153
+ person_with_blond_hair: string;
154
+ man_with_gua_pi_mao: string;
155
+ man_with_turban: string;
156
+ construction_worker: string;
157
+ cop: string;
158
+ angel: string;
159
+ princess: string;
160
+ smiley_cat: string;
161
+ smile_cat: string;
162
+ heart_eyes_cat: string;
163
+ kissing_cat: string;
164
+ smirk_cat: string;
165
+ scream_cat: string;
166
+ crying_cat_face: string;
167
+ joy_cat: string;
168
+ pouting_cat: string;
169
+ japanese_ogre: string;
170
+ japanese_goblin: string;
171
+ see_no_evil: string;
172
+ hear_no_evil: string;
173
+ speak_no_evil: string;
174
+ guardsman: string;
175
+ skull: string;
176
+ feet: string;
177
+ lips: string;
178
+ kiss: string;
179
+ droplet: string;
180
+ ear: string;
181
+ eyes: string;
182
+ nose: string;
183
+ tongue: string;
184
+ love_letter: string;
185
+ bust_in_silhouette: string;
186
+ busts_in_silhouette: string;
187
+ speech_balloon: string;
188
+ thought_balloon: string;
189
+ };
190
+ get(): Promise<Array<string>>;
191
+ /**
192
+ * 设置表情包列表
193
+ * @param data 所有表情包图像列表
194
+ */
195
+ set(data: Array<string>): Promise<any>;
196
+ }
197
+ export default Emoji;