rettiwt-api 6.3.0-alpha.0 → 7.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/README.md +81 -31
- package/dist/Rettiwt.d.ts +6 -2
- package/dist/Rettiwt.js +7 -3
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +15 -2
- package/dist/collections/Extractors.js +12 -1
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +8 -0
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.js +8 -0
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/Space.d.ts +10 -0
- package/dist/commands/Space.js +38 -0
- package/dist/commands/Space.js.map +1 -0
- package/dist/commands/User.js +139 -0
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Resource.d.ts +8 -1
- package/dist/enums/Resource.js +8 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/models/RettiwtConfig.d.ts +26 -3
- package/dist/models/RettiwtConfig.js +68 -3
- package/dist/models/RettiwtConfig.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +3 -0
- package/dist/models/args/FetchArgs.js +6 -0
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +24 -1
- package/dist/models/args/PostArgs.js +52 -1
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/data/Space.d.ts +70 -0
- package/dist/models/data/Space.js +177 -0
- package/dist/models/data/Space.js.map +1 -0
- package/dist/models/data/UserAbout.d.ts +44 -0
- package/dist/models/data/UserAbout.js +129 -0
- package/dist/models/data/UserAbout.js.map +1 -0
- package/dist/requests/Space.d.ts +15 -0
- package/dist/requests/Space.js +74 -0
- package/dist/requests/Space.js.map +1 -0
- package/dist/requests/Tweet.d.ts +4 -0
- package/dist/requests/Tweet.js +57 -0
- package/dist/requests/Tweet.js.map +1 -1
- package/dist/requests/User.d.ts +21 -0
- package/dist/requests/User.js +64 -0
- package/dist/requests/User.js.map +1 -1
- package/dist/services/internal/AuthService.d.ts +25 -0
- package/dist/services/internal/AuthService.js +121 -0
- package/dist/services/internal/AuthService.js.map +1 -1
- package/dist/services/public/DirectMessageService.js +3 -3
- package/dist/services/public/DirectMessageService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +4 -3
- package/dist/services/public/FetcherService.js +22 -16
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.js +5 -5
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/SpaceService.d.ts +42 -0
- package/dist/services/public/SpaceService.js +60 -0
- package/dist/services/public/SpaceService.js.map +1 -0
- package/dist/services/public/TweetService.js +26 -23
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.d.ts +79 -0
- package/dist/services/public/UserService.js +203 -23
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +33 -3
- package/dist/types/args/FetchArgs.d.ts +35 -1
- package/dist/types/args/PostArgs.d.ts +44 -1
- package/dist/types/data/Space.d.ts +89 -0
- package/dist/types/data/Space.js +3 -0
- package/dist/types/data/Space.js.map +1 -0
- package/dist/types/data/UserAbout.d.ts +68 -0
- package/dist/types/data/UserAbout.js +3 -0
- package/dist/types/data/UserAbout.js.map +1 -0
- package/dist/types/raw/base/Space.d.ts +43 -22
- package/dist/types/raw/space/AudioSpaceById.d.ts +50 -0
- package/dist/types/raw/space/AudioSpaceById.js +4 -0
- package/dist/types/raw/space/AudioSpaceById.js.map +1 -0
- package/dist/types/raw/space/Details.d.ts +2 -309
- package/dist/types/raw/tweet/Post.d.ts +16 -1
- package/dist/types/raw/user/About.d.ts +65 -0
- package/dist/types/raw/user/About.js +4 -0
- package/dist/types/raw/user/About.js.map +1 -0
- package/dist/types/raw/user/ChangePassword.d.ts +8 -0
- package/dist/types/raw/user/ChangePassword.js +3 -0
- package/dist/types/raw/user/ChangePassword.js.map +1 -0
- package/dist/types/raw/user/ProfileUpdate.d.ts +1 -0
- package/dist/types/raw/user/Settings.d.ts +21 -0
- package/dist/types/raw/user/Settings.js +4 -0
- package/dist/types/raw/user/Settings.js.map +1 -0
- package/package.json +6 -4
- package/src/Rettiwt.ts +10 -3
- package/src/cli.ts +3 -1
- package/src/collections/Extractors.ts +22 -3
- package/src/collections/Groups.ts +8 -0
- package/src/collections/Requests.ts +11 -0
- package/src/commands/Space.ts +46 -0
- package/src/commands/User.ts +159 -0
- package/src/enums/Resource.ts +9 -0
- package/src/index.ts +11 -1
- package/src/models/RettiwtConfig.ts +81 -6
- package/src/models/args/FetchArgs.ts +6 -0
- package/src/models/args/PostArgs.ts +58 -1
- package/src/models/data/Space.ts +201 -0
- package/src/models/data/UserAbout.ts +161 -0
- package/src/requests/Space.ts +76 -0
- package/src/requests/Tweet.ts +59 -0
- package/src/requests/User.ts +69 -0
- package/src/services/internal/AuthService.ts +149 -1
- package/src/services/public/DirectMessageService.ts +3 -3
- package/src/services/public/FetcherService.ts +25 -18
- package/src/services/public/ListService.ts +5 -5
- package/src/services/public/SpaceService.ts +65 -0
- package/src/services/public/TweetService.ts +27 -24
- package/src/services/public/UserService.ts +247 -23
- package/src/types/RettiwtConfig.ts +35 -3
- package/src/types/args/FetchArgs.ts +41 -1
- package/src/types/args/PostArgs.ts +50 -1
- package/src/types/data/Space.ts +122 -0
- package/src/types/data/UserAbout.ts +87 -0
- package/src/types/raw/base/Space.ts +42 -22
- package/src/types/raw/space/AudioSpaceById.ts +57 -0
- package/src/types/raw/space/Details.ts +3 -352
- package/src/types/raw/tweet/Post.ts +19 -1
- package/src/types/raw/user/About.ts +77 -0
- package/src/types/raw/user/ChangePassword.ts +8 -0
- package/src/types/raw/user/ProfileUpdate.ts +1 -0
- package/src/types/raw/user/Settings.ts +23 -0
- package/tsconfig.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RettiwtConfig.js","sourceRoot":"","sources":["../../src/models/RettiwtConfig.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"RettiwtConfig.js","sourceRoot":"","sources":["../../src/models/RettiwtConfig.ts"],"names":[],"mappings":";;;AAAA,+BAA0C;AAC1C,iCAA4C;AAG5C,uDAAkD;AAClD,yDAAoD;AACpD,yDAAoD;AAEpD,kEAA+D;AAI/D;;;;GAIG;AACH,MAAM,cAAc,GAAG;IACtB,yDAAyD;IAEzD,SAAS,EAAE,OAAO;IAClB,iBAAiB,EAAE,gBAAgB;IACnC,eAAe,EAAE,UAAU;IAC3B,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,wEAAwE;IACtF,uBAAuB,EAAE,KAAK;IAC9B,2BAA2B,EAAE,IAAI;IAEjC,wDAAwD;CACxD,CAAC;AAkJyB,+CAAqB;AAhJhD;;;;GAIG;AACH,MAAa,aAAa;IACzB,8BAA8B;IACtB,OAAO,CAAU;IACjB,QAAQ,CAA4B;IACpC,UAAU,CAAY;IACtB,WAAW,CAAa;IACxB,MAAM,CAAoC;IAC1C,OAAO,CAAqB;IAEpC,uDAAuD;IACvC,KAAK,CAA6C;IAClD,YAAY,CAAiB;IAC7B,OAAO,CAAW;IAClB,UAAU,CAAS;IACnB,kBAAkB,CAAqD;IACvE,OAAO,CAAU;IAEjC;;OAEG;IACH,YAAmB,MAAuB;QACzC,IAAI,CAAC,OAAO,GAAG,MAAM,EAAE,MAAM,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,yBAAW,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClF,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC,CAAC;QAChC,IAA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K,CAAC,CAAC;YACvC,UAAU,GAAG,IAAI,mCAAe,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;aAAM,CAAC;YACP,SAAS,GAAG,IAAI,YAAS,EAAE,CAAC;YAC5B,UAAU,GAAG,IAAI,aAAU,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO;YACN,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,UAAU;SACtB,CAAC;IACH,CAAC;CACD;AAzID,sCAyIC"}
|
|
@@ -16,11 +16,14 @@ export declare class FetchArgs implements IFetchArgs {
|
|
|
16
16
|
granularity?: RawAnalyticsGranularity;
|
|
17
17
|
id?: string;
|
|
18
18
|
ids?: string[];
|
|
19
|
+
isMetatagsQuery?: boolean;
|
|
19
20
|
maxId?: string;
|
|
20
21
|
metrics?: RawAnalyticsMetric[];
|
|
21
22
|
showVerifiedFollowers?: boolean;
|
|
22
23
|
sortBy?: TweetRepliesSortType;
|
|
23
24
|
toTime?: Date;
|
|
25
|
+
withListeners?: boolean;
|
|
26
|
+
withReplays?: boolean;
|
|
24
27
|
/**
|
|
25
28
|
* @param args - Additional user-defined arguments for fetching the resource.
|
|
26
29
|
*/
|
|
@@ -16,17 +16,21 @@ class FetchArgs {
|
|
|
16
16
|
granularity;
|
|
17
17
|
id;
|
|
18
18
|
ids;
|
|
19
|
+
isMetatagsQuery;
|
|
19
20
|
maxId;
|
|
20
21
|
metrics;
|
|
21
22
|
showVerifiedFollowers;
|
|
22
23
|
sortBy;
|
|
23
24
|
toTime;
|
|
25
|
+
withListeners;
|
|
26
|
+
withReplays;
|
|
24
27
|
/**
|
|
25
28
|
* @param args - Additional user-defined arguments for fetching the resource.
|
|
26
29
|
*/
|
|
27
30
|
constructor(args) {
|
|
28
31
|
this.id = args.id;
|
|
29
32
|
this.ids = args.ids;
|
|
33
|
+
this.isMetatagsQuery = args.isMetatagsQuery;
|
|
30
34
|
this.count = args.count;
|
|
31
35
|
this.cursor = args.cursor;
|
|
32
36
|
this.filter = args.filter ? new TweetFilter(args.filter) : undefined;
|
|
@@ -39,6 +43,8 @@ class FetchArgs {
|
|
|
39
43
|
this.activeConversationId = args.activeConversationId;
|
|
40
44
|
this.conversationId = args.conversationId;
|
|
41
45
|
this.maxId = args.maxId;
|
|
46
|
+
this.withListeners = args.withListeners;
|
|
47
|
+
this.withReplays = args.withReplays;
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
exports.FetchArgs = FetchArgs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchArgs.js","sourceRoot":"","sources":["../../../src/models/args/FetchArgs.ts"],"names":[],"mappings":";;;AAIA;;;;GAIG;AACH,MAAa,SAAS;IACd,oBAAoB,CAAU;IAC9B,cAAc,CAAU;IACxB,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAe;IACrB,QAAQ,CAAQ;IAChB,WAAW,CAA2B;IACtC,EAAE,CAAU;IACZ,GAAG,CAAY;IACf,KAAK,CAAU;IACf,OAAO,CAAwB;IAC/B,qBAAqB,CAAW;IAChC,MAAM,CAAwB;IAC9B,MAAM,CAAQ;
|
|
1
|
+
{"version":3,"file":"FetchArgs.js","sourceRoot":"","sources":["../../../src/models/args/FetchArgs.ts"],"names":[],"mappings":";;;AAIA;;;;GAIG;AACH,MAAa,SAAS;IACd,oBAAoB,CAAU;IAC9B,cAAc,CAAU;IACxB,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAe;IACrB,QAAQ,CAAQ;IAChB,WAAW,CAA2B;IACtC,EAAE,CAAU;IACZ,GAAG,CAAY;IACf,eAAe,CAAW;IAC1B,KAAK,CAAU;IACf,OAAO,CAAwB;IAC/B,qBAAqB,CAAW;IAChC,MAAM,CAAwB;IAC9B,MAAM,CAAQ;IACd,aAAa,CAAW;IACxB,WAAW,CAAW;IAE7B;;OAEG;IACH,YAAmB,IAAgB;QAClC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,G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AC,CAAC,EAAE,CAAC,CACpD,CAAC;IACH,CAAC;CACD;AArHD,kCAqHC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INewTweet, INewTweetMedia, IPostArgs, IUploadArgs } from '../../types/args/PostArgs';
|
|
1
|
+
import { IChangePasswordArgs, INewTweet, INewTweetMedia, IPostArgs, IUploadArgs } from '../../types/args/PostArgs';
|
|
2
2
|
import { ProfileUpdateOptions } from './ProfileArgs';
|
|
3
3
|
/**
|
|
4
4
|
* Options specifying the data that is to be posted.
|
|
@@ -6,17 +6,30 @@ import { ProfileUpdateOptions } from './ProfileArgs';
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class PostArgs implements IPostArgs {
|
|
9
|
+
changePassword?: ChangePasswordArgs;
|
|
9
10
|
conversationId?: string;
|
|
10
11
|
id?: string;
|
|
12
|
+
profileBanner?: string;
|
|
13
|
+
profileImage?: string;
|
|
11
14
|
profileOptions?: ProfileUpdateOptions;
|
|
12
15
|
tweet?: NewTweet;
|
|
13
16
|
upload?: UploadArgs;
|
|
14
17
|
userId?: string;
|
|
18
|
+
username?: string;
|
|
15
19
|
/**
|
|
16
20
|
* @param resource - The resource to be posted.
|
|
17
21
|
* @param args - Additional user-defined arguments for posting the resource.
|
|
18
22
|
*/
|
|
19
23
|
constructor(args: IPostArgs);
|
|
24
|
+
/**
|
|
25
|
+
* Validates if a data value is a valid string.
|
|
26
|
+
*
|
|
27
|
+
* @param value - The data to validate.
|
|
28
|
+
* @param fieldName - The field name whose value is to be validated.
|
|
29
|
+
*
|
|
30
|
+
* @returns The validated, parsed string. If data was `undefined`, returns `undefined`.
|
|
31
|
+
*/
|
|
32
|
+
private static _validateNonEmptyString;
|
|
20
33
|
}
|
|
21
34
|
/**
|
|
22
35
|
* Configuration for the new tweet to be posted.
|
|
@@ -62,3 +75,13 @@ export declare class UploadArgs implements IUploadArgs {
|
|
|
62
75
|
*/
|
|
63
76
|
constructor(args: IUploadArgs);
|
|
64
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* The args for changing authenticated user's password.
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export declare class ChangePasswordArgs implements IChangePasswordArgs {
|
|
84
|
+
currentPassword: string;
|
|
85
|
+
newPassword: string;
|
|
86
|
+
constructor(args: IChangePasswordArgs);
|
|
87
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UploadArgs = exports.NewTweetMedia = exports.NewTweet = exports.PostArgs = void 0;
|
|
3
|
+
exports.ChangePasswordArgs = exports.UploadArgs = exports.NewTweetMedia = exports.NewTweet = exports.PostArgs = void 0;
|
|
4
4
|
const ProfileArgs_1 = require("./ProfileArgs");
|
|
5
5
|
/**
|
|
6
6
|
* Options specifying the data that is to be posted.
|
|
@@ -8,12 +8,16 @@ const ProfileArgs_1 = require("./ProfileArgs");
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
class PostArgs {
|
|
11
|
+
changePassword;
|
|
11
12
|
conversationId;
|
|
12
13
|
id;
|
|
14
|
+
profileBanner;
|
|
15
|
+
profileImage;
|
|
13
16
|
profileOptions;
|
|
14
17
|
tweet;
|
|
15
18
|
upload;
|
|
16
19
|
userId;
|
|
20
|
+
username;
|
|
17
21
|
/**
|
|
18
22
|
* @param resource - The resource to be posted.
|
|
19
23
|
* @param args - Additional user-defined arguments for posting the resource.
|
|
@@ -23,8 +27,32 @@ class PostArgs {
|
|
|
23
27
|
this.tweet = args.tweet ? new NewTweet(args.tweet) : undefined;
|
|
24
28
|
this.upload = args.upload ? new UploadArgs(args.upload) : undefined;
|
|
25
29
|
this.userId = args.userId;
|
|
30
|
+
this.username = PostArgs._validateNonEmptyString(args.username, 'Username');
|
|
26
31
|
this.conversationId = args.conversationId;
|
|
27
32
|
this.profileOptions = args.profileOptions ? new ProfileArgs_1.ProfileUpdateOptions(args.profileOptions) : undefined;
|
|
33
|
+
this.profileImage = PostArgs._validateNonEmptyString(args.profileImage, 'Profile image');
|
|
34
|
+
this.profileBanner = PostArgs._validateNonEmptyString(args.profileBanner, 'Profile banner');
|
|
35
|
+
this.changePassword = args.changePassword ? new ChangePasswordArgs(args.changePassword) : undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validates if a data value is a valid string.
|
|
39
|
+
*
|
|
40
|
+
* @param value - The data to validate.
|
|
41
|
+
* @param fieldName - The field name whose value is to be validated.
|
|
42
|
+
*
|
|
43
|
+
* @returns The validated, parsed string. If data was `undefined`, returns `undefined`.
|
|
44
|
+
*/
|
|
45
|
+
static _validateNonEmptyString(value, fieldName) {
|
|
46
|
+
if (value === undefined) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value !== 'string') {
|
|
50
|
+
throw new Error(`${fieldName} must be a string`);
|
|
51
|
+
}
|
|
52
|
+
if (value.trim().length === 0) {
|
|
53
|
+
throw new Error(`${fieldName} cannot be empty`);
|
|
54
|
+
}
|
|
55
|
+
return value;
|
|
28
56
|
}
|
|
29
57
|
}
|
|
30
58
|
exports.PostArgs = PostArgs;
|
|
@@ -88,4 +116,27 @@ class UploadArgs {
|
|
|
88
116
|
}
|
|
89
117
|
}
|
|
90
118
|
exports.UploadArgs = UploadArgs;
|
|
119
|
+
/**
|
|
120
|
+
* The args for changing authenticated user's password.
|
|
121
|
+
*
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
class ChangePasswordArgs {
|
|
125
|
+
currentPassword;
|
|
126
|
+
newPassword;
|
|
127
|
+
constructor(args) {
|
|
128
|
+
if (!args.currentPassword || args.currentPassword.trim().length === 0) {
|
|
129
|
+
throw new Error('Current password cannot be empty');
|
|
130
|
+
}
|
|
131
|
+
if (!args.newPassword || args.newPassword.trim().length === 0) {
|
|
132
|
+
throw new Error('New password cannot be empty');
|
|
133
|
+
}
|
|
134
|
+
if (args.newPassword.length < 8) {
|
|
135
|
+
throw new Error('New password must be at least 8 characters long');
|
|
136
|
+
}
|
|
137
|
+
this.currentPassword = args.currentPassword;
|
|
138
|
+
this.newPassword = args.newPassword;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.ChangePasswordArgs = ChangePasswordArgs;
|
|
91
142
|
//# sourceMappingURL=PostArgs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostArgs.js","sourceRoot":"","sources":["../../../src/models/args/PostArgs.ts"],"names":[],"mappings":";;;AAEA,+CAAqD;AAErD;;;;GAIG;AACH,MAAa,QAAQ;IACb,cAAc,CAAU;IACxB,EAAE,CAAU;IACZ,cAAc,CAAwB;IACtC,KAAK,CAAY;IACjB,MAAM,CAAc;IACpB,MAAM,CAAU;
|
|
1
|
+
{"version":3,"file":"PostArgs.js","sourceRoot":"","sources":["../../../src/models/args/PostArgs.ts"],"names":[],"mappings":";;;AAEA,+CAAqD;AAErD;;;;GAIG;AACH,MAAa,QAAQ;IACb,cAAc,CAAsB;IACpC,cAAc,CAAU;IACxB,EAAE,CAAU;IACZ,aAAa,CAAU;IACvB,YAAY,CAAU;IACtB,cAAc,CAAwB;IACtC,KAAK,CAAY;IACjB,MAAM,CAAc;IACpB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAEzB;;;OAGG;IACH,YAAmB,IAAe;QACjC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpE,IAAI,CAAC,MAAM,GAAG,IAAI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C,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/D,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,CAAC;CACD;AAlBD,gDAkBC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ISpace, ISpaceParticipants } from '../../types/data/Space';
|
|
2
|
+
import { IAudioSpace, IAudioSpaceByIdResponse } from '../../types/raw/space/AudioSpaceById';
|
|
3
|
+
/**
|
|
4
|
+
* The details of a single Space.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class Space implements ISpace {
|
|
9
|
+
/** The raw space details. */
|
|
10
|
+
private readonly _raw;
|
|
11
|
+
conversationControls?: number;
|
|
12
|
+
createdAt?: string;
|
|
13
|
+
creatorId?: string;
|
|
14
|
+
disallowJoin?: boolean;
|
|
15
|
+
endedAt?: string;
|
|
16
|
+
id: string;
|
|
17
|
+
isEmployeeOnly?: boolean;
|
|
18
|
+
isLocked?: boolean;
|
|
19
|
+
isMuted?: boolean;
|
|
20
|
+
isSpaceAvailableForClipping?: boolean;
|
|
21
|
+
isSpaceAvailableForReplay?: boolean;
|
|
22
|
+
isSubscribed?: boolean;
|
|
23
|
+
mediaKey?: string;
|
|
24
|
+
noIncognito?: boolean;
|
|
25
|
+
participantCount?: number;
|
|
26
|
+
participants?: ISpaceParticipants;
|
|
27
|
+
scheduledStart?: string;
|
|
28
|
+
startedAt?: string;
|
|
29
|
+
state?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
totalLiveListeners?: number;
|
|
32
|
+
totalReplayWatched?: number;
|
|
33
|
+
updatedAt?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @param space - The raw space details.
|
|
36
|
+
*/
|
|
37
|
+
constructor(space: IAudioSpace);
|
|
38
|
+
/** The raw space details. */
|
|
39
|
+
get raw(): IAudioSpace;
|
|
40
|
+
/**
|
|
41
|
+
* Maps a raw participant to a deserialized participant.
|
|
42
|
+
*
|
|
43
|
+
* @param participant - The raw participant data.
|
|
44
|
+
*/
|
|
45
|
+
private static _mapParticipant;
|
|
46
|
+
/**
|
|
47
|
+
* Maps raw participants to deserialized participants.
|
|
48
|
+
*
|
|
49
|
+
* @param participants - The raw participants data.
|
|
50
|
+
*/
|
|
51
|
+
private static _mapParticipants;
|
|
52
|
+
/**
|
|
53
|
+
* Convert timestamp to ISO string.
|
|
54
|
+
*
|
|
55
|
+
* @param value - The timestamp value.
|
|
56
|
+
*/
|
|
57
|
+
private static _timestampToIso;
|
|
58
|
+
/**
|
|
59
|
+
* Extracts and deserializes a single target space from the given raw response data.
|
|
60
|
+
*
|
|
61
|
+
* @param response - The raw response data.
|
|
62
|
+
*
|
|
63
|
+
* @returns The target deserialized space.
|
|
64
|
+
*/
|
|
65
|
+
static single(response: IAudioSpaceByIdResponse): Space | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* @returns A serializable JSON representation of `this` object.
|
|
68
|
+
*/
|
|
69
|
+
toJSON(): ISpace;
|
|
70
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Space = void 0;
|
|
4
|
+
const Logging_1 = require("../../enums/Logging");
|
|
5
|
+
const LogService_1 = require("../../services/internal/LogService");
|
|
6
|
+
/**
|
|
7
|
+
* The details of a single Space.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class Space {
|
|
12
|
+
/** The raw space details. */
|
|
13
|
+
_raw;
|
|
14
|
+
conversationControls;
|
|
15
|
+
createdAt;
|
|
16
|
+
creatorId;
|
|
17
|
+
disallowJoin;
|
|
18
|
+
endedAt;
|
|
19
|
+
id;
|
|
20
|
+
isEmployeeOnly;
|
|
21
|
+
isLocked;
|
|
22
|
+
isMuted;
|
|
23
|
+
isSpaceAvailableForClipping;
|
|
24
|
+
isSpaceAvailableForReplay;
|
|
25
|
+
isSubscribed;
|
|
26
|
+
mediaKey;
|
|
27
|
+
noIncognito;
|
|
28
|
+
participantCount;
|
|
29
|
+
participants;
|
|
30
|
+
scheduledStart;
|
|
31
|
+
startedAt;
|
|
32
|
+
state;
|
|
33
|
+
title;
|
|
34
|
+
totalLiveListeners;
|
|
35
|
+
totalReplayWatched;
|
|
36
|
+
updatedAt;
|
|
37
|
+
/**
|
|
38
|
+
* @param space - The raw space details.
|
|
39
|
+
*/
|
|
40
|
+
constructor(space) {
|
|
41
|
+
this._raw = { ...space };
|
|
42
|
+
const metadata = space.metadata;
|
|
43
|
+
this.id = metadata?.rest_id ?? '';
|
|
44
|
+
this.state = metadata?.state;
|
|
45
|
+
this.title = metadata?.title;
|
|
46
|
+
this.mediaKey = metadata?.media_key;
|
|
47
|
+
this.createdAt = Space._timestampToIso(metadata?.created_at);
|
|
48
|
+
this.scheduledStart = Space._timestampToIso(metadata?.scheduled_start);
|
|
49
|
+
this.startedAt = Space._timestampToIso(metadata?.started_at);
|
|
50
|
+
this.endedAt = Space._timestampToIso(metadata?.ended_at);
|
|
51
|
+
this.updatedAt = Space._timestampToIso(metadata?.updated_at);
|
|
52
|
+
this.creatorId = metadata?.creator_results?.result?.rest_id ?? metadata?.creator_id;
|
|
53
|
+
this.conversationControls = metadata?.conversation_controls;
|
|
54
|
+
this.disallowJoin = metadata?.disallow_join;
|
|
55
|
+
this.isEmployeeOnly = metadata?.is_employee_only;
|
|
56
|
+
this.isLocked = metadata?.is_locked;
|
|
57
|
+
this.isMuted = metadata?.is_muted;
|
|
58
|
+
this.isSpaceAvailableForClipping = metadata?.is_space_available_for_clipping;
|
|
59
|
+
this.isSpaceAvailableForReplay = metadata?.is_space_available_for_replay;
|
|
60
|
+
this.noIncognito = metadata?.no_incognito;
|
|
61
|
+
this.totalLiveListeners = metadata?.total_live_listeners;
|
|
62
|
+
this.totalReplayWatched = metadata?.total_replay_watched;
|
|
63
|
+
this.participantCount = space.participants?.total ?? metadata?.participant_count;
|
|
64
|
+
this.isSubscribed = space.is_subscribed;
|
|
65
|
+
this.participants = Space._mapParticipants(space.participants);
|
|
66
|
+
}
|
|
67
|
+
/** The raw space details. */
|
|
68
|
+
get raw() {
|
|
69
|
+
return { ...this._raw };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Maps a raw participant to a deserialized participant.
|
|
73
|
+
*
|
|
74
|
+
* @param participant - The raw participant data.
|
|
75
|
+
*/
|
|
76
|
+
static _mapParticipant(participant) {
|
|
77
|
+
const userId = participant.user_results?.rest_id ?? participant.user_results?.result?.rest_id;
|
|
78
|
+
return {
|
|
79
|
+
id: userId,
|
|
80
|
+
screenName: participant.twitter_screen_name,
|
|
81
|
+
displayName: participant.display_name,
|
|
82
|
+
avatarUrl: participant.avatar_url,
|
|
83
|
+
isVerified: participant.is_verified,
|
|
84
|
+
isMutedByAdmin: participant.is_muted_by_admin,
|
|
85
|
+
isMutedByGuest: participant.is_muted_by_guest,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Maps raw participants to deserialized participants.
|
|
90
|
+
*
|
|
91
|
+
* @param participants - The raw participants data.
|
|
92
|
+
*/
|
|
93
|
+
static _mapParticipants(participants) {
|
|
94
|
+
if (!participants) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
total: participants.total,
|
|
99
|
+
admins: (participants.admins ?? []).map((participant) => Space._mapParticipant(participant)),
|
|
100
|
+
speakers: (participants.speakers ?? []).map((participant) => Space._mapParticipant(participant)),
|
|
101
|
+
listeners: (participants.listeners ?? []).map((participant) => Space._mapParticipant(participant)),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Convert timestamp to ISO string.
|
|
106
|
+
*
|
|
107
|
+
* @param value - The timestamp value.
|
|
108
|
+
*/
|
|
109
|
+
static _timestampToIso(value) {
|
|
110
|
+
if (value == undefined) {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
const numeric = typeof value === 'string' ? Number(value) : value;
|
|
114
|
+
if (!Number.isNaN(numeric)) {
|
|
115
|
+
return new Date(numeric).toISOString();
|
|
116
|
+
}
|
|
117
|
+
const parsed = new Date(value);
|
|
118
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
119
|
+
return parsed.toISOString();
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Extracts and deserializes a single target space from the given raw response data.
|
|
125
|
+
*
|
|
126
|
+
* @param response - The raw response data.
|
|
127
|
+
*
|
|
128
|
+
* @returns The target deserialized space.
|
|
129
|
+
*/
|
|
130
|
+
static single(response) {
|
|
131
|
+
const audioSpace = response.data?.audioSpace;
|
|
132
|
+
const spaceId = audioSpace?.metadata?.rest_id;
|
|
133
|
+
if (audioSpace && spaceId) {
|
|
134
|
+
// Logging
|
|
135
|
+
LogService_1.LogService.log(Logging_1.LogActions.DESERIALIZE, { id: spaceId });
|
|
136
|
+
return new Space(audioSpace);
|
|
137
|
+
}
|
|
138
|
+
// Logging
|
|
139
|
+
LogService_1.LogService.log(Logging_1.LogActions.WARNING, {
|
|
140
|
+
action: Logging_1.LogActions.DESERIALIZE,
|
|
141
|
+
message: 'Space not found, skipping',
|
|
142
|
+
});
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @returns A serializable JSON representation of `this` object.
|
|
147
|
+
*/
|
|
148
|
+
toJSON() {
|
|
149
|
+
return {
|
|
150
|
+
id: this.id,
|
|
151
|
+
state: this.state,
|
|
152
|
+
title: this.title,
|
|
153
|
+
mediaKey: this.mediaKey,
|
|
154
|
+
createdAt: this.createdAt,
|
|
155
|
+
scheduledStart: this.scheduledStart,
|
|
156
|
+
startedAt: this.startedAt,
|
|
157
|
+
endedAt: this.endedAt,
|
|
158
|
+
updatedAt: this.updatedAt,
|
|
159
|
+
creatorId: this.creatorId,
|
|
160
|
+
conversationControls: this.conversationControls,
|
|
161
|
+
disallowJoin: this.disallowJoin,
|
|
162
|
+
isEmployeeOnly: this.isEmployeeOnly,
|
|
163
|
+
isLocked: this.isLocked,
|
|
164
|
+
isMuted: this.isMuted,
|
|
165
|
+
isSpaceAvailableForClipping: this.isSpaceAvailableForClipping,
|
|
166
|
+
isSpaceAvailableForReplay: this.isSpaceAvailableForReplay,
|
|
167
|
+
noIncognito: this.noIncognito,
|
|
168
|
+
totalLiveListeners: this.totalLiveListeners,
|
|
169
|
+
totalReplayWatched: this.totalReplayWatched,
|
|
170
|
+
participantCount: this.participantCount,
|
|
171
|
+
isSubscribed: this.isSubscribed,
|
|
172
|
+
participants: this.participants,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.Space = Space;
|
|
177
|
+
//# sourceMappingURL=Space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Space.js","sourceRoot":"","sources":["../../../src/models/data/Space.ts"],"names":[],"mappings":";;;AAAA,iDAAiD;AACjD,mEAAgE;AAShE;;;;GAIG;AACH,MAAa,KAAK;IACjB,6BAA6B;IACZ,IAAI,CAAc;IAE5B,oBAAoB,CAAU;IAC9B,SAAS,CAAU;IACnB,SAAS,CAAU;IACnB,YAAY,CAAW;IACvB,OAAO,CAAU;IACjB,EAAE,CAAS;IACX,cAAc,CAAW;IACzB,QAAQ,CAAW;IACnB,OAAO,CAAW;IAClB,2BAA2B,CAAW;IACtC,yBAAyB,CAAW;IACpC,YA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OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;YAC7D,yBAAyB,EAAE,IAAI,CAAC,yBAAyB;YACzD,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC;IACH,CAAC;CACD;AAzLD,sBAyLC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IUserAbout, IUserAboutProfile, IUserAboutVerificationInfo } from '../../types/data/UserAbout';
|
|
2
|
+
import { IUserAboutResult } from '../../types/raw/user/About';
|
|
3
|
+
/**
|
|
4
|
+
* The about profile details of a single user.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class UserAbout implements IUserAbout {
|
|
9
|
+
/** The raw about profile details. */
|
|
10
|
+
private readonly _raw;
|
|
11
|
+
aboutProfile?: IUserAboutProfile;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
fullName: string;
|
|
14
|
+
id: string;
|
|
15
|
+
isProtected?: boolean;
|
|
16
|
+
isVerified: boolean;
|
|
17
|
+
profileImage: string;
|
|
18
|
+
profileImageShape?: string;
|
|
19
|
+
userName: string;
|
|
20
|
+
verificationInfo?: IUserAboutVerificationInfo;
|
|
21
|
+
/**
|
|
22
|
+
* @param user - The raw about profile details.
|
|
23
|
+
*/
|
|
24
|
+
constructor(user: IUserAboutResult);
|
|
25
|
+
/** The raw about profile details. */
|
|
26
|
+
get raw(): IUserAboutResult;
|
|
27
|
+
private static _buildAboutProfile;
|
|
28
|
+
private static _buildUsernameChanges;
|
|
29
|
+
private static _buildVerificationInfo;
|
|
30
|
+
private static _toIsoFromMsec;
|
|
31
|
+
private static _toNumber;
|
|
32
|
+
/**
|
|
33
|
+
* Extracts and deserializes a single target user about profile from the given raw response data.
|
|
34
|
+
*
|
|
35
|
+
* @param response - The raw response data.
|
|
36
|
+
*
|
|
37
|
+
* @returns The target deserialized user about profile.
|
|
38
|
+
*/
|
|
39
|
+
static single(response: NonNullable<unknown>): UserAbout | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* @returns A serializable JSON representation of `this` object.
|
|
42
|
+
*/
|
|
43
|
+
toJSON(): IUserAbout;
|
|
44
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAbout = void 0;
|
|
4
|
+
const Logging_1 = require("../../enums/Logging");
|
|
5
|
+
const LogService_1 = require("../../services/internal/LogService");
|
|
6
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
7
|
+
/**
|
|
8
|
+
* The about profile details of a single user.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class UserAbout {
|
|
13
|
+
/** The raw about profile details. */
|
|
14
|
+
_raw;
|
|
15
|
+
aboutProfile;
|
|
16
|
+
createdAt;
|
|
17
|
+
fullName;
|
|
18
|
+
id;
|
|
19
|
+
isProtected;
|
|
20
|
+
isVerified;
|
|
21
|
+
profileImage;
|
|
22
|
+
profileImageShape;
|
|
23
|
+
userName;
|
|
24
|
+
verificationInfo;
|
|
25
|
+
/**
|
|
26
|
+
* @param user - The raw about profile details.
|
|
27
|
+
*/
|
|
28
|
+
constructor(user) {
|
|
29
|
+
this._raw = { ...user };
|
|
30
|
+
this.id = user.rest_id ?? user.id ?? '';
|
|
31
|
+
this.userName = user.core?.screen_name ?? '';
|
|
32
|
+
this.fullName = user.core?.name ?? '';
|
|
33
|
+
this.createdAt = new Date(user.core?.created_at ?? 0).toISOString();
|
|
34
|
+
this.profileImage = user.avatar?.image_url ?? '';
|
|
35
|
+
this.profileImageShape = user.profile_image_shape;
|
|
36
|
+
this.isVerified = user.is_blue_verified ?? false;
|
|
37
|
+
this.isProtected = user.privacy?.protected;
|
|
38
|
+
this.aboutProfile = UserAbout._buildAboutProfile(user);
|
|
39
|
+
this.verificationInfo = UserAbout._buildVerificationInfo(user);
|
|
40
|
+
}
|
|
41
|
+
/** The raw about profile details. */
|
|
42
|
+
get raw() {
|
|
43
|
+
return { ...this._raw };
|
|
44
|
+
}
|
|
45
|
+
static _buildAboutProfile(user) {
|
|
46
|
+
const profile = user.about_profile;
|
|
47
|
+
if (!profile) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const usernameChanges = UserAbout._buildUsernameChanges(profile.username_changes);
|
|
51
|
+
return {
|
|
52
|
+
createdCountryAccurate: profile.created_country_accurate,
|
|
53
|
+
accountBasedIn: profile.account_based_in,
|
|
54
|
+
locationAccurate: profile.location_accurate,
|
|
55
|
+
learnMoreUrl: profile.learn_more_url,
|
|
56
|
+
source: profile.source,
|
|
57
|
+
usernameChanges: usernameChanges,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static _buildUsernameChanges(changes) {
|
|
61
|
+
if (!changes) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
count: UserAbout._toNumber(changes.count),
|
|
66
|
+
lastChangedAt: UserAbout._toIsoFromMsec(changes.last_changed_at_msec),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static _buildVerificationInfo(user) {
|
|
70
|
+
const info = user.verification_info;
|
|
71
|
+
if (!info) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
isIdentityVerified: info.is_identity_verified,
|
|
76
|
+
verifiedSince: UserAbout._toIsoFromMsec(info.reason?.verified_since_msec),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
static _toIsoFromMsec(value) {
|
|
80
|
+
const parsed = UserAbout._toNumber(value);
|
|
81
|
+
return parsed === undefined ? undefined : new Date(parsed).toISOString();
|
|
82
|
+
}
|
|
83
|
+
static _toNumber(value) {
|
|
84
|
+
if (value === undefined || value === null) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const parsed = typeof value === 'number' ? value : Number(value);
|
|
88
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Extracts and deserializes a single target user about profile from the given raw response data.
|
|
92
|
+
*
|
|
93
|
+
* @param response - The raw response data.
|
|
94
|
+
*
|
|
95
|
+
* @returns The target deserialized user about profile.
|
|
96
|
+
*/
|
|
97
|
+
static single(response) {
|
|
98
|
+
const result = response?.data?.user_result_by_screen_name?.result;
|
|
99
|
+
if (!result || result.__typename !== 'User') {
|
|
100
|
+
LogService_1.LogService.log(Logging_1.LogActions.WARNING, {
|
|
101
|
+
action: Logging_1.LogActions.DESERIALIZE,
|
|
102
|
+
message: `User not found, skipping`,
|
|
103
|
+
});
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
// Logging
|
|
107
|
+
LogService_1.LogService.log(Logging_1.LogActions.DESERIALIZE, { id: result.rest_id ?? result.id });
|
|
108
|
+
return new UserAbout(result);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @returns A serializable JSON representation of `this` object.
|
|
112
|
+
*/
|
|
113
|
+
toJSON() {
|
|
114
|
+
return {
|
|
115
|
+
id: this.id,
|
|
116
|
+
userName: this.userName,
|
|
117
|
+
fullName: this.fullName,
|
|
118
|
+
createdAt: this.createdAt,
|
|
119
|
+
profileImage: this.profileImage,
|
|
120
|
+
profileImageShape: this.profileImageShape,
|
|
121
|
+
isVerified: this.isVerified,
|
|
122
|
+
isProtected: this.isProtected,
|
|
123
|
+
aboutProfile: this.aboutProfile,
|
|
124
|
+
verificationInfo: this.verificationInfo,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.UserAbout = UserAbout;
|
|
129
|
+
//# sourceMappingURL=UserAbout.js.map
|