@rezamirzapour/pod-sdk 1.0.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/LICENSE +21 -0
- package/README.md +470 -0
- package/dist/index.d.mts +902 -0
- package/dist/index.d.ts +902 -0
- package/dist/index.js +1114 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1096 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
import { RetryConfig, RequestOptions } from '@rezamirzapour/http';
|
|
2
|
+
import { ILogger } from '@rezamirzapour/logger';
|
|
3
|
+
|
|
4
|
+
interface HandshakeResponse {
|
|
5
|
+
keyId: string;
|
|
6
|
+
algorithm: string;
|
|
7
|
+
expires_in: number;
|
|
8
|
+
}
|
|
9
|
+
interface TokenResponse {
|
|
10
|
+
hasError: boolean;
|
|
11
|
+
access_token: string;
|
|
12
|
+
device_uid: string;
|
|
13
|
+
expires_in: number;
|
|
14
|
+
id_token: string;
|
|
15
|
+
refresh_token: string;
|
|
16
|
+
scope: string;
|
|
17
|
+
token_type: string;
|
|
18
|
+
}
|
|
19
|
+
interface VerifyResponse {
|
|
20
|
+
code: string;
|
|
21
|
+
device_uid: string;
|
|
22
|
+
}
|
|
23
|
+
interface SsoUserProfile {
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
firstName?: string;
|
|
27
|
+
lastName?: string;
|
|
28
|
+
username: string;
|
|
29
|
+
cellphoneNumber?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
roles?: string[];
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
interface SendOtpOptions {
|
|
35
|
+
identityType?: string;
|
|
36
|
+
response_type?: string;
|
|
37
|
+
referrerType?: string;
|
|
38
|
+
linkDeliveryType?: string;
|
|
39
|
+
scope?: string;
|
|
40
|
+
redirect_uri?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface PodUrlsConfig {
|
|
44
|
+
accounts?: string;
|
|
45
|
+
apiPod?: string;
|
|
46
|
+
cms?: string;
|
|
47
|
+
podspace?: string;
|
|
48
|
+
podform?: string;
|
|
49
|
+
notification?: string;
|
|
50
|
+
iums?: string;
|
|
51
|
+
website?: string;
|
|
52
|
+
}
|
|
53
|
+
interface PodSdkConfig {
|
|
54
|
+
apiToken?: string;
|
|
55
|
+
clientId?: string;
|
|
56
|
+
clientSecret?: string;
|
|
57
|
+
privateKeyPem?: string;
|
|
58
|
+
urls?: PodUrlsConfig;
|
|
59
|
+
revalidate?: number | string;
|
|
60
|
+
timeout?: number;
|
|
61
|
+
retry?: boolean | RetryConfig;
|
|
62
|
+
logger?: ILogger;
|
|
63
|
+
}
|
|
64
|
+
interface PodResponse<T = any> {
|
|
65
|
+
hasError: boolean;
|
|
66
|
+
result?: T;
|
|
67
|
+
message?: string;
|
|
68
|
+
errorCode?: number;
|
|
69
|
+
referenceNumber?: string;
|
|
70
|
+
count?: number;
|
|
71
|
+
ott?: string;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface SsoServiceOptions {
|
|
76
|
+
baseUrl: string;
|
|
77
|
+
clientId: string;
|
|
78
|
+
clientSecret?: string;
|
|
79
|
+
apiToken?: string;
|
|
80
|
+
privateKeyPem?: string;
|
|
81
|
+
websiteUrl?: string;
|
|
82
|
+
revalidate?: number | string;
|
|
83
|
+
}
|
|
84
|
+
declare class SsoService {
|
|
85
|
+
private http;
|
|
86
|
+
private clientId;
|
|
87
|
+
private clientSecret;
|
|
88
|
+
private apiToken;
|
|
89
|
+
private privateKeyPem;
|
|
90
|
+
private websiteUrl;
|
|
91
|
+
private revalidate;
|
|
92
|
+
constructor(options: SsoServiceOptions);
|
|
93
|
+
/**
|
|
94
|
+
* Performs handshake with POD SSO to obtain a keyId for OTP signing.
|
|
95
|
+
*/
|
|
96
|
+
handshake(deviceUid: string, ip: string): Promise<PodResponse<HandshakeResponse>>;
|
|
97
|
+
/**
|
|
98
|
+
* Sends an OTP SMS to the specified phone number.
|
|
99
|
+
*/
|
|
100
|
+
sendOtpCode(keyId: string, phoneNumber: string, options?: SendOtpOptions): Promise<{
|
|
101
|
+
hasError: boolean;
|
|
102
|
+
authorization?: string;
|
|
103
|
+
identity?: string;
|
|
104
|
+
result?: any;
|
|
105
|
+
message?: string;
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* Verifies an OTP code received by SMS.
|
|
109
|
+
*/
|
|
110
|
+
verifyOtpCode(authorization: string, phoneNumber: string, code: string, redirectUri?: string): Promise<PodResponse<VerifyResponse>>;
|
|
111
|
+
/**
|
|
112
|
+
* Exchanges authorization code for access & refresh tokens.
|
|
113
|
+
*/
|
|
114
|
+
generateToken(code: string, redirectUri?: string): Promise<PodResponse<TokenResponse>>;
|
|
115
|
+
/**
|
|
116
|
+
* Refreshes an expired access token using a refresh token.
|
|
117
|
+
*/
|
|
118
|
+
refreshToken(refreshToken: string): Promise<PodResponse<TokenResponse>>;
|
|
119
|
+
/**
|
|
120
|
+
* Fetches user profile from SSO using the access token.
|
|
121
|
+
*/
|
|
122
|
+
getUserProfile(accessToken: string): Promise<PodResponse<SsoUserProfile>>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface SearchTimelineParamMetaQuery<T extends object = any> {
|
|
126
|
+
field?: string;
|
|
127
|
+
is?: string | number | boolean;
|
|
128
|
+
has?: string | number;
|
|
129
|
+
gt?: string | number;
|
|
130
|
+
gte?: string | number;
|
|
131
|
+
lt?: string | number;
|
|
132
|
+
lte?: string | number;
|
|
133
|
+
exist?: string | number | boolean;
|
|
134
|
+
not?: SearchTimelineParamMetaQuery<T>[];
|
|
135
|
+
true?: string | boolean;
|
|
136
|
+
false?: string | boolean;
|
|
137
|
+
or?: SearchTimelineParamMetaQuery<T>[];
|
|
138
|
+
and?: SearchTimelineParamMetaQuery<T>[];
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
}
|
|
141
|
+
interface SearchTimelineByMetadataParam<T extends object = any> {
|
|
142
|
+
id?: number;
|
|
143
|
+
size?: number;
|
|
144
|
+
offset?: number;
|
|
145
|
+
entityName?: string;
|
|
146
|
+
metaQuery?: SearchTimelineParamMetaQuery<T>;
|
|
147
|
+
metadata?: Partial<T>;
|
|
148
|
+
enable?: boolean;
|
|
149
|
+
orderBy?: string;
|
|
150
|
+
tags?: string[];
|
|
151
|
+
[key: string]: any;
|
|
152
|
+
}
|
|
153
|
+
interface CustomPostItem<T = any> {
|
|
154
|
+
id: number;
|
|
155
|
+
version?: number;
|
|
156
|
+
timelineId?: number;
|
|
157
|
+
entityId: number;
|
|
158
|
+
forwardedId?: number;
|
|
159
|
+
numOfLikes?: number;
|
|
160
|
+
numOfDisLikes?: number;
|
|
161
|
+
numOfSaved?: number;
|
|
162
|
+
numOfShare?: number;
|
|
163
|
+
numOfFavorites?: number;
|
|
164
|
+
numOfComments?: number;
|
|
165
|
+
timestamp?: number;
|
|
166
|
+
enable?: boolean;
|
|
167
|
+
hide?: boolean;
|
|
168
|
+
replyPostConfirmation?: boolean;
|
|
169
|
+
name?: string;
|
|
170
|
+
content?: string;
|
|
171
|
+
metadata: T;
|
|
172
|
+
latitude?: number;
|
|
173
|
+
longitude?: number;
|
|
174
|
+
canComment?: boolean;
|
|
175
|
+
canLike?: boolean;
|
|
176
|
+
canRate?: boolean;
|
|
177
|
+
tags?: string[];
|
|
178
|
+
tagTrees?: string[];
|
|
179
|
+
data?: string;
|
|
180
|
+
categoryList?: any[];
|
|
181
|
+
pin?: boolean;
|
|
182
|
+
[key: string]: any;
|
|
183
|
+
}
|
|
184
|
+
interface SearchTimelineResultItem<T = any> {
|
|
185
|
+
type?: number;
|
|
186
|
+
item: CustomPostItem<T>;
|
|
187
|
+
}
|
|
188
|
+
interface SearchTimelineResponse<T = any> {
|
|
189
|
+
hasError: boolean;
|
|
190
|
+
messageId?: number;
|
|
191
|
+
referenceNumber?: string;
|
|
192
|
+
errorCode?: number;
|
|
193
|
+
count?: number;
|
|
194
|
+
ott?: string;
|
|
195
|
+
message?: string;
|
|
196
|
+
result: SearchTimelineResultItem<T>[];
|
|
197
|
+
}
|
|
198
|
+
interface GetCustomPostParams {
|
|
199
|
+
id?: number;
|
|
200
|
+
entityId?: number;
|
|
201
|
+
size?: number;
|
|
202
|
+
offset?: number;
|
|
203
|
+
businessId?: number;
|
|
204
|
+
activityInfo?: boolean;
|
|
205
|
+
categoryCode?: string;
|
|
206
|
+
tags?: any[];
|
|
207
|
+
tagTrees?: string[];
|
|
208
|
+
tagTreeCategory?: string;
|
|
209
|
+
uniqueId?: number;
|
|
210
|
+
[key: string]: any;
|
|
211
|
+
}
|
|
212
|
+
interface GetCustomPostResponse<T = any> {
|
|
213
|
+
hasError: boolean;
|
|
214
|
+
messageId?: number;
|
|
215
|
+
referenceNumber?: string;
|
|
216
|
+
errorCode?: number;
|
|
217
|
+
count?: number;
|
|
218
|
+
ott?: string;
|
|
219
|
+
message?: string;
|
|
220
|
+
result: CustomPostItem<T>[];
|
|
221
|
+
}
|
|
222
|
+
interface AddCustomPostParams<T = any> {
|
|
223
|
+
name: string;
|
|
224
|
+
content?: string;
|
|
225
|
+
lgContent?: string;
|
|
226
|
+
metadata: T;
|
|
227
|
+
canComment?: boolean;
|
|
228
|
+
canLike?: boolean;
|
|
229
|
+
canRate?: boolean;
|
|
230
|
+
enable?: boolean;
|
|
231
|
+
tags?: string[];
|
|
232
|
+
[key: string]: any;
|
|
233
|
+
}
|
|
234
|
+
interface UpdateCustomPostParams<T = any> extends Partial<AddCustomPostParams<T>> {
|
|
235
|
+
entityId: number;
|
|
236
|
+
}
|
|
237
|
+
interface AddCustomPostResponse<T = any> {
|
|
238
|
+
hasError: boolean;
|
|
239
|
+
messageId?: number;
|
|
240
|
+
referenceNumber?: string;
|
|
241
|
+
errorCode?: number;
|
|
242
|
+
count?: number;
|
|
243
|
+
ott?: string;
|
|
244
|
+
message?: string;
|
|
245
|
+
result?: {
|
|
246
|
+
id: number;
|
|
247
|
+
entityId: number;
|
|
248
|
+
metadata?: T;
|
|
249
|
+
[key: string]: any;
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
interface Metadata<DataType = any> {
|
|
253
|
+
objectInfo: {
|
|
254
|
+
type?: string;
|
|
255
|
+
detailedType?: string;
|
|
256
|
+
[key: string]: any;
|
|
257
|
+
};
|
|
258
|
+
data: DataType;
|
|
259
|
+
[key: string]: any;
|
|
260
|
+
}
|
|
261
|
+
interface CustomPostCrudConfig {
|
|
262
|
+
type?: string;
|
|
263
|
+
detailedType?: string;
|
|
264
|
+
name: string;
|
|
265
|
+
content?: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Generic Type-Safe CRUD Repository built on top of POD CustomPost service.
|
|
270
|
+
* Allows managing any arbitrary business entity (Articles, Products, Courses, etc.)
|
|
271
|
+
* with full typing and metadata binding.
|
|
272
|
+
*/
|
|
273
|
+
declare class CustomPostCrudService<DataType> {
|
|
274
|
+
private readonly service;
|
|
275
|
+
private readonly config;
|
|
276
|
+
constructor(service: CustomPostService, config: CustomPostCrudConfig);
|
|
277
|
+
protected buildMetadata(data: DataType): Metadata<DataType>;
|
|
278
|
+
/**
|
|
279
|
+
* Searches and retrieves all entities matching the query.
|
|
280
|
+
*/
|
|
281
|
+
getAll(params?: SearchTimelineByMetadataParam<Metadata<DataType>>, options?: RequestOptions): Promise<SearchTimelineResponse<Metadata<DataType>>>;
|
|
282
|
+
/**
|
|
283
|
+
* Retrieves a single entity by its numerical ID.
|
|
284
|
+
*/
|
|
285
|
+
getById(id: number, options?: RequestOptions): Promise<GetCustomPostResponse<Metadata<DataType>>>;
|
|
286
|
+
/**
|
|
287
|
+
* Creates a new entity.
|
|
288
|
+
*/
|
|
289
|
+
create(data: DataType, options?: RequestOptions): Promise<AddCustomPostResponse<Metadata<DataType>>>;
|
|
290
|
+
/**
|
|
291
|
+
* Creates multiple entities in batch.
|
|
292
|
+
*/
|
|
293
|
+
createMultiple(dataList: DataType[], options?: RequestOptions): Promise<AddCustomPostResponse<Metadata<DataType>>[]>;
|
|
294
|
+
/**
|
|
295
|
+
* Updates an existing entity by entityId.
|
|
296
|
+
*/
|
|
297
|
+
update(entityId: number, data: DataType, enable?: boolean, options?: RequestOptions): Promise<AddCustomPostResponse<Metadata<DataType>>>;
|
|
298
|
+
/**
|
|
299
|
+
* Creates a post and automatically updates it by binding the generated entityId into the record data.
|
|
300
|
+
*/
|
|
301
|
+
createAndBindEntityId(data: DataType, options?: RequestOptions): Promise<AddCustomPostResponse<Metadata<DataType>>>;
|
|
302
|
+
/**
|
|
303
|
+
* Archives (disables) an entity without deleting its history.
|
|
304
|
+
*/
|
|
305
|
+
archive(entityId: number, data: DataType, options?: RequestOptions): Promise<AddCustomPostResponse<Metadata<DataType>>>;
|
|
306
|
+
/**
|
|
307
|
+
* Deletes an entity permanently.
|
|
308
|
+
*/
|
|
309
|
+
delete(entityId: number, options?: RequestOptions): Promise<AddCustomPostResponse>;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface CustomPostServiceOptions {
|
|
313
|
+
baseUrl: string;
|
|
314
|
+
apiToken: string;
|
|
315
|
+
revalidate?: number | string;
|
|
316
|
+
}
|
|
317
|
+
declare class CustomPostService {
|
|
318
|
+
private http;
|
|
319
|
+
private apiToken;
|
|
320
|
+
private revalidate;
|
|
321
|
+
constructor(options: CustomPostServiceOptions);
|
|
322
|
+
private safeParseJson;
|
|
323
|
+
/**
|
|
324
|
+
* Searches timeline entries by structured metadata query, returning typed items.
|
|
325
|
+
*/
|
|
326
|
+
searchTimelineByMetadata<T extends object = any>(params: SearchTimelineByMetadataParam<T>, options?: RequestOptions): Promise<SearchTimelineResponse<T>>;
|
|
327
|
+
/**
|
|
328
|
+
* Retrieves custom posts list or a single post by entityId/id with typed metadata.
|
|
329
|
+
*/
|
|
330
|
+
getCustomPost<T = any>(params: GetCustomPostParams, options?: RequestOptions): Promise<GetCustomPostResponse<T>>;
|
|
331
|
+
/**
|
|
332
|
+
* Creates a new custom post with strongly typed metadata.
|
|
333
|
+
*/
|
|
334
|
+
addCustomPost<T = any>(params: AddCustomPostParams<T>, options?: RequestOptions): Promise<AddCustomPostResponse<T>>;
|
|
335
|
+
/**
|
|
336
|
+
* Creates multiple custom posts in bulk.
|
|
337
|
+
*/
|
|
338
|
+
addCustomPostList<T = any>(items: AddCustomPostParams<T>[], options?: RequestOptions): Promise<AddCustomPostResponse<T>[]>;
|
|
339
|
+
/**
|
|
340
|
+
* Updates an existing custom post by its entityId with typed metadata.
|
|
341
|
+
*/
|
|
342
|
+
updateCustomPost<T = any>(params: UpdateCustomPostParams<T>, options?: RequestOptions): Promise<AddCustomPostResponse<T>>;
|
|
343
|
+
/**
|
|
344
|
+
* Deletes a custom post by entityId.
|
|
345
|
+
*/
|
|
346
|
+
deleteCustomPost(entityId: number, options?: RequestOptions): Promise<AddCustomPostResponse>;
|
|
347
|
+
/**
|
|
348
|
+
* Factory method to create a high-level Generic CRUD repository for any entity type.
|
|
349
|
+
*/
|
|
350
|
+
createCrud<DataType>(config: CustomPostCrudConfig): CustomPostCrudService<DataType>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
interface PodspaceUploadResult {
|
|
354
|
+
hash: string;
|
|
355
|
+
name: string;
|
|
356
|
+
size: number;
|
|
357
|
+
extension: string;
|
|
358
|
+
created: number;
|
|
359
|
+
updated: number;
|
|
360
|
+
path: string;
|
|
361
|
+
isPublic: boolean;
|
|
362
|
+
[key: string]: any;
|
|
363
|
+
}
|
|
364
|
+
interface PodspaceUploadResponse {
|
|
365
|
+
hasError: boolean;
|
|
366
|
+
message?: string;
|
|
367
|
+
errorCode?: number;
|
|
368
|
+
result?: PodspaceUploadResult;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
interface PodspaceServiceOptions {
|
|
372
|
+
baseUrl: string;
|
|
373
|
+
apiToken: string;
|
|
374
|
+
}
|
|
375
|
+
declare class PodspaceService {
|
|
376
|
+
private http;
|
|
377
|
+
private apiToken;
|
|
378
|
+
private baseUrl;
|
|
379
|
+
constructor(options: PodspaceServiceOptions);
|
|
380
|
+
/**
|
|
381
|
+
* Uploads a file (via FormData) to the POD Podspace storage.
|
|
382
|
+
*/
|
|
383
|
+
uploadFile(formData: FormData, path?: string, isPublic?: boolean): Promise<PodspaceUploadResponse>;
|
|
384
|
+
/**
|
|
385
|
+
* Builds the public or private URL to download/view a file.
|
|
386
|
+
*/
|
|
387
|
+
getFileUrl(hash: string, isPublic?: boolean): string;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface PodFormItem {
|
|
391
|
+
id: number;
|
|
392
|
+
title?: string;
|
|
393
|
+
elements?: any[];
|
|
394
|
+
[key: string]: any;
|
|
395
|
+
}
|
|
396
|
+
interface PodFormResponse<T = any> {
|
|
397
|
+
hasError: boolean;
|
|
398
|
+
message?: string;
|
|
399
|
+
errorCode?: number;
|
|
400
|
+
result?: T;
|
|
401
|
+
referenceNumber?: string;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
interface PodFormServiceOptions {
|
|
405
|
+
baseUrl: string;
|
|
406
|
+
apiToken: string;
|
|
407
|
+
revalidate?: number | string;
|
|
408
|
+
}
|
|
409
|
+
declare class PodFormService {
|
|
410
|
+
private http;
|
|
411
|
+
private apiToken;
|
|
412
|
+
private revalidate;
|
|
413
|
+
constructor(options: PodFormServiceOptions);
|
|
414
|
+
/**
|
|
415
|
+
* Submits responses/answers to a POD Form.
|
|
416
|
+
*/
|
|
417
|
+
sendForm<T extends Record<string, any>>(formId: number, data: T): Promise<PodFormResponse>;
|
|
418
|
+
/**
|
|
419
|
+
* Retrieves a form and its questions by ID.
|
|
420
|
+
*/
|
|
421
|
+
getPodformById(id: number, options?: RequestOptions): Promise<PodFormResponse<PodFormItem>>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface SendSmsParams {
|
|
425
|
+
content: string;
|
|
426
|
+
mobileNumbers: string[];
|
|
427
|
+
}
|
|
428
|
+
interface SendSmsResponse {
|
|
429
|
+
hasError: boolean;
|
|
430
|
+
message?: string;
|
|
431
|
+
errorCode?: number;
|
|
432
|
+
result?: any;
|
|
433
|
+
referenceNumber?: string;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
interface NotificationServiceOptions {
|
|
437
|
+
baseUrl: string;
|
|
438
|
+
apiToken: string;
|
|
439
|
+
}
|
|
440
|
+
declare class NotificationService {
|
|
441
|
+
private http;
|
|
442
|
+
private apiToken;
|
|
443
|
+
constructor(options: NotificationServiceOptions);
|
|
444
|
+
/**
|
|
445
|
+
* Sends an SMS notification to one or multiple mobile numbers.
|
|
446
|
+
*/
|
|
447
|
+
sendSms(params: SendSmsParams): Promise<SendSmsResponse>;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface CommentItem {
|
|
451
|
+
id: number;
|
|
452
|
+
text?: string;
|
|
453
|
+
createDate?: number;
|
|
454
|
+
likeCount?: number;
|
|
455
|
+
dislikeCount?: number;
|
|
456
|
+
user?: any;
|
|
457
|
+
[key: string]: any;
|
|
458
|
+
}
|
|
459
|
+
interface GetCommentListParams {
|
|
460
|
+
subjectId: number | string;
|
|
461
|
+
offset?: number;
|
|
462
|
+
size?: number;
|
|
463
|
+
[key: string]: any;
|
|
464
|
+
}
|
|
465
|
+
interface AddCommentParams {
|
|
466
|
+
subjectId: number | string;
|
|
467
|
+
text: string;
|
|
468
|
+
repliedId?: number;
|
|
469
|
+
[key: string]: any;
|
|
470
|
+
}
|
|
471
|
+
interface LikeCommentParams {
|
|
472
|
+
commentId: number;
|
|
473
|
+
dislike?: boolean;
|
|
474
|
+
}
|
|
475
|
+
interface LikePostParams {
|
|
476
|
+
subjectId: number | string;
|
|
477
|
+
dislike?: boolean;
|
|
478
|
+
}
|
|
479
|
+
interface SocialResponse<T = any> {
|
|
480
|
+
hasError: boolean;
|
|
481
|
+
message?: string;
|
|
482
|
+
errorCode?: number;
|
|
483
|
+
result?: T;
|
|
484
|
+
count?: number;
|
|
485
|
+
ott?: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface SocialServiceOptions {
|
|
489
|
+
baseUrl: string;
|
|
490
|
+
apiToken: string;
|
|
491
|
+
revalidate?: number | string;
|
|
492
|
+
}
|
|
493
|
+
declare class SocialService {
|
|
494
|
+
private http;
|
|
495
|
+
private apiToken;
|
|
496
|
+
private revalidate;
|
|
497
|
+
constructor(options: SocialServiceOptions);
|
|
498
|
+
/**
|
|
499
|
+
* Retrieves comments for a specific post or subject ID.
|
|
500
|
+
*/
|
|
501
|
+
getCommentList(params: GetCommentListParams, options?: RequestOptions): Promise<SocialResponse<CommentItem[]>>;
|
|
502
|
+
/**
|
|
503
|
+
* Adds a new comment to a subject.
|
|
504
|
+
*/
|
|
505
|
+
addComment(params: AddCommentParams): Promise<SocialResponse>;
|
|
506
|
+
/**
|
|
507
|
+
* Likes or dislikes a comment.
|
|
508
|
+
*/
|
|
509
|
+
likeComment(params: LikeCommentParams): Promise<SocialResponse>;
|
|
510
|
+
/**
|
|
511
|
+
* Likes or dislikes a post.
|
|
512
|
+
*/
|
|
513
|
+
likePost(params: LikePostParams): Promise<SocialResponse>;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
interface GetContentParams {
|
|
517
|
+
offset?: number;
|
|
518
|
+
size?: number;
|
|
519
|
+
tagTrees?: string[];
|
|
520
|
+
operationTagTrees?: 'and' | 'or';
|
|
521
|
+
orderBy?: string[];
|
|
522
|
+
contentTypeUniqueId?: string;
|
|
523
|
+
contentUniqueId?: string;
|
|
524
|
+
entityIds?: string[] | number[];
|
|
525
|
+
entityId?: number;
|
|
526
|
+
postIds?: number[];
|
|
527
|
+
notPostIds?: number[];
|
|
528
|
+
fieldCode?: string[];
|
|
529
|
+
fieldValue?: (string | number)[];
|
|
530
|
+
operationFields?: string;
|
|
531
|
+
operationValues?: string;
|
|
532
|
+
showDetail?: boolean;
|
|
533
|
+
operationValuesArray?: ('is' | 'has' | 'startWith' | 'endWith' | 'lt' | 'lte' | 'gt' | 'gte' | 'exist')[];
|
|
534
|
+
excludeFieldCode?: string[];
|
|
535
|
+
excludeFieldValue?: string[];
|
|
536
|
+
operationExcludeValues?: string;
|
|
537
|
+
tags?: string[];
|
|
538
|
+
operationTags?: string;
|
|
539
|
+
operationValueTags?: string[];
|
|
540
|
+
orderTagTree?: string;
|
|
541
|
+
tagTreesCode?: string[];
|
|
542
|
+
operationTagTreesCode?: string;
|
|
543
|
+
operationValueTagTreesCode?: string;
|
|
544
|
+
name?: string;
|
|
545
|
+
operationName?: string;
|
|
546
|
+
creatorId?: number;
|
|
547
|
+
updaterId?: number;
|
|
548
|
+
publisherId?: number;
|
|
549
|
+
unPublisherId?: number;
|
|
550
|
+
fromCreateDate?: string;
|
|
551
|
+
toCreateDate?: string;
|
|
552
|
+
fromUpdateDate?: string;
|
|
553
|
+
toUpdateDate?: string;
|
|
554
|
+
fromPublisheDate?: string;
|
|
555
|
+
toPublisheDate?: string;
|
|
556
|
+
fromUnpublishDate?: string;
|
|
557
|
+
toUnpublishDate?: string;
|
|
558
|
+
relatedContentId?: number;
|
|
559
|
+
relatedProductId?: number;
|
|
560
|
+
fullName?: string;
|
|
561
|
+
internalNumber?: string;
|
|
562
|
+
jobTitle?: string;
|
|
563
|
+
department?: string;
|
|
564
|
+
deputy?: string;
|
|
565
|
+
[key: string]: any;
|
|
566
|
+
}
|
|
567
|
+
interface GetCategoriesParams {
|
|
568
|
+
parentId?: number;
|
|
569
|
+
id?: string;
|
|
570
|
+
parentCode?: string;
|
|
571
|
+
includeParent?: boolean;
|
|
572
|
+
excludeTree?: boolean;
|
|
573
|
+
levelCount?: number;
|
|
574
|
+
level?: number;
|
|
575
|
+
name?: string;
|
|
576
|
+
size?: number;
|
|
577
|
+
offset?: number;
|
|
578
|
+
siblingOrder?: string;
|
|
579
|
+
[key: string]: any;
|
|
580
|
+
}
|
|
581
|
+
interface GetContentByEntityIdParams {
|
|
582
|
+
entityId: number | string;
|
|
583
|
+
contentTypeUniqueId?: string;
|
|
584
|
+
}
|
|
585
|
+
interface Business {
|
|
586
|
+
id: number;
|
|
587
|
+
name: string;
|
|
588
|
+
image: string;
|
|
589
|
+
numOfProducts: number;
|
|
590
|
+
rate: {
|
|
591
|
+
rate: number;
|
|
592
|
+
rateCount: number;
|
|
593
|
+
};
|
|
594
|
+
ssoId: string | number;
|
|
595
|
+
}
|
|
596
|
+
interface Rate {
|
|
597
|
+
rate: number;
|
|
598
|
+
rateCount: number;
|
|
599
|
+
}
|
|
600
|
+
interface UserPostInfo {
|
|
601
|
+
postId: number;
|
|
602
|
+
liked: boolean;
|
|
603
|
+
disliked: boolean;
|
|
604
|
+
favorite: boolean;
|
|
605
|
+
}
|
|
606
|
+
interface SeoType {
|
|
607
|
+
keyword?: string[];
|
|
608
|
+
description?: string;
|
|
609
|
+
}
|
|
610
|
+
type MetaContent = {
|
|
611
|
+
code: number | string;
|
|
612
|
+
name: string;
|
|
613
|
+
primary: boolean;
|
|
614
|
+
order: number;
|
|
615
|
+
uiType: string;
|
|
616
|
+
valueTitles?: string;
|
|
617
|
+
} & ({
|
|
618
|
+
value: string;
|
|
619
|
+
type: 'STRING_VALUE_TYPE';
|
|
620
|
+
} | {
|
|
621
|
+
value: string;
|
|
622
|
+
type: 'IMAGE_TYPE';
|
|
623
|
+
} | {
|
|
624
|
+
value: boolean;
|
|
625
|
+
type: 'CONTROLLED_VALUE_TYPE';
|
|
626
|
+
} | {
|
|
627
|
+
value: number;
|
|
628
|
+
type: 'NUMBER_TYPE';
|
|
629
|
+
} | {
|
|
630
|
+
value: any;
|
|
631
|
+
type: string;
|
|
632
|
+
});
|
|
633
|
+
interface TagtreesType {
|
|
634
|
+
id: number;
|
|
635
|
+
name: string;
|
|
636
|
+
code: string;
|
|
637
|
+
categoryName?: string;
|
|
638
|
+
siblingOrder?: number;
|
|
639
|
+
metadata?: {
|
|
640
|
+
content?: string;
|
|
641
|
+
created?: any;
|
|
642
|
+
parentModifier?: any;
|
|
643
|
+
updated?: any;
|
|
644
|
+
displayName?: string;
|
|
645
|
+
englishName?: string;
|
|
646
|
+
[key: string]: any;
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
interface CmsMetadata {
|
|
650
|
+
content_type_id: string;
|
|
651
|
+
content: MetaContent[];
|
|
652
|
+
content_related?: any[];
|
|
653
|
+
product_related?: any[];
|
|
654
|
+
seo?: SeoType;
|
|
655
|
+
created?: {
|
|
656
|
+
at: number;
|
|
657
|
+
user_name: string;
|
|
658
|
+
ssoId: number;
|
|
659
|
+
};
|
|
660
|
+
updated?: {
|
|
661
|
+
at: number;
|
|
662
|
+
user_name: string;
|
|
663
|
+
ssoId: number;
|
|
664
|
+
};
|
|
665
|
+
content_type_name?: string;
|
|
666
|
+
content_type_description?: string;
|
|
667
|
+
[key: string]: any;
|
|
668
|
+
}
|
|
669
|
+
interface ResultItem {
|
|
670
|
+
id: number;
|
|
671
|
+
version?: number;
|
|
672
|
+
timelineId?: number;
|
|
673
|
+
entityId: number;
|
|
674
|
+
forwardedId?: number;
|
|
675
|
+
numOfLikes?: number;
|
|
676
|
+
numOfDisLikes?: number;
|
|
677
|
+
numOfShare?: number;
|
|
678
|
+
numOfFavorites?: number;
|
|
679
|
+
numOfComments?: number;
|
|
680
|
+
timestamp?: number;
|
|
681
|
+
enable?: boolean;
|
|
682
|
+
hide?: boolean;
|
|
683
|
+
replyPostConfirmation?: boolean;
|
|
684
|
+
business?: Business;
|
|
685
|
+
rate?: Rate;
|
|
686
|
+
userPostInfo?: UserPostInfo;
|
|
687
|
+
metadata: CmsMetadata;
|
|
688
|
+
latitude?: number;
|
|
689
|
+
longitude?: number;
|
|
690
|
+
canComment?: boolean;
|
|
691
|
+
canLike?: boolean;
|
|
692
|
+
canRate?: boolean;
|
|
693
|
+
newRate?: number;
|
|
694
|
+
countSubjects?: number;
|
|
695
|
+
countRateSubjects?: number;
|
|
696
|
+
tags?: string[];
|
|
697
|
+
tagTrees?: TagtreesType[];
|
|
698
|
+
name?: string;
|
|
699
|
+
categoryList?: any[];
|
|
700
|
+
[key: string]: any;
|
|
701
|
+
}
|
|
702
|
+
interface Subject extends ResultItem {
|
|
703
|
+
}
|
|
704
|
+
interface FormattedSubject extends Subject {
|
|
705
|
+
formatted: Record<string | number, any>;
|
|
706
|
+
__normalized: Record<string | number, any>;
|
|
707
|
+
}
|
|
708
|
+
interface ResultItemWithFormatted<T extends Record<string, any>, P = {}> extends ResultItem {
|
|
709
|
+
formatted: T;
|
|
710
|
+
__normalized: P;
|
|
711
|
+
}
|
|
712
|
+
interface GetContentResponse {
|
|
713
|
+
referenceNumber?: string;
|
|
714
|
+
hasError: boolean;
|
|
715
|
+
errorCode?: number;
|
|
716
|
+
refId?: string;
|
|
717
|
+
message?: string | any[];
|
|
718
|
+
count?: number;
|
|
719
|
+
aggregations?: number;
|
|
720
|
+
result: ResultItem[];
|
|
721
|
+
product_related?: any[];
|
|
722
|
+
seo?: SeoType[];
|
|
723
|
+
metadata?: any[];
|
|
724
|
+
[key: string]: any;
|
|
725
|
+
}
|
|
726
|
+
interface FormattedGetContentResponse<T extends Record<string, any> = Record<string, any>, P = {}> extends Omit<GetContentResponse, 'result'> {
|
|
727
|
+
result: ResultItemWithFormatted<T, P>[];
|
|
728
|
+
}
|
|
729
|
+
interface GetCategoryResponse {
|
|
730
|
+
referenceNumber?: string;
|
|
731
|
+
hasError: boolean;
|
|
732
|
+
errorCode?: number;
|
|
733
|
+
refId?: string;
|
|
734
|
+
message?: string | any[];
|
|
735
|
+
count?: number;
|
|
736
|
+
aggregations?: number;
|
|
737
|
+
result: TagtreesType[];
|
|
738
|
+
metadata?: any[];
|
|
739
|
+
[key: string]: any;
|
|
740
|
+
}
|
|
741
|
+
interface TimelineSearchBody {
|
|
742
|
+
advance?: {
|
|
743
|
+
property?: string;
|
|
744
|
+
value?: string;
|
|
745
|
+
logicalOperator?: string;
|
|
746
|
+
operands?: TimelineSearchBody['advance'][];
|
|
747
|
+
};
|
|
748
|
+
size?: number;
|
|
749
|
+
offset?: number;
|
|
750
|
+
[key: string]: any;
|
|
751
|
+
}
|
|
752
|
+
interface TimelineResponse extends Omit<GetContentResponse, 'result'> {
|
|
753
|
+
result: any[];
|
|
754
|
+
}
|
|
755
|
+
interface AddContentParams {
|
|
756
|
+
contentTypeUniqueId: string;
|
|
757
|
+
body: {
|
|
758
|
+
name: string;
|
|
759
|
+
metaDescription?: string;
|
|
760
|
+
keyword?: string[];
|
|
761
|
+
contentDescription?: string;
|
|
762
|
+
tags?: string[];
|
|
763
|
+
tagTrees?: string[];
|
|
764
|
+
fieldCode?: string[];
|
|
765
|
+
fieldValue?: any[];
|
|
766
|
+
canRate?: boolean;
|
|
767
|
+
canLike?: boolean;
|
|
768
|
+
canComment?: boolean;
|
|
769
|
+
enable?: boolean;
|
|
770
|
+
isSearchable?: boolean;
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
interface CmsRequestOptions {
|
|
775
|
+
normalizer?: (item: FormattedSubject) => Record<string, any>;
|
|
776
|
+
revalidate?: number | false;
|
|
777
|
+
cache?: RequestCache;
|
|
778
|
+
headers?: HeadersInit;
|
|
779
|
+
signal?: AbortSignal;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
declare class CmsDataFormatter {
|
|
783
|
+
private podspaceUrl;
|
|
784
|
+
constructor(podspaceUrl?: string);
|
|
785
|
+
generateImage(hash?: string, defaultSrc?: string): string;
|
|
786
|
+
formatContentItem(item: any, normalizer?: (item: FormattedSubject) => Record<string, any>): any;
|
|
787
|
+
formatGetContentResponse<T extends Record<string, any> = Record<string, any>, P = {}>(response: any, normalizer?: (item: FormattedSubject) => Record<string, any>): FormattedGetContentResponse<T, P>;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
interface CmsServiceOptions {
|
|
791
|
+
baseUrl: string;
|
|
792
|
+
clientId: string;
|
|
793
|
+
apiToken?: string;
|
|
794
|
+
podspaceUrl?: string;
|
|
795
|
+
revalidate?: number | string;
|
|
796
|
+
}
|
|
797
|
+
declare class CmsService {
|
|
798
|
+
private http;
|
|
799
|
+
private formatter;
|
|
800
|
+
private clientId;
|
|
801
|
+
private apiToken;
|
|
802
|
+
private revalidate;
|
|
803
|
+
constructor(options: CmsServiceOptions);
|
|
804
|
+
private get commonHeaders();
|
|
805
|
+
private get managingHeaders();
|
|
806
|
+
/**
|
|
807
|
+
* Retrieves enabled published content from CMS, formatted with generic metadata type T and optional normalized type P.
|
|
808
|
+
*/
|
|
809
|
+
getContent<T extends Record<string, any> = Record<string, any>, P = {}>(params?: GetContentParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
810
|
+
/**
|
|
811
|
+
* Retrieves content using managing credentials (Access-Token).
|
|
812
|
+
*/
|
|
813
|
+
getContent2<T extends Record<string, any> = Record<string, any>, P = {}>(params?: GetContentParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
814
|
+
/**
|
|
815
|
+
* Retrieves unpublished/draft content (enable: false).
|
|
816
|
+
*/
|
|
817
|
+
getUnpublishedContent<T extends Record<string, any> = Record<string, any>, P = {}>(params?: GetContentParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
818
|
+
/**
|
|
819
|
+
* Retrieves single content by entityId and optional contentTypeUniqueId.
|
|
820
|
+
*/
|
|
821
|
+
getContentByEntityId<T extends Record<string, any> = Record<string, any>, P = {}>(params: GetContentByEntityIdParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
822
|
+
/**
|
|
823
|
+
* Retrieves tag/category tree.
|
|
824
|
+
*/
|
|
825
|
+
getCategories(params?: GetCategoriesParams, options?: CmsRequestOptions): Promise<GetCategoryResponse>;
|
|
826
|
+
/**
|
|
827
|
+
* Retrieves details of a content type structure.
|
|
828
|
+
*/
|
|
829
|
+
getContentTypeDetail(contentTypeUniqueId: string): Promise<any>;
|
|
830
|
+
/**
|
|
831
|
+
* Adds and publishes new content to CMS.
|
|
832
|
+
*/
|
|
833
|
+
addContent<T extends Record<string, any> = Record<string, any>, P = {}>(params: AddContentParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
834
|
+
/**
|
|
835
|
+
* Edits and publishes existing content by entityId.
|
|
836
|
+
*/
|
|
837
|
+
editContent<T extends Record<string, any> = Record<string, any>, P = {}>(entityId: number, params: AddContentParams, options?: CmsRequestOptions): Promise<FormattedGetContentResponse<T, P>>;
|
|
838
|
+
/**
|
|
839
|
+
* Performs advanced AI timeline search.
|
|
840
|
+
*/
|
|
841
|
+
timelineSearch(query?: TimelineSearchBody): Promise<TimelineResponse>;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
interface GetInfOfGraduatedByGraduateDateResponse {
|
|
845
|
+
[key: string]: any;
|
|
846
|
+
}
|
|
847
|
+
interface GetSessionClassInCurrentDayResponse {
|
|
848
|
+
[key: string]: any;
|
|
849
|
+
}
|
|
850
|
+
interface IumsResponse<T = any> {
|
|
851
|
+
content: string;
|
|
852
|
+
[key: string]: any;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
interface IumsServiceOptions {
|
|
856
|
+
baseUrl: string;
|
|
857
|
+
clientId: string;
|
|
858
|
+
revalidate?: number | string;
|
|
859
|
+
}
|
|
860
|
+
declare class IumsService {
|
|
861
|
+
private http;
|
|
862
|
+
private clientId;
|
|
863
|
+
private revalidate;
|
|
864
|
+
constructor(options: IumsServiceOptions);
|
|
865
|
+
private generateIumsDataPayload;
|
|
866
|
+
private formatIumsResponse;
|
|
867
|
+
private request;
|
|
868
|
+
getInfOfGraduatedByGraduateDate(startDate?: string, endDate?: string, options?: RequestOptions): Promise<GetInfOfGraduatedByGraduateDateResponse>;
|
|
869
|
+
getSessionClassInCurrentDay(options?: RequestOptions): Promise<GetSessionClassInCurrentDayResponse>;
|
|
870
|
+
getDetailsOfTermExam(options?: RequestOptions): Promise<any>;
|
|
871
|
+
getStudentInformationByNumber(studentNumber: string | number, options?: RequestOptions): Promise<any>;
|
|
872
|
+
getStudentInformationByNationalCode(nationalCode: string | number, options?: RequestOptions): Promise<any>;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class PodSdk {
|
|
876
|
+
readonly sso: SsoService;
|
|
877
|
+
readonly customPost: CustomPostService;
|
|
878
|
+
readonly podspace: PodspaceService;
|
|
879
|
+
readonly podform: PodFormService;
|
|
880
|
+
readonly notification: NotificationService;
|
|
881
|
+
readonly social: SocialService;
|
|
882
|
+
readonly cms: CmsService;
|
|
883
|
+
readonly iums: IumsService;
|
|
884
|
+
constructor(config: PodSdkConfig);
|
|
885
|
+
/**
|
|
886
|
+
* Helper shortcut to instantiate a Generic CRUD repository for any entity type on POD CustomPost.
|
|
887
|
+
*/
|
|
888
|
+
createCrud<DataType>(config: CustomPostCrudConfig): CustomPostCrudService<DataType>;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Factory function to create a new POD SDK instance.
|
|
892
|
+
*/
|
|
893
|
+
declare function createPodSdk(config: PodSdkConfig): PodSdk;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Cryptographic and encoding utilities for POD Platform services.
|
|
897
|
+
* Uses standard Web Crypto API (supported natively in Node.js 18+, Browsers, and Edge).
|
|
898
|
+
*/
|
|
899
|
+
declare function encodeBase64(str: string): string;
|
|
900
|
+
declare function generatePodSignatureHeader(keyId: string, privateKeyPem?: string): Promise<string>;
|
|
901
|
+
|
|
902
|
+
export { type AddCommentParams, type AddContentParams, type AddCustomPostParams, type AddCustomPostResponse, type Business, CmsDataFormatter, type CmsMetadata, type CmsRequestOptions, CmsService, type CmsServiceOptions, type CommentItem, type CustomPostCrudConfig, CustomPostCrudService, type CustomPostItem, CustomPostService, type CustomPostServiceOptions, type FormattedGetContentResponse, type FormattedSubject, type GetCategoriesParams, type GetCategoryResponse, type GetCommentListParams, type GetContentByEntityIdParams, type GetContentParams, type GetContentResponse, type GetCustomPostParams, type GetCustomPostResponse, type GetInfOfGraduatedByGraduateDateResponse, type GetSessionClassInCurrentDayResponse, type HandshakeResponse, type IumsResponse, IumsService, type IumsServiceOptions, type LikeCommentParams, type LikePostParams, type MetaContent, type Metadata, NotificationService, type NotificationServiceOptions, type PodFormItem, type PodFormResponse, PodFormService, type PodFormServiceOptions, type PodResponse, PodSdk, type PodSdkConfig, type PodUrlsConfig, PodspaceService, type PodspaceServiceOptions, type PodspaceUploadResponse, type PodspaceUploadResult, type Rate, type ResultItem, type ResultItemWithFormatted, type SearchTimelineByMetadataParam, type SearchTimelineParamMetaQuery, type SearchTimelineResponse, type SearchTimelineResultItem, type SendOtpOptions, type SendSmsParams, type SendSmsResponse, type SeoType, type SocialResponse, SocialService, type SocialServiceOptions, SsoService, type SsoServiceOptions, type SsoUserProfile, type Subject, type TagtreesType, type TimelineResponse, type TimelineSearchBody, type TokenResponse, type UpdateCustomPostParams, type UserPostInfo, type VerifyResponse, createPodSdk, PodSdk as default, encodeBase64, generatePodSignatureHeader };
|