rettiwt-api 1.1.0 → 1.1.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 (125) hide show
  1. package/.github/workflows/build-docs.yml +27 -0
  2. package/README.md +3 -1
  3. package/dist/Test.d.ts +0 -0
  4. package/dist/Test.js +2 -0
  5. package/dist/Test.js.map +1 -0
  6. package/dist/index.d.ts +16 -5
  7. package/dist/index.js +22 -8
  8. package/dist/index.js.map +1 -1
  9. package/dist/models/graphql/Global.d.ts +4 -0
  10. package/dist/models/graphql/Global.js +13 -0
  11. package/dist/models/graphql/Global.js.map +1 -0
  12. package/dist/models/graphql/TweetTypes.d.ts +6 -0
  13. package/dist/models/graphql/TweetTypes.js +156 -0
  14. package/dist/models/graphql/TweetTypes.js.map +1 -0
  15. package/dist/models/graphql/UserTypes.d.ts +3 -0
  16. package/dist/models/graphql/UserTypes.js +139 -0
  17. package/dist/models/graphql/UserTypes.js.map +1 -0
  18. package/dist/queries/RootQuery.d.ts +4 -0
  19. package/dist/queries/RootQuery.js +70 -0
  20. package/dist/queries/RootQuery.js.map +1 -0
  21. package/dist/resolvers/AccountResolver.d.ts +12 -0
  22. package/dist/resolvers/AccountResolver.js +84 -0
  23. package/dist/resolvers/AccountResolver.js.map +1 -0
  24. package/dist/resolvers/ResolverBase.d.ts +5 -0
  25. package/dist/resolvers/ResolverBase.js +11 -0
  26. package/dist/resolvers/ResolverBase.js.map +1 -0
  27. package/dist/resolvers/TweetResolver.d.ts +54 -0
  28. package/dist/resolvers/TweetResolver.js +332 -0
  29. package/dist/resolvers/TweetResolver.js.map +1 -0
  30. package/dist/resolvers/UserResolver.d.ts +38 -0
  31. package/dist/resolvers/UserResolver.js +253 -0
  32. package/dist/resolvers/UserResolver.js.map +1 -0
  33. package/dist/services/AuthService.d.ts +6 -2
  34. package/dist/services/AuthService.js +4 -3
  35. package/dist/services/AuthService.js.map +1 -1
  36. package/dist/services/CacheService.d.ts +12 -7
  37. package/dist/services/CacheService.js +12 -7
  38. package/dist/services/CacheService.js.map +1 -1
  39. package/dist/services/FetcherService.d.ts +32 -12
  40. package/dist/services/FetcherService.js +45 -14
  41. package/dist/services/FetcherService.js.map +1 -1
  42. package/dist/services/accounts/AccountService.d.ts +23 -6
  43. package/dist/services/accounts/AccountService.js +34 -9
  44. package/dist/services/accounts/AccountService.js.map +1 -1
  45. package/dist/services/data/TrendService.d.ts +17 -0
  46. package/dist/services/data/TrendService.js +116 -0
  47. package/dist/services/data/TrendService.js.map +1 -0
  48. package/dist/services/data/TweetService.d.ts +22 -15
  49. package/dist/services/data/TweetService.js +22 -15
  50. package/dist/services/data/TweetService.js.map +1 -1
  51. package/dist/services/data/UserAccountService.d.ts +42 -0
  52. package/dist/services/data/UserAccountService.js +239 -0
  53. package/dist/services/data/UserAccountService.js.map +1 -0
  54. package/dist/services/data/UserService.d.ts +21 -15
  55. package/dist/services/data/UserService.js +21 -15
  56. package/dist/services/data/UserService.js.map +1 -1
  57. package/dist/services/helper/Deserializers.d.ts +19 -0
  58. package/dist/services/helper/Deserializers.js +115 -0
  59. package/dist/services/helper/Deserializers.js.map +1 -0
  60. package/dist/services/helper/Extractors.d.ts +104 -0
  61. package/dist/services/helper/Extractors.js +432 -0
  62. package/dist/services/helper/Extractors.js.map +1 -0
  63. package/dist/services/helper/Urls.d.ts +85 -0
  64. package/dist/services/helper/Urls.js +130 -0
  65. package/dist/services/helper/Urls.js.map +1 -0
  66. package/dist/services/helper/extractors/Trends.d.ts +3 -0
  67. package/dist/services/helper/extractors/Trends.js +51 -0
  68. package/dist/services/helper/extractors/Trends.js.map +1 -0
  69. package/dist/services/helper/urls/Trends.d.ts +7 -0
  70. package/dist/services/helper/urls/Trends.js +13 -0
  71. package/dist/services/helper/urls/Trends.js.map +1 -0
  72. package/dist/types/Authentication.d.ts +27 -2
  73. package/dist/types/Authentication.js.map +1 -1
  74. package/dist/types/HTTP.d.ts +3 -1
  75. package/dist/types/HTTP.js +3 -1
  76. package/dist/types/HTTP.js.map +1 -1
  77. package/dist/types/Resolvers.d.ts +6 -1
  78. package/dist/types/Service.d.ts +30 -0
  79. package/dist/types/Service.js +19 -0
  80. package/dist/types/Service.js.map +1 -0
  81. package/dist/types/Trends.d.ts +50 -0
  82. package/dist/types/Trends.js +3 -0
  83. package/dist/types/Trends.js.map +1 -0
  84. package/dist/types/Tweet.d.ts +40 -0
  85. package/dist/types/Tweet.js +5 -0
  86. package/dist/types/Tweet.js.map +1 -0
  87. package/dist/types/UserAccount.d.ts +19 -0
  88. package/dist/types/UserAccount.js +4 -0
  89. package/dist/types/UserAccount.js.map +1 -0
  90. package/dist/types/data/Errors.d.ts +9 -3
  91. package/dist/types/data/Errors.js +9 -3
  92. package/dist/types/data/Errors.js.map +1 -1
  93. package/dist/types/data/Service.d.ts +19 -5
  94. package/dist/types/data/Service.js +6 -3
  95. package/dist/types/data/Service.js.map +1 -1
  96. package/dist/types/data/Tweet.d.ts +60 -3
  97. package/dist/types/data/Tweet.js +0 -1
  98. package/dist/types/data/Tweet.js.map +1 -1
  99. package/dist/types/data/User.d.ts +20 -1
  100. package/dist/types/data/User.js +0 -1
  101. package/dist/types/data/User.js.map +1 -1
  102. package/dist/types/graphql/Errors.d.ts +15 -0
  103. package/dist/types/graphql/Errors.js +23 -0
  104. package/dist/types/graphql/Errors.js.map +1 -0
  105. package/dist/types/raw/general/Trends.d.ts +324 -0
  106. package/dist/types/raw/general/Trends.js +3 -0
  107. package/dist/types/raw/general/Trends.js.map +1 -0
  108. package/dist/types/raw/user/Tweets.d.ts +2428 -0
  109. package/dist/types/raw/user/Tweets.js +3 -0
  110. package/dist/types/raw/user/Tweets.js.map +1 -0
  111. package/package.json +5 -4
  112. package/src/index.ts +19 -6
  113. package/src/services/AuthService.ts +13 -7
  114. package/src/services/CacheService.ts +12 -7
  115. package/src/services/FetcherService.ts +62 -21
  116. package/src/services/accounts/AccountService.ts +38 -12
  117. package/src/services/data/TweetService.ts +25 -18
  118. package/src/services/data/UserService.ts +21 -15
  119. package/src/types/Authentication.ts +27 -2
  120. package/src/types/HTTP.ts +4 -2
  121. package/src/types/Resolvers.ts +14 -6
  122. package/src/types/data/Errors.ts +10 -4
  123. package/src/types/data/Service.ts +28 -11
  124. package/src/types/data/Tweet.ts +109 -31
  125. package/src/types/data/User.ts +47 -17
package/src/types/HTTP.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /**
2
- * @summary Stores the different types of http status codes
2
+ * The different types of http status codes
3
+ *
4
+ * @internal
3
5
  */
4
6
  export enum HttpStatus {
5
7
  BadRequest = 400,
@@ -12,4 +14,4 @@ export enum HttpStatus {
12
14
  InternalServerError = 500,
13
15
  BadGateway = 502,
14
16
  ServiceUnavailable = 503
15
- };
17
+ };
@@ -1,9 +1,17 @@
1
1
  /**
2
- * @summary Stores the data returned from extractors
2
+ * The data returned from extractor methods.
3
+ * @internal
3
4
  */
4
5
  export interface DataExtract {
5
- required: any; // To store the required data extracted
6
- cursor: string; // To store the cursor extracted
7
- users: any; // To store all user details extracted
8
- tweets: any; // To store all tweets exracted
9
- }
6
+ /** The required data. */
7
+ required: any;
8
+
9
+ /** The cursor string to the next batch of data. */
10
+ cursor: string;
11
+
12
+ /** Additional extracted user details. */
13
+ users: any;
14
+
15
+ /** Additional extracted tweet details */
16
+ tweets: any;
17
+ }
@@ -1,12 +1,16 @@
1
1
  /**
2
- * @summary Stores different types of error messages related to authentication
2
+ * Different types of error messages related to authentication.
3
+ *
4
+ * @public
3
5
  */
4
6
  export enum AuthenticationErrors {
5
7
  NotAuthenticated = "Cannot fetch this data without authentication",
6
8
  };
7
9
 
8
10
  /**
9
- * @summary Stores different types error messages for validation errors
11
+ * Different types error messages for validation errors.
12
+ *
13
+ * @public
10
14
  */
11
15
  export enum ValidationErrors {
12
16
  InvalidTweetFilter = "Atleast one of fromUsers/toUsers/mentions/hashtags/words argument is required",
@@ -15,7 +19,9 @@ export enum ValidationErrors {
15
19
  };
16
20
 
17
21
  /**
18
- * @summary Stores all the different type of error messages that are returned by services
22
+ * Different type of error messages that are returned by services.
23
+ *
24
+ * @public
19
25
  */
20
26
  export enum DataErrors {
21
27
  UserNotFound = "An account with given username/id was not found",
@@ -25,4 +31,4 @@ export enum DataErrors {
25
31
  NoRetweetersFound = "No retweeters found for the tweet with the given id",
26
32
  NoFollowsFound = "No follow details were found for the user with the given id",
27
33
  NoLikedTweetsFound = "No liked tweets were found for the user with the given id"
28
- };
34
+ };
@@ -4,16 +4,20 @@ import { TweetService } from "../../services/data/TweetService";
4
4
  import { UserService } from "../../services/data/UserService";
5
5
 
6
6
  /**
7
- * @summary Stores the cursor to the batch of data
7
+ * The cursor to the batch of data to be fetched.
8
+ *
9
+ * @public
8
10
  */
9
11
  export class Cursor {
10
12
  // MEMBER DATA
11
- value: string; // To store the cursor to next batch of data
13
+ /** The cursor string. */
14
+ value: string;
12
15
 
13
16
  // MEMBER DATA
14
17
  /**
15
- * @summary Initializes a new cursor from the given cursor string
16
- * @param cursorStr The string representation of the cursor
18
+ * Initializes a new cursor from the given cursor string.
19
+ *
20
+ * @param cursorStr The string representation of the cursor.
17
21
  */
18
22
  constructor(cursorStr: string) {
19
23
  this.value = cursorStr;
@@ -21,18 +25,31 @@ export class Cursor {
21
25
  }
22
26
 
23
27
  /**
24
- * @summary Stores cursored data that is returned by services
28
+ * The data that us fetched batch-wise along with a cursor.
29
+ *
30
+ * @typeParam Type - The type of data present in the list.
31
+ * @public
25
32
  */
26
33
  export interface CursoredData<Type> {
27
- list: Type[]; // To store the list data
28
- next: Cursor; // To store the information about cursor to the next batch
34
+ /** The list of data of the given type. */
35
+ list: Type[];
36
+
37
+ /** The cursor to the next batch of data. */
38
+ next: Cursor;
29
39
  }
30
40
 
31
41
  /**
32
- * @summary Stores the data context from where data is to be fetched
42
+ * The data context from where data is to be fetched.
43
+ *
44
+ * @public
33
45
  */
34
46
  export interface DataContext {
35
- users: UserService, // To store the source for fetching user data
36
- tweets: TweetService, // To store the source for fetching tweet data
37
- account: AccountService // To store the source for account related operations
47
+ /** Handles data related to users. */
48
+ users: UserService,
49
+
50
+ /** Handles data related to tweets. */
51
+ tweets: TweetService,
52
+
53
+ /** Handles account related operations. */
54
+ account: AccountService
38
55
  }
@@ -1,45 +1,123 @@
1
- // This file contains various objects related to handling of Tweets made by a user
2
-
3
1
  /**
4
- * @summary Stores the filter to be used for fetching tweets from TwitterAPI
2
+ * The filter to be used for fetching tweets from Twitter.
3
+ *
4
+ * @public
5
5
  */
6
6
  export interface TweetFilter {
7
- words?: string[]; // To store the list of words to search
8
- hashtags?: string[]; // To store the list of hashtags to seach
9
- fromUsers?: string[]; // To store the list of users who made the tweet
10
- toUsers?: string[]; // To store the list of users to whom the tweet was meant for
11
- mentions?: string[]; // To store the list of mentioned users
12
- startDate?: string; // To store the beginning date to search tweets
13
- endDate?: string; // To store the ending date to search tweets
14
- sinceId?: string; // To store the first id (exclusive) from which to search tweets
15
- quoted?: string; // To store the id of the tweet which is quoted
16
- links?: boolean; // To store whether to fetch link tweets or not
7
+ /** The list of words to search. */
8
+ words?: string[];
9
+
10
+ /** The list of hashtags to search.
11
+ *
12
+ * @remarks
13
+ * '#' must be excluded from the hashtag!
14
+ */
15
+ hashtags?: string[];
16
+
17
+ /** The list of usernames whose tweets are to be searched.
18
+ *
19
+ * @remarks
20
+ * '@' must be excluded from the username!
21
+ */
22
+ fromUsers?: string[];
23
+
24
+ /** The list of username to whom the tweets to be searched, are adressed.
25
+ *
26
+ * @remarks
27
+ * '@' must be excluded from the username!
28
+ */
29
+ toUsers?: string[];
30
+
31
+ /** The list of username mentioned in the tweets to search.
32
+ *
33
+ * @remarks
34
+ * '@' must be excluded from the username!
35
+ */
36
+ mentions?: string[];
37
+
38
+ /** The date starting from which tweets are to be searched.
39
+ *
40
+ * @remarks
41
+ * Must be in the format YYYY-MM-DD.
42
+ */
43
+ startDate?: string;
44
+
45
+ /** The date upto which tweets are to be searched.
46
+ *
47
+ * @remarks
48
+ * Must be in the format YYYY-MM-DD.
49
+ */
50
+ endDate?: string;
51
+
52
+ /** The id of the tweet, after which the tweets are to be searched. */
53
+ sinceId?: string;
54
+
55
+ /** The id of the tweet which is quoted in the tweets to search. */
56
+ quoted?: string;
57
+
58
+ /** Whether to fetch tweets that are links or not.
59
+ *
60
+ * @defaultValue false
61
+ */
62
+ links?: boolean;
17
63
  };
18
64
 
19
65
  /**
20
- * @summary Stores the different types of tweet elements like urls, media, mentions, hashtags, etc
66
+ * The different types parsed entities like urls, media, mentions, hashtags, etc.
67
+ *
68
+ * @public
21
69
  */
22
70
  export interface TweetEntities {
23
- hashtags: string[]; // To store a list of hashtags used
24
- urls: string[]; // To store a list of urls mentioned
25
- mentionedUsers: string[]; // To store a list of users mentioned
26
- media: string[]; // To store urls to various media files
71
+ /** The list of hashtags mentioned in the tweet. */
72
+ hashtags: string[];
73
+
74
+ /** The list of urls mentioned in the tweet. */
75
+ urls: string[];
76
+
77
+ /** The list of IDs of users mentioned in the tweet. */
78
+ mentionedUsers: string[];
79
+
80
+ /** The list of urls to various media mentioned in the tweet. */
81
+ media: string[];
27
82
  }
28
83
 
29
84
  /**
30
- * @summary Stores a single tweet
85
+ * The details of a single Tweet.
31
86
  */
32
87
  export interface Tweet {
33
- id: string; // To store the conversation id
34
- tweetBy: string; // To store the rest id of the user who made the tweet
35
- createdAt: string; // To store the time when the tweet was created
36
- entities: TweetEntities; // To store additional tweet entities
37
- quoted: string; // To store the id of the tweet quote (if any)
38
- fullText: string; // To store the full text in the tweet
39
- replyTo: string; // To store the id of the tweet to which this was a reply
40
- lang: string; // To store the language used in the tweet
41
- quoteCount: number; // To store the number of quotes of the tweet
42
- replyCount: number; // To store the number of replies to the tweet
43
- retweetCount: number; // To store the number of retweets
44
- likeCount: number; // To store the number of likes
88
+ /** The rest id of the tweet. */
89
+ id: string;
90
+
91
+ /** The rest id of the user who made the tweet. */
92
+ tweetBy: string;
93
+
94
+ /** The date and time of creation of the tweet, in UTC string format. */
95
+ createdAt: string;
96
+
97
+ /** Additional tweet entities like urls, mentions, etc. */
98
+ entities: TweetEntities;
99
+
100
+ /** The rest id of the tweet which is quoted in the tweet. */
101
+ quoted: string;
102
+
103
+ /** The full text content of the tweet. */
104
+ fullText: string;
105
+
106
+ /** The rest id of the user to which the tweet is a reply. */
107
+ replyTo: string;
108
+
109
+ /** The language in which the tweet is written. */
110
+ lang: string;
111
+
112
+ /** The number of quotes of the tweet. */
113
+ quoteCount: number;
114
+
115
+ /** The number of replies to the tweet. */
116
+ replyCount: number;
117
+
118
+ /** The number of retweets of the tweet. */
119
+ retweetCount: number;
120
+
121
+ /** The number of likes of the tweet. */
122
+ likeCount: number;
45
123
  }
@@ -1,21 +1,51 @@
1
- // This file contains various objects for handling data related to User Account
2
-
3
1
  /**
4
- * @summary Stores the complete details of the given user's account
2
+ * The details of a single user.
3
+ *
4
+ * @public
5
5
  */
6
6
  export interface User {
7
- id: string; // To store the internal rest id of user account
8
- userName: string; // To store the screen name of the user
9
- fullName: string; // To store the actual name of the user
10
- createdAt: string; // To store the time when the account was created
11
- description: string; // To store the account description
12
- isVerified: boolean ; // To store whether this is a verified account or not
13
- favouritesCount: number; // To store the number of favourites
14
- followersCount: number; // To store the number of followers
15
- followingsCount: number; // To store the number of people followed by this user
16
- statusesCount: number; // To store the number of status posted by user
17
- location: string; // To store the user's location
18
- pinnedTweet: string; // To store the id of tweet that is pinned in the account
19
- profileBanner: string; // To store the url to the profile's banner
20
- profileImage: string; // To store the url to the profile's image
7
+ /** The rest id of the user. */
8
+ id: string;
9
+
10
+ /** The username/screenname of the user. */
11
+ userName: string;
12
+
13
+ /** The full name of the user. */
14
+ fullName: string;
15
+
16
+ /** The creation date of user's account. */
17
+ createdAt: string;
18
+
19
+ /** The user's description. */
20
+ description: string;
21
+
22
+ /** Whether the account is verified or not. */
23
+ isVerified: boolean;
24
+
25
+ /** The number of tweets liked by the user. */
26
+ favouritesCount: number;
27
+
28
+ /** The number of followers of the user. */
29
+ followersCount: number;
30
+
31
+ /** The number of following of the user. */
32
+ followingsCount: number;
33
+
34
+ /** The number of tweets made by the user.
35
+ *
36
+ * @remarks This includes original tweets along with retweets.
37
+ */
38
+ statusesCount: number;
39
+
40
+ /** The location of user as provided by user. */
41
+ location: string;
42
+
43
+ /** The rest id of the tweet pinned in the user's profile. */
44
+ pinnedTweet: string;
45
+
46
+ /** The url of the profile banner image. */
47
+ profileBanner: string;
48
+
49
+ /** The url of the profile image. */
50
+ profileImage: string;
21
51
  }