@univerjs/protocol 0.1.49 → 0.21.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/README.md +1 -3
- package/lib/cjs/index.js +463 -1
- package/lib/es/index.js +446 -36
- package/lib/index.js +447 -0
- package/lib/types/index.d.ts +41 -38
- package/lib/types/other/sheet-block.d.ts +27 -0
- package/lib/types/ts/univer/changeset.d.ts +20 -6
- package/lib/types/ts/univer/colla-msg.d.ts +176 -0
- package/lib/types/ts/univer/constants/errors.d.ts +33 -19
- package/lib/types/ts/univer/constants/univer.d.ts +15 -1
- package/lib/types/ts/univer/doc.d.ts +18 -4
- package/lib/types/ts/univer/drawing.d.ts +16 -2
- package/lib/types/ts/univer/initial-sheet.d.ts +46 -0
- package/lib/types/ts/univer/permission.d.ts +19 -5
- package/lib/types/ts/univer/range.d.ts +16 -2
- package/lib/types/ts/univer/resource.d.ts +16 -2
- package/lib/types/ts/univer/snapshot.d.ts +23 -9
- package/lib/types/ts/univer/unit-template.d.ts +23 -0
- package/lib/types/ts/univer/univer-file.d.ts +27 -0
- package/lib/types/ts/univer/workbook.d.ts +30 -53
- package/lib/types/ts/univercloud/stats/v1/stats.d.ts +34 -0
- package/lib/types/ts/univerpro/v1/apply.d.ts +129 -0
- package/lib/types/ts/univerpro/v1/helper.d.ts +36 -0
- package/lib/types/ts/univerpro/v1/ssc.d.ts +72 -0
- package/lib/types/ts/univerpro/v1/ssr.d.ts +28 -0
- package/lib/types/ts/universer/v1/access-key.d.ts +51 -0
- package/lib/types/ts/universer/v1/authz.d.ts +102 -87
- package/lib/types/ts/universer/v1/comb.d.ts +40 -61
- package/lib/types/ts/universer/v1/comment.d.ts +45 -49
- package/lib/types/ts/universer/v1/file.d.ts +57 -42
- package/lib/types/ts/universer/v1/history.d.ts +52 -49
- package/lib/types/ts/universer/v1/license.d.ts +54 -39
- package/lib/types/ts/universer/v1/snapshot.d.ts +146 -143
- package/lib/types/ts/universer/v1/user.d.ts +28 -275
- package/lib/types/utils.d.ts +17 -2
- package/lib/umd/index.js +1 -1
- package/package.json +33 -11
- package/lib/types/ts/univer/colla_msg.d.ts +0 -178
- package/lib/types/ts/univer/constants/biz.d.ts +0 -17
- package/lib/types/ts/univer/event_sync.d.ts +0 -10
- package/lib/types/ts/univer/initial_sheet.d.ts +0 -31
- package/lib/types/ts/univer/unit_template.d.ts +0 -9
- package/lib/types/ts/univer/univer_file.d.ts +0 -33
- package/lib/types/ts/universer/v1/access_key.d.ts +0 -36
- package/lib/types/ts/universer/v1/access_key_logs.d.ts +0 -43
- package/lib/types/ts/universer/v1/activity.d.ts +0 -22
- package/lib/types/ts/universer/v1/analyse_cmn.d.ts +0 -27
- package/lib/types/ts/universer/v1/analyse_data_source.d.ts +0 -86
- package/lib/types/ts/universer/v1/analyse_task.d.ts +0 -232
- package/lib/types/ts/universer/v1/clipsheet_task.d.ts +0 -72
- package/lib/types/ts/universer/v1/conf.d.ts +0 -570
- package/lib/types/ts/universer/v1/connector.d.ts +0 -74
- package/lib/types/ts/universer/v1/conversation.d.ts +0 -578
- package/lib/types/ts/universer/v1/email.d.ts +0 -28
- package/lib/types/ts/universer/v1/entitlement.d.ts +0 -663
- package/lib/types/ts/universer/v1/exchange.d.ts +0 -101
- package/lib/types/ts/universer/v1/feedback.d.ts +0 -71
- package/lib/types/ts/universer/v1/frontend_logs.d.ts +0 -36
- package/lib/types/ts/universer/v1/go_config_center.d.ts +0 -91
- package/lib/types/ts/universer/v1/inbox.d.ts +0 -59
- package/lib/types/ts/universer/v1/invite_code.d.ts +0 -47
- package/lib/types/ts/universer/v1/license_manage.d.ts +0 -157
- package/lib/types/ts/universer/v1/oauth2.d.ts +0 -24
- package/lib/types/ts/universer/v1/oidc.d.ts +0 -167
- package/lib/types/ts/universer/v1/redemption_code.d.ts +0 -32
- package/lib/types/ts/universer/v1/referral.d.ts +0 -55
- package/lib/types/ts/universer/v1/scraper.d.ts +0 -144
- package/lib/types/ts/universer/v1/source_connector/api.d.ts +0 -110
- package/lib/types/ts/universer/v1/source_connector/conf.d.ts +0 -29
- package/lib/types/ts/universer/v1/source_connector/displayer.d.ts +0 -16
- package/lib/types/ts/universer/v1/source_connector/source.d.ts +0 -46
- package/lib/types/ts/universer/v1/source_connector/stream_view.d.ts +0 -31
- package/lib/types/ts/universer/v1/survey.d.ts +0 -25
- package/lib/types/ts/universer/v1/template.d.ts +0 -48
- package/lib/types/ts/universer/v1/toolkit.d.ts +0 -23
- package/lib/types/ts/universer/v1/trigger.d.ts +0 -102
- package/lib/types/ts/universer/v1/uniscript.d.ts +0 -104
- package/lib/types/ts/universer/v1/uniscript_logs.d.ts +0 -157
- package/lib/types/ts/universer/v1/univer_go_template.d.ts +0 -65
- package/lib/types/ts/universer/v1/user_event.d.ts +0 -23
- package/lib/types/ts/universer/v1/user_settings.d.ts +0 -22
- package/lib/types/ts/universer/v1/usip.d.ts +0 -62
- package/lib/types/ts/universer/v1/video_task.d.ts +0 -196
- package/lib/types/ts/universer/v1/workspace.d.ts +0 -273
|
@@ -1,663 +0,0 @@
|
|
|
1
|
-
import { Metadata } from '@grpc/grpc-js';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { Error } from '../../univer/constants/errors';
|
|
4
|
-
export declare const protobufPackage = "universer.v1";
|
|
5
|
-
export declare enum Interval {
|
|
6
|
-
Hour = 0,
|
|
7
|
-
Day = 1,
|
|
8
|
-
Week = 2,
|
|
9
|
-
Month = 3,
|
|
10
|
-
Year = 4,
|
|
11
|
-
UNRECOGNIZED = -1
|
|
12
|
-
}
|
|
13
|
-
export declare enum EntitlementItemType {
|
|
14
|
-
Ability = 0,
|
|
15
|
-
Rate = 1,
|
|
16
|
-
BizDefined = 2,
|
|
17
|
-
UNRECOGNIZED = -1
|
|
18
|
-
}
|
|
19
|
-
export declare enum EntitlementType {
|
|
20
|
-
InvalidEntitlement = 0,
|
|
21
|
-
TimeEntitlement = 1,
|
|
22
|
-
QuotaEntitlement = 2,
|
|
23
|
-
MixEntitlement = 3,
|
|
24
|
-
UNRECOGNIZED = -1
|
|
25
|
-
}
|
|
26
|
-
export declare enum QuotaKey {
|
|
27
|
-
NoneQuotaKey = 0,
|
|
28
|
-
CreditGeneral = 1,
|
|
29
|
-
UNRECOGNIZED = -1
|
|
30
|
-
}
|
|
31
|
-
export declare enum EntitlementItemId {
|
|
32
|
-
WebTableExtractRate = 0,
|
|
33
|
-
ServerExtractHistory = 1,
|
|
34
|
-
TabsPerExtract = 2,
|
|
35
|
-
TargetedExtract = 3,
|
|
36
|
-
StandardSearchRate = 4,
|
|
37
|
-
ProSearchRate = 5,
|
|
38
|
-
AvailableAImodels = 6,
|
|
39
|
-
RowsLimitedPerDrillDown = 7,
|
|
40
|
-
/** BiaoDaReportRate - for biaoda */
|
|
41
|
-
BiaoDaReportRate = 11,
|
|
42
|
-
/** BiaoDaChatReserveTime - 对话保存时间, type=BizDefined, value format: "30" means 30days, "-N" negative or 0 means infinity. */
|
|
43
|
-
BiaoDaChatReserveTime = 13,
|
|
44
|
-
/** BiaoDaAvailableModels - 可用模型, type=BizDefined, value format: "model-1,model-2", models seperate by ',' */
|
|
45
|
-
BiaoDaAvailableModels = 14,
|
|
46
|
-
/** BiaoDaMaxTextAnalyzeRows - 文本分析行数限制, type=BizDefined, value format: "10000" means max 10000 rows, "-N" negative or 0 means infinity. */
|
|
47
|
-
BiaoDaMaxTextAnalyzeRows = 15,
|
|
48
|
-
/** BiaoDaChartsWatermark - 下载图表水印, type=BizDefined, value format: "true" means should add watermark, "false" means no watermark. */
|
|
49
|
-
BiaoDaChartsWatermark = 16,
|
|
50
|
-
/** BiaoDaBasicModelChatRate - 基础模型对话分析频控 */
|
|
51
|
-
BiaoDaBasicModelChatRate = 17,
|
|
52
|
-
/** BiaoDaPremiumModelChatRate - 高级模型对话分析频控 */
|
|
53
|
-
BiaoDaPremiumModelChatRate = 18,
|
|
54
|
-
/** BiaoDaSubPageDrillDownRate - 子页面下钻频控 */
|
|
55
|
-
BiaoDaSubPageDrillDownRate = 19,
|
|
56
|
-
/** BiaoDaURLScrapeRate - URL采集频控 */
|
|
57
|
-
BiaoDaURLScrapeRate = 20,
|
|
58
|
-
/** BiaoDaMaxEnrichmentRows - 数据增强限制行数, type=BizDefined, value format: "10000" means max 10000 rows, "-N" negative or 0 means infinity. */
|
|
59
|
-
BiaoDaMaxEnrichmentRows = 26,
|
|
60
|
-
/** BiaoDaUnitDownload - unit下载,type=Ability */
|
|
61
|
-
BiaoDaUnitDownload = 31,
|
|
62
|
-
/** BiaoDaDashboardDownload - dashboard下载,type=Ability */
|
|
63
|
-
BiaoDaDashboardDownload = 32,
|
|
64
|
-
/** BiaoDaSuperScrapeRowsRate - 超级模板允许采集行数频控,type=Rate */
|
|
65
|
-
BiaoDaSuperScrapeRowsRate = 33,
|
|
66
|
-
/** BiaoDaSuperScrapeFreeTimesRate - 超级模板不限采集行数设置次数频控,type=Rate */
|
|
67
|
-
BiaoDaSuperScrapeFreeTimesRate = 34,
|
|
68
|
-
/** BiaoDaVideoScriptExtractTimesRate - 视频脚本提取处理次数频控,type=Rate */
|
|
69
|
-
BiaoDaVideoScriptExtractTimesRate = 35,
|
|
70
|
-
/** XlsxAIBasicPoints - xlsx.ai 基础积分 */
|
|
71
|
-
XlsxAIBasicPoints = 101,
|
|
72
|
-
UNRECOGNIZED = -1
|
|
73
|
-
}
|
|
74
|
-
export declare enum QuotaSource {
|
|
75
|
-
InvalidQuotaSource = 0,
|
|
76
|
-
AwardedQuota = 1,
|
|
77
|
-
RedeemedQuota = 2,
|
|
78
|
-
RegisterQuota = 3,
|
|
79
|
-
QuotaPackage = 4,
|
|
80
|
-
PlanedQuota = 5,
|
|
81
|
-
ReferralQuota = 6,
|
|
82
|
-
UNRECOGNIZED = -1
|
|
83
|
-
}
|
|
84
|
-
export declare enum QuotaUsageReason {
|
|
85
|
-
NonSpeciedUsage = 0,
|
|
86
|
-
ScrapeUsage = 1,
|
|
87
|
-
ChatUsage = 2,
|
|
88
|
-
ReportUsage = 3,
|
|
89
|
-
UnitEditUsage = 4,
|
|
90
|
-
/** TitleUsage - more later */
|
|
91
|
-
TitleUsage = 5,
|
|
92
|
-
RecommendationUsage = 6,
|
|
93
|
-
PromptOptimizationUsage = 7,
|
|
94
|
-
/** VideoTaskScriptUsage - video task step usages */
|
|
95
|
-
VideoTaskScriptUsage = 8,
|
|
96
|
-
VideoTaskScriptAnalysisUsage = 9,
|
|
97
|
-
VideoTaskStoryboardUsage = 10,
|
|
98
|
-
VideoTaskReuseUsage = 11,
|
|
99
|
-
VideoTaskRecreatePromptUsage = 12,
|
|
100
|
-
UNRECOGNIZED = -1
|
|
101
|
-
}
|
|
102
|
-
export declare enum ProductType {
|
|
103
|
-
NonProduct = 0,
|
|
104
|
-
Recurring = 1,
|
|
105
|
-
/** Freebie - freebie product, like the anonymous users can enjoy pro search 5 times per 4 hours */
|
|
106
|
-
Freebie = 2,
|
|
107
|
-
OneTime = 3,
|
|
108
|
-
UNRECOGNIZED = -1
|
|
109
|
-
}
|
|
110
|
-
export declare enum ProductCategory {
|
|
111
|
-
InvalidProductCategory = 0,
|
|
112
|
-
/** PlanProduct - 订阅类 */
|
|
113
|
-
PlanProduct = 1,
|
|
114
|
-
/** QuotaPackageProduct - 加量包类 */
|
|
115
|
-
QuotaPackageProduct = 2,
|
|
116
|
-
UNRECOGNIZED = -1
|
|
117
|
-
}
|
|
118
|
-
export declare enum SessionType {
|
|
119
|
-
/** SetupIntent - collect payment method */
|
|
120
|
-
SetupIntent = 0,
|
|
121
|
-
/** PaymentIntent - pay directly */
|
|
122
|
-
PaymentIntent = 1,
|
|
123
|
-
UNRECOGNIZED = -1
|
|
124
|
-
}
|
|
125
|
-
export declare enum SubscriptionStatus {
|
|
126
|
-
/** PendingCreate - the subscription is creating */
|
|
127
|
-
PendingCreate = 0,
|
|
128
|
-
/** Active - the subscription is active */
|
|
129
|
-
Active = 1,
|
|
130
|
-
/** PastDue - the subscription renewaled and pay failed */
|
|
131
|
-
PastDue = 2,
|
|
132
|
-
/** Expired - the subscription expired, due to not paid or offer the payment method */
|
|
133
|
-
Expired = 3,
|
|
134
|
-
/** Cancelled - cancelled, by user or system */
|
|
135
|
-
Cancelled = 4,
|
|
136
|
-
UNRECOGNIZED = -1
|
|
137
|
-
}
|
|
138
|
-
export declare enum IdentitySource {
|
|
139
|
-
InvalidIdentitySource = 0,
|
|
140
|
-
DefaultIdentity = 1,
|
|
141
|
-
AwardedIdentity = 2,
|
|
142
|
-
RedeemedIdentity = 3,
|
|
143
|
-
PlanedIdentity = 4,
|
|
144
|
-
RegisteredIdentity = 5,
|
|
145
|
-
ReferralIdentity = 6,
|
|
146
|
-
UNRECOGNIZED = -1
|
|
147
|
-
}
|
|
148
|
-
export declare enum UserInfoType {
|
|
149
|
-
Email = 0,
|
|
150
|
-
BillingAddress = 1,
|
|
151
|
-
UNRECOGNIZED = -1
|
|
152
|
-
}
|
|
153
|
-
export declare enum InvoiceStatus {
|
|
154
|
-
PendingPay = 0,
|
|
155
|
-
Paid = 1,
|
|
156
|
-
Void = 2,
|
|
157
|
-
UNRECOGNIZED = -1
|
|
158
|
-
}
|
|
159
|
-
export declare enum PaymentChannel {
|
|
160
|
-
NonPay = 0,
|
|
161
|
-
AliPay = 1,
|
|
162
|
-
WechatPay = 2,
|
|
163
|
-
Stripe = 3,
|
|
164
|
-
UNRECOGNIZED = -1
|
|
165
|
-
}
|
|
166
|
-
export declare enum OrderStatus {
|
|
167
|
-
Order_StatusNone = 0,
|
|
168
|
-
Order_PendingPay = 1,
|
|
169
|
-
Order_Cancelled = 2,
|
|
170
|
-
Order_Expired = 3,
|
|
171
|
-
Order_Completed = 4,
|
|
172
|
-
UNRECOGNIZED = -1
|
|
173
|
-
}
|
|
174
|
-
export interface RateLimiter {
|
|
175
|
-
/** negative value means infinity */
|
|
176
|
-
limitedCnt: number;
|
|
177
|
-
/** eg. if interval=Week and interval_cnt=3, it's mean 3 weeks */
|
|
178
|
-
interval: Interval;
|
|
179
|
-
intervalCnt: number;
|
|
180
|
-
}
|
|
181
|
-
export interface EntitlementItem {
|
|
182
|
-
itemId: string;
|
|
183
|
-
name: string;
|
|
184
|
-
/** optional */
|
|
185
|
-
tips: string;
|
|
186
|
-
type: EntitlementItemType;
|
|
187
|
-
/** is the ability enable? set if type is Ability */
|
|
188
|
-
enable: boolean;
|
|
189
|
-
/** set if type is Rate, the bool logic relation of each limiter is 'AND' */
|
|
190
|
-
rateLimiters: RateLimiter[];
|
|
191
|
-
/** biz defined value, set if type is BizDefined */
|
|
192
|
-
bizDefinedValue: string;
|
|
193
|
-
/** desc of biz defined value, set if type is BizDefined */
|
|
194
|
-
bizDefinedValueDesc: string;
|
|
195
|
-
}
|
|
196
|
-
export interface EntitlementItemGroup {
|
|
197
|
-
name: string;
|
|
198
|
-
items: EntitlementItem[];
|
|
199
|
-
}
|
|
200
|
-
export interface Entitlement {
|
|
201
|
-
/** level of the entitlement, higher is better */
|
|
202
|
-
level: number;
|
|
203
|
-
name: string;
|
|
204
|
-
groups: EntitlementItemGroup[];
|
|
205
|
-
id: string;
|
|
206
|
-
type: EntitlementType;
|
|
207
|
-
}
|
|
208
|
-
export interface RateDetail {
|
|
209
|
-
/** eg. if interval=Week and interval_cnt=3, it's mean 3 weeks */
|
|
210
|
-
interval: Interval;
|
|
211
|
-
intervalCnt: number;
|
|
212
|
-
/** total limit count, negative value means infinity */
|
|
213
|
-
limitedCnt: number;
|
|
214
|
-
/** left limit count, negative value means infinity */
|
|
215
|
-
leftCnt: number;
|
|
216
|
-
/** next time to reset the limit */
|
|
217
|
-
nextResetTime: number;
|
|
218
|
-
}
|
|
219
|
-
export interface EntitlementItemDetail {
|
|
220
|
-
itemId: string;
|
|
221
|
-
type: EntitlementItemType;
|
|
222
|
-
/** is the ability enable? set if type is Ability */
|
|
223
|
-
enable: boolean;
|
|
224
|
-
/** set if type is Rate, the bool logic relation of each limiter is 'AND' */
|
|
225
|
-
rateDetails: RateDetail[];
|
|
226
|
-
/** biz defined value, set if type is BizDefined */
|
|
227
|
-
bizDefinedValue: string;
|
|
228
|
-
}
|
|
229
|
-
export interface MGetEntitlementItemsByUserRequest {
|
|
230
|
-
userId: string;
|
|
231
|
-
/** item_id, string id of enum EntitlementItemId */
|
|
232
|
-
itemIds: string[];
|
|
233
|
-
}
|
|
234
|
-
export interface MGetEntitlementItemsByUserResponse {
|
|
235
|
-
/** key is item_id */
|
|
236
|
-
items: {
|
|
237
|
-
[key: string]: EntitlementItemDetail;
|
|
238
|
-
};
|
|
239
|
-
error: Error | undefined;
|
|
240
|
-
}
|
|
241
|
-
export interface MGetEntitlementItemsByUserResponse_ItemsEntry {
|
|
242
|
-
key: string;
|
|
243
|
-
value: EntitlementItemDetail | undefined;
|
|
244
|
-
}
|
|
245
|
-
export interface TakeNItemRateByUserRequest {
|
|
246
|
-
userId: string;
|
|
247
|
-
itemId: string;
|
|
248
|
-
n: number;
|
|
249
|
-
}
|
|
250
|
-
export interface TakeNItemRateByUserResponse {
|
|
251
|
-
allow: boolean;
|
|
252
|
-
/** if not allow, return how much lack */
|
|
253
|
-
lackCnt: number;
|
|
254
|
-
error: Error | undefined;
|
|
255
|
-
}
|
|
256
|
-
export interface DeductQuotaByUserRequest {
|
|
257
|
-
itemId: string;
|
|
258
|
-
/** deduct n, if available count less than n, deduct to 0. */
|
|
259
|
-
n: number;
|
|
260
|
-
}
|
|
261
|
-
export interface DeductQuotaByUserResponse {
|
|
262
|
-
error: Error | undefined;
|
|
263
|
-
}
|
|
264
|
-
export interface ReportQuotaUsageRequest {
|
|
265
|
-
/** string representation of enum QuotaKey */
|
|
266
|
-
quotaKey: string;
|
|
267
|
-
quotaUsed: number;
|
|
268
|
-
/** used to aggregate credits cost */
|
|
269
|
-
messageId?: string | undefined;
|
|
270
|
-
/** used to aggregate credits cost */
|
|
271
|
-
conversationId?: string | undefined;
|
|
272
|
-
reason: QuotaUsageReason;
|
|
273
|
-
}
|
|
274
|
-
export interface ReportQuotaUsageResponse {
|
|
275
|
-
error: Error | undefined;
|
|
276
|
-
}
|
|
277
|
-
export interface ListQuotaDetailsRequest {
|
|
278
|
-
/**
|
|
279
|
-
* batchId,
|
|
280
|
-
* set to empty in the 1st scroller request,
|
|
281
|
-
* then set to nextBatchId(which was returned by the previous request) in the following scroller request.
|
|
282
|
-
*/
|
|
283
|
-
batchId: string;
|
|
284
|
-
/** limit, specify how many records needed. */
|
|
285
|
-
limit: number;
|
|
286
|
-
quotaKey: string;
|
|
287
|
-
/** 是否只返回有可用quota的记录? */
|
|
288
|
-
availableOnly: boolean;
|
|
289
|
-
}
|
|
290
|
-
export interface ListQuotaDetailsResponse {
|
|
291
|
-
details: QuotaDetailRecord[];
|
|
292
|
-
hasMore: boolean;
|
|
293
|
-
nextBatchId: string;
|
|
294
|
-
error: Error | undefined;
|
|
295
|
-
}
|
|
296
|
-
export interface ListQuotaUsageRecordsRequest {
|
|
297
|
-
/**
|
|
298
|
-
* batchId,
|
|
299
|
-
* set to empty in the 1st scroller request,
|
|
300
|
-
* then set to nextBatchId(which was returned by the previous request) in the following scroller request.
|
|
301
|
-
*/
|
|
302
|
-
batchId: string;
|
|
303
|
-
/** limit, specify how many records needed. */
|
|
304
|
-
limit: number;
|
|
305
|
-
quotaKey: string;
|
|
306
|
-
}
|
|
307
|
-
export interface ListQuotaUsageRecordsResponse {
|
|
308
|
-
records: QuotaUsageRecord[];
|
|
309
|
-
hasMore: boolean;
|
|
310
|
-
nextBatchId: string;
|
|
311
|
-
error: Error | undefined;
|
|
312
|
-
}
|
|
313
|
-
export interface QuotaUsageRecord {
|
|
314
|
-
/** precision: seconds */
|
|
315
|
-
usageTime: string;
|
|
316
|
-
usageTotal: number;
|
|
317
|
-
reason: QuotaUsageReason;
|
|
318
|
-
conversationId?: string | undefined;
|
|
319
|
-
messageId?: string | undefined;
|
|
320
|
-
}
|
|
321
|
-
export interface GetQuotaItemRequest {
|
|
322
|
-
quotaKey: string;
|
|
323
|
-
}
|
|
324
|
-
export interface GetQuotaItemResponse {
|
|
325
|
-
/** 只返回真实可用大于0的明细 */
|
|
326
|
-
item: QuotaItem | undefined;
|
|
327
|
-
error: Error | undefined;
|
|
328
|
-
}
|
|
329
|
-
export interface QuotaDetailRecord {
|
|
330
|
-
source: QuotaSource;
|
|
331
|
-
/** precision: seconds */
|
|
332
|
-
grantTime: string;
|
|
333
|
-
/** precision: seconds */
|
|
334
|
-
expireTime: string;
|
|
335
|
-
quotaTotal: number;
|
|
336
|
-
quotaLeft: number;
|
|
337
|
-
}
|
|
338
|
-
export interface QuotaItem {
|
|
339
|
-
quotaKey: string;
|
|
340
|
-
totalAvailable: number;
|
|
341
|
-
details: QuotaDetailRecord[];
|
|
342
|
-
}
|
|
343
|
-
export interface QuotaItemConf {
|
|
344
|
-
quotaKey: string;
|
|
345
|
-
quotaTotal: number;
|
|
346
|
-
}
|
|
347
|
-
export interface Product {
|
|
348
|
-
productId: string;
|
|
349
|
-
productType: ProductType;
|
|
350
|
-
entitlement: Entitlement | undefined;
|
|
351
|
-
name: string;
|
|
352
|
-
/** optional, recommendation text of the product */
|
|
353
|
-
recommendation: string;
|
|
354
|
-
tags: string[];
|
|
355
|
-
entitlementType: EntitlementType;
|
|
356
|
-
category: ProductCategory;
|
|
357
|
-
quotaConfs: {
|
|
358
|
-
[key: string]: QuotaItemConf;
|
|
359
|
-
};
|
|
360
|
-
/** subscription interval if product_type is Recurring */
|
|
361
|
-
interval: Interval;
|
|
362
|
-
/** subscription interval count if product_type is Recurring */
|
|
363
|
-
intervalCnt: number;
|
|
364
|
-
/** the origin price */
|
|
365
|
-
price: string;
|
|
366
|
-
/** currency of the price */
|
|
367
|
-
currency: string;
|
|
368
|
-
/** optional, promotion price, set if there's any promotion */
|
|
369
|
-
promotionPrice: string;
|
|
370
|
-
/** optional, how many interval the promotion last, set if there's any promotion and product_type is Recurring */
|
|
371
|
-
promotionIntervalCnt: number;
|
|
372
|
-
/** work with quotaGrantIntervalCnt. subscription may be yearly, but quota is grant monthly. */
|
|
373
|
-
quotaGrantInterval: Interval;
|
|
374
|
-
/** work with quotaGrantInterval */
|
|
375
|
-
quotaGrantIntervalCnt: number;
|
|
376
|
-
/** optional, the product table name */
|
|
377
|
-
tabName: string;
|
|
378
|
-
}
|
|
379
|
-
export interface Product_QuotaConfsEntry {
|
|
380
|
-
key: string;
|
|
381
|
-
value: QuotaItemConf | undefined;
|
|
382
|
-
}
|
|
383
|
-
export interface PaymentSession {
|
|
384
|
-
sessionType: SessionType;
|
|
385
|
-
clientSecret: string;
|
|
386
|
-
/** eg:15.99, set if session_type is PaymentIntent */
|
|
387
|
-
amount: string;
|
|
388
|
-
/** eg:usd, set if session_type is PaymentIntent */
|
|
389
|
-
currency: string;
|
|
390
|
-
}
|
|
391
|
-
export interface Subscription {
|
|
392
|
-
subscriptionId: string;
|
|
393
|
-
productId: string;
|
|
394
|
-
productName: string;
|
|
395
|
-
status: SubscriptionStatus;
|
|
396
|
-
/** unix timestamp of UTC 0 */
|
|
397
|
-
subscriptTime: number;
|
|
398
|
-
/** unix timestamp of UTC 0 */
|
|
399
|
-
nextChargeTime: number;
|
|
400
|
-
entitlementType: EntitlementType;
|
|
401
|
-
entitlementLevel: number;
|
|
402
|
-
/** is the subscription need payment */
|
|
403
|
-
paymentNeeded: boolean;
|
|
404
|
-
/** optional, set session data if payment_needed is true */
|
|
405
|
-
session: PaymentSession | undefined;
|
|
406
|
-
}
|
|
407
|
-
export interface PaymentMethodCard {
|
|
408
|
-
brand: string;
|
|
409
|
-
country: string;
|
|
410
|
-
expMonth: number;
|
|
411
|
-
expYear: number;
|
|
412
|
-
fingerprint: string;
|
|
413
|
-
last4: string;
|
|
414
|
-
}
|
|
415
|
-
export interface PaymentMethod {
|
|
416
|
-
card: PaymentMethodCard | undefined;
|
|
417
|
-
}
|
|
418
|
-
/** entitlement identity of the user */
|
|
419
|
-
export interface Identity {
|
|
420
|
-
entitlementLevel: number;
|
|
421
|
-
entitlementName: string;
|
|
422
|
-
/** deprecated, this value has no significance. */
|
|
423
|
-
startTime: number;
|
|
424
|
-
/** deprecated, due to potential overflow risks, use expireTimeSec instead. */
|
|
425
|
-
expireTime: number;
|
|
426
|
-
/** is the system's default identity? */
|
|
427
|
-
isDefault: boolean;
|
|
428
|
-
/** expire time in seconds, negative value means the identity will never expire */
|
|
429
|
-
expireTimeSec: string;
|
|
430
|
-
entitlementType: EntitlementType;
|
|
431
|
-
identitySource: IdentitySource;
|
|
432
|
-
}
|
|
433
|
-
export interface GetSubscriptionSummaryRequest {
|
|
434
|
-
}
|
|
435
|
-
export interface GetSubscriptionSummaryResponse {
|
|
436
|
-
identity: Identity | undefined;
|
|
437
|
-
/** optional */
|
|
438
|
-
currentSubscription: Subscription | undefined;
|
|
439
|
-
/** optional, may be set if currently has any subscription */
|
|
440
|
-
paymentMethod: PaymentMethod | undefined;
|
|
441
|
-
/** key for QuotaKey string, val for available now */
|
|
442
|
-
availableQuotas: {
|
|
443
|
-
[key: string]: number;
|
|
444
|
-
};
|
|
445
|
-
error: Error | undefined;
|
|
446
|
-
}
|
|
447
|
-
export interface GetSubscriptionSummaryResponse_AvailableQuotasEntry {
|
|
448
|
-
key: string;
|
|
449
|
-
value: number;
|
|
450
|
-
}
|
|
451
|
-
export interface Address {
|
|
452
|
-
City: string;
|
|
453
|
-
Country: string;
|
|
454
|
-
Line1: string;
|
|
455
|
-
Line2: string;
|
|
456
|
-
PostalCode: string;
|
|
457
|
-
State: string;
|
|
458
|
-
}
|
|
459
|
-
export interface ProductGroup {
|
|
460
|
-
interval: Interval;
|
|
461
|
-
intervalCnt: number;
|
|
462
|
-
/** optional, eg. 20 means the saving percent is 20%, 0 or nil mean do not display percent */
|
|
463
|
-
maxSavingPercent: number;
|
|
464
|
-
products: Product[];
|
|
465
|
-
}
|
|
466
|
-
export interface ListProductsRequest {
|
|
467
|
-
couponCode: string;
|
|
468
|
-
}
|
|
469
|
-
export interface ListProductsResponse {
|
|
470
|
-
/** only return the subscription products */
|
|
471
|
-
groups: ProductGroup[];
|
|
472
|
-
/** set if has subscription */
|
|
473
|
-
currentSubscription: Subscription | undefined;
|
|
474
|
-
identity: Identity | undefined;
|
|
475
|
-
/** deprecated */
|
|
476
|
-
missingUserInfoTypes: UserInfoType[];
|
|
477
|
-
/** only return the quota packages */
|
|
478
|
-
quotaPackages: Product[];
|
|
479
|
-
isQuotaPackageAvailableForUser: boolean;
|
|
480
|
-
error: Error | undefined;
|
|
481
|
-
}
|
|
482
|
-
export interface CreateSubscriptionRequest {
|
|
483
|
-
productId: string;
|
|
484
|
-
/** set if previous CreateSubscriptionResponse returns error code ENTITLE_NEED_BILLING_ADDRESS */
|
|
485
|
-
billingAddress: Address | undefined;
|
|
486
|
-
/** deprecated, ignore this field */
|
|
487
|
-
email: string;
|
|
488
|
-
/** set the return url after payment complete */
|
|
489
|
-
paymentReturnUrl: string;
|
|
490
|
-
couponCode: string;
|
|
491
|
-
}
|
|
492
|
-
export interface CreateSubscriptionResponse {
|
|
493
|
-
session: PaymentSession | undefined;
|
|
494
|
-
/** if error code is ENTITLE_NEED_BILLING_ADDRESS, collect user's billing address and try again */
|
|
495
|
-
error: Error | undefined;
|
|
496
|
-
}
|
|
497
|
-
export interface ChangeSubscriptionRequest {
|
|
498
|
-
toProductId: string;
|
|
499
|
-
}
|
|
500
|
-
export interface ChangeSubscriptionResponse {
|
|
501
|
-
error: Error | undefined;
|
|
502
|
-
}
|
|
503
|
-
export interface CancelSubscriptionRequest {
|
|
504
|
-
subscriptionId: string;
|
|
505
|
-
/** optional */
|
|
506
|
-
reason: string;
|
|
507
|
-
}
|
|
508
|
-
export interface CancelSubscriptionResponse {
|
|
509
|
-
error: Error | undefined;
|
|
510
|
-
}
|
|
511
|
-
export interface Invoice {
|
|
512
|
-
id: string;
|
|
513
|
-
status: InvoiceStatus;
|
|
514
|
-
/** unixtimestamp of utc 0 */
|
|
515
|
-
payTime: number;
|
|
516
|
-
/** format 12.45 */
|
|
517
|
-
payAmount: string;
|
|
518
|
-
currency: string;
|
|
519
|
-
userId: string;
|
|
520
|
-
productId: string;
|
|
521
|
-
productName: string;
|
|
522
|
-
subscriptionId: string;
|
|
523
|
-
description: string;
|
|
524
|
-
/** link of the receipt */
|
|
525
|
-
receiptUrl: string;
|
|
526
|
-
/** download link of the invoice PDF */
|
|
527
|
-
invoicePdf: string;
|
|
528
|
-
/** invoice number */
|
|
529
|
-
invoiceNumber: string;
|
|
530
|
-
billingCycleNo: number;
|
|
531
|
-
couponCode: string;
|
|
532
|
-
}
|
|
533
|
-
export interface ListInvoicesRequest {
|
|
534
|
-
/** no of the first page is 1 */
|
|
535
|
-
pageNo: number;
|
|
536
|
-
/** max 100, default is 20 */
|
|
537
|
-
pageSize: number;
|
|
538
|
-
/** if set end_time but no start_time, it's mean [-infi, end_time) */
|
|
539
|
-
startTime: number;
|
|
540
|
-
/** if set start_time but no end_time, it's mean [start_time, now) */
|
|
541
|
-
endTime: number;
|
|
542
|
-
/** if set, only return the invoices generated by the subscription */
|
|
543
|
-
subscriptionId: string;
|
|
544
|
-
}
|
|
545
|
-
export interface ListInvoicesResponse {
|
|
546
|
-
invoices: Invoice[];
|
|
547
|
-
totalCnt: number;
|
|
548
|
-
error: Error | undefined;
|
|
549
|
-
}
|
|
550
|
-
export interface ListPaidInvoicesRequest {
|
|
551
|
-
batchId: string;
|
|
552
|
-
limit: number;
|
|
553
|
-
/** [begin, end) */
|
|
554
|
-
periodBegin: number;
|
|
555
|
-
periodEnd: number;
|
|
556
|
-
}
|
|
557
|
-
export interface ListPaidInvoicesResponse {
|
|
558
|
-
invoices: Invoice[];
|
|
559
|
-
hasMore: boolean;
|
|
560
|
-
nextBatchId: string;
|
|
561
|
-
error: Error | undefined;
|
|
562
|
-
}
|
|
563
|
-
export interface GetPaymentConfigRequest {
|
|
564
|
-
}
|
|
565
|
-
export interface GetPaymentConfigResponse {
|
|
566
|
-
channels: PaymentChannel[];
|
|
567
|
-
/** returned if has stripe channel */
|
|
568
|
-
stripePublicApiKey: string;
|
|
569
|
-
error: Error | undefined;
|
|
570
|
-
}
|
|
571
|
-
export interface PaymentRequest {
|
|
572
|
-
productId: string;
|
|
573
|
-
qty: number;
|
|
574
|
-
channel: PaymentChannel;
|
|
575
|
-
orderId: string;
|
|
576
|
-
/** for stripe channel only, optional, set if previous PaymentRequest returns error code ENTITLE_NEED_BILLING_ADDRESS */
|
|
577
|
-
billingAddress: Address | undefined;
|
|
578
|
-
/** for stripe channel only, required, redirect URL after pay success */
|
|
579
|
-
succUrl: string;
|
|
580
|
-
}
|
|
581
|
-
export interface PaymentResponse {
|
|
582
|
-
orderId: string;
|
|
583
|
-
/** for PaymentChannel AliPay and WechatPay */
|
|
584
|
-
payQRCode: string;
|
|
585
|
-
/** for PaymentChannel Stripe */
|
|
586
|
-
payLink: string;
|
|
587
|
-
channel: PaymentChannel;
|
|
588
|
-
error: Error | undefined;
|
|
589
|
-
}
|
|
590
|
-
export interface GetOrderStatusRequest {
|
|
591
|
-
orderId: string;
|
|
592
|
-
}
|
|
593
|
-
export interface GetOrderStatusResponse {
|
|
594
|
-
order: Order | undefined;
|
|
595
|
-
error: Error | undefined;
|
|
596
|
-
}
|
|
597
|
-
export interface Order {
|
|
598
|
-
id: string;
|
|
599
|
-
productId: string;
|
|
600
|
-
qty: number;
|
|
601
|
-
currency: string;
|
|
602
|
-
price: string;
|
|
603
|
-
amount: string;
|
|
604
|
-
status: OrderStatus;
|
|
605
|
-
expireTime: string;
|
|
606
|
-
}
|
|
607
|
-
export interface ListActiveEntitlementsRequest {
|
|
608
|
-
}
|
|
609
|
-
export interface ListActiveEntitlementsResponse {
|
|
610
|
-
entitlements: Entitlement[];
|
|
611
|
-
error: Error | undefined;
|
|
612
|
-
}
|
|
613
|
-
export interface GrantEntitlementRequest {
|
|
614
|
-
bizId: string;
|
|
615
|
-
bizGrantId: string;
|
|
616
|
-
toUserId: string;
|
|
617
|
-
/** if no fixed entitlement granted, set empty */
|
|
618
|
-
entitlementId: string;
|
|
619
|
-
interval: Interval;
|
|
620
|
-
intervalCnt: number;
|
|
621
|
-
/** if no quota granted, set empty */
|
|
622
|
-
quotaConfs: {
|
|
623
|
-
[key: string]: QuotaItemConf;
|
|
624
|
-
};
|
|
625
|
-
/** set if entitlementId setted */
|
|
626
|
-
identitySource: IdentitySource;
|
|
627
|
-
/** set if quotaConfs setted */
|
|
628
|
-
quotaSource: QuotaSource;
|
|
629
|
-
/** quotaInterval & quotaIntervalCnt specify the duration of granted quota */
|
|
630
|
-
quotaInterval: Interval;
|
|
631
|
-
/** quotaInterval & quotaIntervalCnt specify the duration of granted quota */
|
|
632
|
-
quotaIntervalCnt: number;
|
|
633
|
-
}
|
|
634
|
-
export interface GrantEntitlementRequest_QuotaConfsEntry {
|
|
635
|
-
key: string;
|
|
636
|
-
value: QuotaItemConf | undefined;
|
|
637
|
-
}
|
|
638
|
-
export interface GrantEntitlementResponse {
|
|
639
|
-
error: Error | undefined;
|
|
640
|
-
}
|
|
641
|
-
export interface EntitlementService {
|
|
642
|
-
MGetEntitlementItemsByUser(request: MGetEntitlementItemsByUserRequest, metadata?: Metadata): Observable<MGetEntitlementItemsByUserResponse>;
|
|
643
|
-
GetQuotaItem(request: GetQuotaItemRequest, metadata?: Metadata): Observable<GetQuotaItemResponse>;
|
|
644
|
-
ReportQuotaUsage(request: ReportQuotaUsageRequest, metadata?: Metadata): Observable<ReportQuotaUsageResponse>;
|
|
645
|
-
ListQuotaDetails(request: ListQuotaDetailsRequest, metadata?: Metadata): Observable<ListQuotaDetailsResponse>;
|
|
646
|
-
ListQuotaUsageRecords(request: ListQuotaUsageRecordsRequest, metadata?: Metadata): Observable<ListQuotaUsageRecordsResponse>;
|
|
647
|
-
/** for back-end only, can deduct and add. */
|
|
648
|
-
TakeNItemRateByUser(request: TakeNItemRateByUserRequest, metadata?: Metadata): Observable<TakeNItemRateByUserResponse>;
|
|
649
|
-
/** for front-end only case, just deduct, can not return quota. */
|
|
650
|
-
DeductQuotaByUser(request: DeductQuotaByUserRequest, metadata?: Metadata): Observable<DeductQuotaByUserResponse>;
|
|
651
|
-
GetPaymentConfig(request: GetPaymentConfigRequest, metadata?: Metadata): Observable<GetPaymentConfigResponse>;
|
|
652
|
-
ListProducts(request: ListProductsRequest, metadata?: Metadata): Observable<ListProductsResponse>;
|
|
653
|
-
GetSubscriptionSummary(request: GetSubscriptionSummaryRequest, metadata?: Metadata): Observable<GetSubscriptionSummaryResponse>;
|
|
654
|
-
CreateSubscription(request: CreateSubscriptionRequest, metadata?: Metadata): Observable<CreateSubscriptionResponse>;
|
|
655
|
-
ChangeSubscription(request: ChangeSubscriptionRequest, metadata?: Metadata): Observable<ChangeSubscriptionResponse>;
|
|
656
|
-
CancelSubscription(request: CancelSubscriptionRequest, metadata?: Metadata): Observable<CancelSubscriptionResponse>;
|
|
657
|
-
ListInvoices(request: ListInvoicesRequest, metadata?: Metadata): Observable<ListInvoicesResponse>;
|
|
658
|
-
ListPaidInvoices(request: ListPaidInvoicesRequest, metadata?: Metadata): Observable<ListPaidInvoicesResponse>;
|
|
659
|
-
Pay(request: PaymentRequest, metadata?: Metadata): Observable<PaymentResponse>;
|
|
660
|
-
GetOrderStatus(request: GetOrderStatusRequest, metadata?: Metadata): Observable<GetOrderStatusResponse>;
|
|
661
|
-
ListActiveEntitlements(request: ListActiveEntitlementsRequest, metadata?: Metadata): Observable<ListActiveEntitlementsResponse>;
|
|
662
|
-
GrantEntitlement(request: GrantEntitlementRequest, metadata?: Metadata): Observable<GrantEntitlementResponse>;
|
|
663
|
-
}
|