rettiwt-api 5.0.0-alpha.0 → 5.0.0-alpha.1

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.
Files changed (179) hide show
  1. package/.eslintrc.js +2 -3
  2. package/.github/workflows/documentation.yml +1 -1
  3. package/.github/workflows/publish-alpha.yml +1 -1
  4. package/.github/workflows/publish.yml +1 -1
  5. package/.prettierignore +1 -1
  6. package/.tool-versions +1 -1
  7. package/README.md +100 -100
  8. package/dist/Rettiwt.d.ts +1 -1
  9. package/dist/Rettiwt.js +15 -8
  10. package/dist/Rettiwt.js.map +1 -1
  11. package/dist/cli.js +8 -11
  12. package/dist/cli.js.map +1 -1
  13. package/dist/collections/Extractors.d.ts +1 -0
  14. package/dist/collections/Extractors.js +38 -69
  15. package/dist/collections/Extractors.js.map +1 -1
  16. package/dist/collections/Groups.js +2 -1
  17. package/dist/collections/Groups.js.map +1 -1
  18. package/dist/collections/Requests.d.ts +3 -3
  19. package/dist/collections/Requests.js +36 -35
  20. package/dist/collections/Requests.js.map +1 -1
  21. package/dist/commands/List.js +21 -78
  22. package/dist/commands/List.js.map +1 -1
  23. package/dist/commands/Tweet.js +185 -370
  24. package/dist/commands/Tweet.js.map +1 -1
  25. package/dist/commands/User.js +129 -306
  26. package/dist/commands/User.js.map +1 -1
  27. package/dist/enums/Authentication.d.ts +18 -0
  28. package/dist/enums/Authentication.js +24 -0
  29. package/dist/enums/Authentication.js.map +1 -0
  30. package/dist/enums/Data.d.ts +12 -0
  31. package/dist/enums/Data.js +14 -1
  32. package/dist/enums/Data.js.map +1 -1
  33. package/dist/enums/Resource.d.ts +1 -0
  34. package/dist/enums/Resource.js +1 -0
  35. package/dist/enums/Resource.js.map +1 -1
  36. package/dist/helper/CliUtils.js +1 -2
  37. package/dist/helper/CliUtils.js.map +1 -1
  38. package/dist/helper/JsonUtils.js +6 -11
  39. package/dist/helper/JsonUtils.js.map +1 -1
  40. package/dist/index.d.ts +1 -2
  41. package/dist/index.js +1 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/models/args/FetchArgs.d.ts +4 -133
  44. package/dist/models/args/FetchArgs.js +12 -416
  45. package/dist/models/args/FetchArgs.js.map +1 -1
  46. package/dist/models/args/PostArgs.d.ts +16 -101
  47. package/dist/models/args/PostArgs.js +26 -258
  48. package/dist/models/args/PostArgs.js.map +1 -1
  49. package/dist/models/auth/AccountCredential.d.ts +13 -0
  50. package/dist/models/auth/AccountCredential.js +21 -0
  51. package/dist/models/auth/AccountCredential.js.map +1 -0
  52. package/dist/models/auth/AuthCookie.d.ts +19 -0
  53. package/dist/models/auth/AuthCookie.js +53 -0
  54. package/dist/models/auth/AuthCookie.js.map +1 -0
  55. package/dist/models/auth/AuthCredential.d.ts +28 -0
  56. package/dist/models/auth/AuthCredential.js +76 -0
  57. package/dist/models/auth/AuthCredential.js.map +1 -0
  58. package/dist/models/data/CursoredData.d.ts +3 -4
  59. package/dist/models/data/CursoredData.js +19 -19
  60. package/dist/models/data/CursoredData.js.map +1 -1
  61. package/dist/models/data/List.d.ts +2 -8
  62. package/dist/models/data/List.js +10 -4
  63. package/dist/models/data/List.js.map +1 -1
  64. package/dist/models/data/Notification.d.ts +5 -21
  65. package/dist/models/data/Notification.js +24 -33
  66. package/dist/models/data/Notification.js.map +1 -1
  67. package/dist/models/data/Tweet.d.ts +6 -23
  68. package/dist/models/data/Tweet.js +93 -97
  69. package/dist/models/data/Tweet.js.map +1 -1
  70. package/dist/models/data/User.d.ts +2 -15
  71. package/dist/models/data/User.js +33 -23
  72. package/dist/models/data/User.js.map +1 -1
  73. package/dist/models/errors/ApiError.js +8 -24
  74. package/dist/models/errors/ApiError.js.map +1 -1
  75. package/dist/models/errors/HttpError.js +8 -24
  76. package/dist/models/errors/HttpError.js.map +1 -1
  77. package/dist/models/errors/RettiwtError.js +5 -23
  78. package/dist/models/errors/RettiwtError.js.map +1 -1
  79. package/dist/models/errors/TimeoutError.js +5 -22
  80. package/dist/models/errors/TimeoutError.js.map +1 -1
  81. package/dist/services/{public → internal}/AuthService.d.ts +5 -34
  82. package/dist/services/internal/AuthService.js +109 -0
  83. package/dist/services/internal/AuthService.js.map +1 -0
  84. package/dist/services/internal/ErrorService.js +38 -40
  85. package/dist/services/internal/ErrorService.js.map +1 -1
  86. package/dist/services/internal/LogService.d.ts +0 -6
  87. package/dist/services/internal/LogService.js +12 -32
  88. package/dist/services/internal/LogService.js.map +1 -1
  89. package/dist/services/public/FetcherService.d.ts +5 -3
  90. package/dist/services/public/FetcherService.js +96 -141
  91. package/dist/services/public/FetcherService.js.map +1 -1
  92. package/dist/services/public/ListService.js +31 -100
  93. package/dist/services/public/ListService.js.map +1 -1
  94. package/dist/services/public/TweetService.d.ts +29 -4
  95. package/dist/services/public/TweetService.js +208 -386
  96. package/dist/services/public/TweetService.js.map +1 -1
  97. package/dist/services/public/UserService.js +186 -385
  98. package/dist/services/public/UserService.js.map +1 -1
  99. package/dist/types/RettiwtConfig.d.ts +8 -0
  100. package/dist/types/args/FetchArgs.d.ts +59 -0
  101. package/dist/types/args/FetchArgs.js +3 -0
  102. package/dist/types/args/FetchArgs.js.map +1 -0
  103. package/dist/types/args/PostArgs.d.ts +56 -0
  104. package/dist/types/args/PostArgs.js +3 -0
  105. package/dist/types/args/PostArgs.js.map +1 -0
  106. package/dist/types/auth/AccountCredential.d.ts +11 -0
  107. package/dist/types/auth/AccountCredential.js +3 -0
  108. package/dist/types/auth/AccountCredential.js.map +1 -0
  109. package/dist/types/auth/AuthCookie.d.ts +13 -0
  110. package/dist/types/auth/AuthCookie.js +3 -0
  111. package/dist/types/auth/AuthCookie.js.map +1 -0
  112. package/dist/types/auth/AuthCredential.d.ts +21 -0
  113. package/dist/types/auth/AuthCredential.js +3 -0
  114. package/dist/types/auth/AuthCredential.js.map +1 -0
  115. package/dist/types/data/CursoredData.d.ts +25 -0
  116. package/dist/types/data/CursoredData.js +3 -0
  117. package/dist/types/data/CursoredData.js.map +1 -0
  118. package/dist/types/data/List.d.ts +21 -0
  119. package/dist/types/data/List.js +3 -0
  120. package/dist/types/data/List.js.map +1 -0
  121. package/dist/types/data/Notification.d.ts +20 -0
  122. package/dist/types/data/Notification.js +3 -0
  123. package/dist/types/data/Notification.js.map +1 -0
  124. package/dist/types/data/Tweet.d.ts +71 -0
  125. package/dist/types/data/Tweet.js +3 -0
  126. package/dist/types/data/Tweet.js.map +1 -0
  127. package/dist/types/data/User.d.ts +35 -0
  128. package/dist/types/data/User.js +3 -0
  129. package/dist/types/data/User.js.map +1 -0
  130. package/eslint.config.mjs +17 -0
  131. package/package.json +22 -19
  132. package/src/Rettiwt.ts +1 -1
  133. package/src/cli.ts +0 -2
  134. package/src/collections/Extractors.ts +2 -0
  135. package/src/collections/Groups.ts +1 -0
  136. package/src/collections/Requests.ts +37 -36
  137. package/src/enums/Authentication.ts +19 -0
  138. package/src/enums/Data.ts +13 -0
  139. package/src/enums/Resource.ts +1 -0
  140. package/src/helper/JsonUtils.ts +1 -1
  141. package/src/index.ts +1 -2
  142. package/src/models/args/FetchArgs.ts +4 -470
  143. package/src/models/args/PostArgs.ts +20 -285
  144. package/src/models/auth/AccountCredential.ts +19 -0
  145. package/src/models/auth/AuthCookie.ts +56 -0
  146. package/src/models/auth/AuthCredential.ts +83 -0
  147. package/src/models/data/CursoredData.ts +12 -9
  148. package/src/models/data/List.ts +3 -14
  149. package/src/models/data/Notification.ts +6 -28
  150. package/src/models/data/Tweet.ts +28 -70
  151. package/src/models/data/User.ts +5 -31
  152. package/src/services/{public → internal}/AuthService.ts +28 -55
  153. package/src/services/internal/LogService.ts +4 -19
  154. package/src/services/public/FetcherService.ts +18 -8
  155. package/src/services/public/TweetService.ts +44 -4
  156. package/src/services/public/UserService.ts +2 -2
  157. package/src/types/RettiwtConfig.ts +7 -0
  158. package/src/types/args/FetchArgs.ts +64 -0
  159. package/src/types/args/PostArgs.ts +62 -0
  160. package/src/types/auth/AccountCredential.ts +13 -0
  161. package/src/types/auth/AuthCookie.ts +20 -0
  162. package/src/types/auth/AuthCredential.ts +26 -0
  163. package/src/types/data/CursoredData.ts +28 -0
  164. package/src/types/data/List.ts +27 -0
  165. package/src/types/data/Notification.ts +26 -0
  166. package/src/types/data/Tweet.ts +96 -0
  167. package/src/types/data/User.ts +48 -0
  168. package/tsconfig.json +7 -5
  169. package/.eslintignore +0 -3
  170. package/dist/commands/Auth.d.ts +0 -10
  171. package/dist/commands/Auth.js +0 -101
  172. package/dist/commands/Auth.js.map +0 -1
  173. package/dist/models/errors/DataValidationError.d.ts +0 -30
  174. package/dist/models/errors/DataValidationError.js +0 -34
  175. package/dist/models/errors/DataValidationError.js.map +0 -1
  176. package/dist/services/public/AuthService.js +0 -205
  177. package/dist/services/public/AuthService.js.map +0 -1
  178. package/src/commands/Auth.ts +0 -46
  179. package/src/models/errors/DataValidationError.ts +0 -44
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Cursor = exports.CursoredData = void 0;
4
- var Data_1 = require("../../enums/Data");
5
- var JsonUtils_1 = require("../../helper/JsonUtils");
6
- var Notification_1 = require("./Notification");
7
- var Tweet_1 = require("./Tweet");
8
- var User_1 = require("./User");
4
+ const Data_1 = require("../../enums/Data");
5
+ const JsonUtils_1 = require("../../helper/JsonUtils");
6
+ const Notification_1 = require("./Notification");
7
+ const Tweet_1 = require("./Tweet");
8
+ const User_1 = require("./User");
9
9
  /**
10
10
  * The data that is fetched batch-wise using a cursor.
11
11
  *
@@ -13,46 +13,46 @@ var User_1 = require("./User");
13
13
  *
14
14
  * @public
15
15
  */
16
- var CursoredData = /** @class */ (function () {
16
+ class CursoredData {
17
+ list = [];
18
+ next = new Cursor('');
17
19
  /**
18
20
  * @param response - The raw response.
19
21
  * @param type - The base type of the data included in the batch.
20
22
  */
21
- function CursoredData(response, type) {
22
- var _a, _b, _c, _d, _e, _f;
23
- /** The batch of data of the given type. */
23
+ constructor(response, type) {
24
+ // Initializing defaults
24
25
  this.list = [];
25
- /** The cursor to the next batch of data. */
26
26
  this.next = new Cursor('');
27
27
  if (type == Data_1.EBaseType.TWEET) {
28
28
  this.list = Tweet_1.Tweet.list(response);
29
- this.next = new Cursor((_b = (_a = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '');
29
+ this.next = new Cursor((0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]?.value ?? '');
30
30
  }
31
31
  else if (type == Data_1.EBaseType.USER) {
32
32
  this.list = User_1.User.list(response);
33
- this.next = new Cursor((_d = (_c = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '');
33
+ this.next = new Cursor((0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Bottom')[0]?.value ?? '');
34
34
  }
35
35
  else if (type == Data_1.EBaseType.NOTIFICATION) {
36
36
  this.list = Notification_1.Notification.list(response);
37
- this.next = new Cursor((_f = (_e = (0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Top')[0]) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '');
37
+ this.next = new Cursor((0, JsonUtils_1.findByFilter)(response, 'cursorType', 'Top')[0]?.value ?? '');
38
38
  }
39
39
  }
40
- return CursoredData;
41
- }());
40
+ }
42
41
  exports.CursoredData = CursoredData;
43
42
  /**
44
43
  * The cursor to the batch of data to fetch.
45
44
  *
46
45
  * @public
47
46
  */
48
- var Cursor = /** @class */ (function () {
47
+ class Cursor {
48
+ /** The cursor string. */
49
+ value;
49
50
  /**
50
51
  * @param cursor - The cursor string.
51
52
  */
52
- function Cursor(cursor) {
53
+ constructor(cursor) {
53
54
  this.value = cursor;
54
55
  }
55
- return Cursor;
56
- }());
56
+ }
57
57
  exports.Cursor = Cursor;
58
58
  //# sourceMappingURL=CursoredData.js.map
@@ -1 +1 @@
1
- {"version":3,"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CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACpG,CAAC;aAAM,IAAI,IAAI,IAAI,gBAAS,CAAC,YAAY,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,GAAG,2BAAY,CAAC,IAAI,CAAC,QAAQ,CAAQ,CAAC;YAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAA,wBAAY,EAAa,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QACjG,CAAC;IACF,CAAC;CACD;AAxBD,oCAwBC;AAED;;;;GAIG;AACH,MAAa,MAAM;IAClB,yBAAyB;IAClB,KAAK,CAAS;IAErB;;OAEG;IACH,YAAmB,MAAc;QAChC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IACrB,CAAC;CACD;AAVD,wBAUC"}
@@ -1,23 +1,17 @@
1
1
  import { IList as IRawList } from 'rettiwt-core';
2
+ import { IList } from '../../types/data/List';
2
3
  /**
3
4
  * The details of a single Twitter List.
4
5
  *
5
6
  * @public
6
7
  */
7
- export declare class List {
8
- /** The date and time of creation of the list, int UTC string format. */
8
+ export declare class List implements IList {
9
9
  createdAt: string;
10
- /** The rest id of the user who created the list. */
11
10
  createdBy: string;
12
- /** The list description. */
13
11
  description?: string;
14
- /** The rest id of the list. */
15
12
  id: string;
16
- /** The number of memeber of the list. */
17
13
  memberCount: number;
18
- /** The name of the list. */
19
14
  name: string;
20
- /** The number of subscribers of the list. */
21
15
  subscriberCount: number;
22
16
  /**
23
17
  * @param list - The raw list details.
@@ -6,11 +6,18 @@ exports.List = void 0;
6
6
  *
7
7
  * @public
8
8
  */
9
- var List = /** @class */ (function () {
9
+ class List {
10
+ createdAt;
11
+ createdBy;
12
+ description;
13
+ id;
14
+ memberCount;
15
+ name;
16
+ subscriberCount;
10
17
  /**
11
18
  * @param list - The raw list details.
12
19
  */
13
- function List(list) {
20
+ constructor(list) {
14
21
  this.id = list.id_str;
15
22
  this.name = list.name;
16
23
  this.createdAt = new Date(list.created_at).toISOString();
@@ -19,7 +26,6 @@ var List = /** @class */ (function () {
19
26
  this.subscriberCount = list.subscriber_count;
20
27
  this.createdBy = list.user_results.result.id;
21
28
  }
22
- return List;
23
- }());
29
+ }
24
30
  exports.List = List;
25
31
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/models/data/List.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH;IAsBC;;OAEG;IACH,cAAmB,IAAc;QAChC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9C,CAAC;IACF,WAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,oBAAI"}
1
+ {"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/models/data/List.ts"],"names":[],"mappings":";;;AAIA;;;;GAIG;AACH,MAAa,IAAI;IACT,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,WAAW,CAAU;IACrB,EAAE,CAAS;IACX,WAAW,CAAS;IACpB,IAAI,CAAS;IACb,eAAe,CAAS;IAE/B;;OAEG;IACH,YAAmB,IAAc;QAChC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;QACzD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC7C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9C,CAAC;CACD;AArBD,oBAqBC"}
@@ -1,38 +1,22 @@
1
- import { INotification } from 'rettiwt-core';
2
- /**
3
- * The different types of notifications.
4
- *
5
- * @public
6
- */
7
- export declare enum ENotificationType {
8
- RECOMMENDATION = "RECOMMENDATION",
9
- INFORMATION = "INFORMATION",
10
- LIVE = "LIVE",
11
- ALERT = "ALERT",
12
- UNDEFINED = "UNDEFINED"
13
- }
1
+ import { INotification as IRawNotification } from 'rettiwt-core';
2
+ import { ENotificationType } from '../../enums/Data';
3
+ import { INotification } from '../../types/data/Notification';
14
4
  /**
15
5
  * The details of a single notification.
16
6
  *
17
7
  * @public
18
8
  */
19
- export declare class Notification {
20
- /** The list of id of the users from whom the notification was received. */
9
+ export declare class Notification implements INotification {
21
10
  from: string[];
22
- /** The id of the notification. */
23
11
  id: string;
24
- /** The text contents of the notification. */
25
12
  message: string;
26
- /** The date/time at which the notification was received. */
27
13
  receivedAt: Date;
28
- /** The list of id of the target tweet(s) of the notification. */
29
14
  target: string[];
30
- /** The type of notification. */
31
15
  type?: ENotificationType;
32
16
  /**
33
17
  * @param notification - The raw notification details.
34
18
  */
35
- constructor(notification: INotification);
19
+ constructor(notification: IRawNotification);
36
20
  /**
37
21
  * Extracts and deserializes the list of notifications from the given raw response data.
38
22
  *
@@ -1,46 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Notification = exports.ENotificationType = void 0;
4
- var rettiwt_core_1 = require("rettiwt-core");
5
- var JsonUtils_1 = require("../../helper/JsonUtils");
6
- /**
7
- * The different types of notifications.
8
- *
9
- * @public
10
- */
11
- var ENotificationType;
12
- (function (ENotificationType) {
13
- ENotificationType["RECOMMENDATION"] = "RECOMMENDATION";
14
- ENotificationType["INFORMATION"] = "INFORMATION";
15
- ENotificationType["LIVE"] = "LIVE";
16
- ENotificationType["ALERT"] = "ALERT";
17
- ENotificationType["UNDEFINED"] = "UNDEFINED";
18
- })(ENotificationType || (exports.ENotificationType = ENotificationType = {}));
3
+ exports.Notification = void 0;
4
+ const rettiwt_core_1 = require("rettiwt-core");
5
+ const Data_1 = require("../../enums/Data");
6
+ const JsonUtils_1 = require("../../helper/JsonUtils");
19
7
  /**
20
8
  * The details of a single notification.
21
9
  *
22
10
  * @public
23
11
  */
24
- var Notification = /** @class */ (function () {
12
+ class Notification {
13
+ from;
14
+ id;
15
+ message;
16
+ receivedAt;
17
+ target;
18
+ type;
25
19
  /**
26
20
  * @param notification - The raw notification details.
27
21
  */
28
- function Notification(notification) {
29
- var _a, _b, _c, _d;
22
+ constructor(notification) {
30
23
  // Getting the original notification type
31
- var notificationType = (0, JsonUtils_1.findKeyByValue)(rettiwt_core_1.ENotificationType, notification.icon.id);
32
- this.from = ((_b = (_a = notification.template) === null || _a === void 0 ? void 0 : _a.aggregateUserActionsV1) === null || _b === void 0 ? void 0 : _b.fromUsers)
33
- ? notification.template.aggregateUserActionsV1.fromUsers.map(function (item) { return item.user.id; })
24
+ const notificationType = (0, JsonUtils_1.findKeyByValue)(rettiwt_core_1.ENotificationType, notification.icon.id);
25
+ this.from = notification.template?.aggregateUserActionsV1?.fromUsers
26
+ ? notification.template.aggregateUserActionsV1.fromUsers.map((item) => item.user.id)
34
27
  : [];
35
28
  this.id = notification.id;
36
29
  this.message = notification.message.text;
37
30
  this.receivedAt = new Date(Number(notification.timestampMs));
38
- this.target = ((_d = (_c = notification.template) === null || _c === void 0 ? void 0 : _c.aggregateUserActionsV1) === null || _d === void 0 ? void 0 : _d.targetObjects)
39
- ? notification.template.aggregateUserActionsV1.targetObjects.map(function (item) { return item.tweet.id; })
31
+ this.target = notification.template?.aggregateUserActionsV1?.targetObjects
32
+ ? notification.template.aggregateUserActionsV1.targetObjects.map((item) => item.tweet.id)
40
33
  : [];
41
34
  this.type = notificationType
42
- ? ENotificationType[notificationType]
43
- : ENotificationType.UNDEFINED;
35
+ ? Data_1.ENotificationType[notificationType]
36
+ : Data_1.ENotificationType.UNDEFINED;
44
37
  }
45
38
  /**
46
39
  * Extracts and deserializes the list of notifications from the given raw response data.
@@ -51,19 +44,17 @@ var Notification = /** @class */ (function () {
51
44
  *
52
45
  * @internal
53
46
  */
54
- Notification.list = function (response) {
55
- var notifications = [];
47
+ static list(response) {
48
+ const notifications = [];
56
49
  // Extracting notifications
57
50
  if (response.globalObjects.notifications) {
58
51
  // Iterating over the raw list of notifications
59
- for (var _i = 0, _a = Object.entries(response.globalObjects.notifications); _i < _a.length; _i++) {
60
- var _b = _a[_i], value = _b[1];
52
+ for (const [, value] of Object.entries(response.globalObjects.notifications)) {
61
53
  notifications.push(new Notification(value));
62
54
  }
63
55
  }
64
56
  return notifications;
65
- };
66
- return Notification;
67
- }());
57
+ }
58
+ }
68
59
  exports.Notification = Notification;
69
60
  //# sourceMappingURL=Notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/models/data/Notification.ts"],"names":[],"mappings":";;;AAAA,6CAIsB;AAEtB,oDAAwD;AAExD;;;;GAIG;AACH,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC5B,sDAAiC,CAAA;IACjC,gDAA2B,CAAA;IA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,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,sBAAsB,EAAE,aAAa;YACzE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACzF,CAAC,CAAC,EAAE,CAAC;QACN,IAAI,CAAC,IAAI,GAAG,gBAAgB;YAC3B,CAAC,CAAC,wBAAiB,CAAC,gBAAkD,CAAC;YACvE,CAAC,CAAC,wBAAiB,CAAC,SAAS,CAAC;IAChC,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,IAAI,CAAC,QAA8B;QAChD,MAAM,aAAa,GAAmB,EAAE,CAAC;QAEzC,2BAA2B;QAC3B,IAAK,QAAuC,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;YAC1E,+CAA+C;YAC/C,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CACpC,QAAuC,CAAC,aAAa,CAAC,aAAa,CACpE,EAAE,CAAC;gBACH,aAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,KAAyB,CAAC,CAAC,CAAC;YACjE,CAAC;QACF,CAAC;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;CACD;AArDD,oCAqDC"}
@@ -1,54 +1,38 @@
1
1
  import { EMediaType, IExtendedMedia as IRawExtendedMedia, ITweet as IRawTweet, IEntities as IRawTweetEntities } from 'rettiwt-core';
2
+ import { ITweet } from '../../types/data/Tweet';
2
3
  import { User } from './User';
3
4
  /**
4
5
  * The details of a single tweet.
5
6
  *
6
7
  * @public
7
8
  */
8
- export declare class Tweet {
9
- /** The number of bookmarks of a tweet. */
9
+ export declare class Tweet implements ITweet {
10
10
  bookmarkCount: number;
11
- /** The date and time of creation of the tweet, in UTC string format. */
11
+ conversationId: string;
12
12
  createdAt: string;
13
- /** Additional tweet entities like urls, mentions, etc. */
14
13
  entities: TweetEntities;
15
- /** The full text content of the tweet. */
16
14
  fullText: string;
17
- /** The rest id of the tweet. */
18
15
  id: string;
19
- /** The language in which the tweet is written. */
20
16
  lang: string;
21
- /** The number of likes of the tweet. */
22
17
  likeCount: number;
23
- /** The urls of the media contents of the tweet (if any). */
24
18
  media?: TweetMedia[];
25
- /** The number of quotes of the tweet. */
26
19
  quoteCount: number;
27
- /** The tweet which is quoted in the tweet. */
28
20
  quoted?: Tweet;
29
- /** The number of replies to the tweet. */
30
21
  replyCount: number;
31
- /** The rest id of the tweet to which the tweet is a reply. */
32
- replyTo?: Tweet;
33
- /** The number of retweets of the tweet. */
22
+ replyTo?: string;
34
23
  retweetCount: number;
35
- /** The tweet which is retweeted in this tweet (if any). */
36
24
  retweetedTweet?: Tweet;
37
- /** The details of the user who made the tweet. */
38
25
  tweetBy: User;
39
- /** The number of views of a tweet. */
26
+ url: string;
40
27
  viewCount: number;
41
28
  /**
42
29
  * @param tweet - The raw tweet details.
43
- * @param response - The raw response
44
30
  */
45
- constructor(tweet: IRawTweet, response: NonNullable<unknown>);
46
- private getParentTweet;
31
+ constructor(tweet: IRawTweet);
47
32
  /**
48
33
  * Extract and deserialize the original quoted tweet from the given raw tweet.
49
34
  *
50
35
  * @param tweet - The raw tweet.
51
- * @param response - The raw response
52
36
  *
53
37
  * @returns - The deserialized original quoted tweet.
54
38
  */
@@ -57,7 +41,6 @@ export declare class Tweet {
57
41
  * Extract and deserialize the original retweeted tweet from the given raw tweet.
58
42
  *
59
43
  * @param tweet - The raw tweet.
60
- * @param response - The raw response
61
44
  *
62
45
  * @returns - The deserialized original retweeted tweet.
63
46
  */