rettiwt-api 6.3.0-alpha.1 → 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.
Files changed (130) hide show
  1. package/README.md +81 -31
  2. package/dist/Rettiwt.d.ts +6 -2
  3. package/dist/Rettiwt.js +7 -3
  4. package/dist/Rettiwt.js.map +1 -1
  5. package/dist/cli.js +3 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/collections/Extractors.d.ts +15 -2
  8. package/dist/collections/Extractors.js +12 -1
  9. package/dist/collections/Extractors.js.map +1 -1
  10. package/dist/collections/Groups.js +8 -0
  11. package/dist/collections/Groups.js.map +1 -1
  12. package/dist/collections/Requests.js +8 -0
  13. package/dist/collections/Requests.js.map +1 -1
  14. package/dist/commands/Space.d.ts +10 -0
  15. package/dist/commands/Space.js +38 -0
  16. package/dist/commands/Space.js.map +1 -0
  17. package/dist/commands/User.js +139 -0
  18. package/dist/commands/User.js.map +1 -1
  19. package/dist/enums/Resource.d.ts +8 -1
  20. package/dist/enums/Resource.js +8 -0
  21. package/dist/enums/Resource.js.map +1 -1
  22. package/dist/index.d.ts +11 -1
  23. package/dist/index.js +6 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/models/RettiwtConfig.d.ts +26 -3
  26. package/dist/models/RettiwtConfig.js +68 -3
  27. package/dist/models/RettiwtConfig.js.map +1 -1
  28. package/dist/models/args/FetchArgs.d.ts +3 -0
  29. package/dist/models/args/FetchArgs.js +6 -0
  30. package/dist/models/args/FetchArgs.js.map +1 -1
  31. package/dist/models/args/PostArgs.d.ts +24 -1
  32. package/dist/models/args/PostArgs.js +52 -1
  33. package/dist/models/args/PostArgs.js.map +1 -1
  34. package/dist/models/data/Space.d.ts +70 -0
  35. package/dist/models/data/Space.js +177 -0
  36. package/dist/models/data/Space.js.map +1 -0
  37. package/dist/models/data/UserAbout.d.ts +44 -0
  38. package/dist/models/data/UserAbout.js +129 -0
  39. package/dist/models/data/UserAbout.js.map +1 -0
  40. package/dist/requests/Space.d.ts +15 -0
  41. package/dist/requests/Space.js +74 -0
  42. package/dist/requests/Space.js.map +1 -0
  43. package/dist/requests/Tweet.d.ts +4 -0
  44. package/dist/requests/Tweet.js +57 -0
  45. package/dist/requests/Tweet.js.map +1 -1
  46. package/dist/requests/User.d.ts +21 -0
  47. package/dist/requests/User.js +64 -0
  48. package/dist/requests/User.js.map +1 -1
  49. package/dist/services/internal/AuthService.d.ts +25 -0
  50. package/dist/services/internal/AuthService.js +121 -0
  51. package/dist/services/internal/AuthService.js.map +1 -1
  52. package/dist/services/public/DirectMessageService.js +3 -3
  53. package/dist/services/public/DirectMessageService.js.map +1 -1
  54. package/dist/services/public/FetcherService.d.ts +4 -3
  55. package/dist/services/public/FetcherService.js +22 -16
  56. package/dist/services/public/FetcherService.js.map +1 -1
  57. package/dist/services/public/ListService.js +5 -5
  58. package/dist/services/public/ListService.js.map +1 -1
  59. package/dist/services/public/SpaceService.d.ts +42 -0
  60. package/dist/services/public/SpaceService.js +60 -0
  61. package/dist/services/public/SpaceService.js.map +1 -0
  62. package/dist/services/public/TweetService.js +26 -23
  63. package/dist/services/public/TweetService.js.map +1 -1
  64. package/dist/services/public/UserService.d.ts +79 -0
  65. package/dist/services/public/UserService.js +203 -23
  66. package/dist/services/public/UserService.js.map +1 -1
  67. package/dist/types/RettiwtConfig.d.ts +33 -3
  68. package/dist/types/args/FetchArgs.d.ts +35 -1
  69. package/dist/types/args/PostArgs.d.ts +44 -1
  70. package/dist/types/data/Space.d.ts +89 -0
  71. package/dist/types/data/Space.js +3 -0
  72. package/dist/types/data/Space.js.map +1 -0
  73. package/dist/types/data/UserAbout.d.ts +68 -0
  74. package/dist/types/data/UserAbout.js +3 -0
  75. package/dist/types/data/UserAbout.js.map +1 -0
  76. package/dist/types/raw/base/Space.d.ts +43 -22
  77. package/dist/types/raw/space/AudioSpaceById.d.ts +50 -0
  78. package/dist/types/raw/space/AudioSpaceById.js +4 -0
  79. package/dist/types/raw/space/AudioSpaceById.js.map +1 -0
  80. package/dist/types/raw/space/Details.d.ts +2 -309
  81. package/dist/types/raw/tweet/Post.d.ts +16 -1
  82. package/dist/types/raw/user/About.d.ts +65 -0
  83. package/dist/types/raw/user/About.js +4 -0
  84. package/dist/types/raw/user/About.js.map +1 -0
  85. package/dist/types/raw/user/ChangePassword.d.ts +8 -0
  86. package/dist/types/raw/user/ChangePassword.js +3 -0
  87. package/dist/types/raw/user/ChangePassword.js.map +1 -0
  88. package/dist/types/raw/user/ProfileUpdate.d.ts +1 -0
  89. package/dist/types/raw/user/Settings.d.ts +21 -0
  90. package/dist/types/raw/user/Settings.js +4 -0
  91. package/dist/types/raw/user/Settings.js.map +1 -0
  92. package/package.json +5 -3
  93. package/src/Rettiwt.ts +10 -3
  94. package/src/cli.ts +3 -1
  95. package/src/collections/Extractors.ts +22 -3
  96. package/src/collections/Groups.ts +8 -0
  97. package/src/collections/Requests.ts +11 -0
  98. package/src/commands/Space.ts +46 -0
  99. package/src/commands/User.ts +159 -0
  100. package/src/enums/Resource.ts +9 -0
  101. package/src/index.ts +11 -1
  102. package/src/models/RettiwtConfig.ts +81 -6
  103. package/src/models/args/FetchArgs.ts +6 -0
  104. package/src/models/args/PostArgs.ts +58 -1
  105. package/src/models/data/Space.ts +201 -0
  106. package/src/models/data/UserAbout.ts +161 -0
  107. package/src/requests/Space.ts +76 -0
  108. package/src/requests/Tweet.ts +59 -0
  109. package/src/requests/User.ts +69 -0
  110. package/src/services/internal/AuthService.ts +149 -1
  111. package/src/services/public/DirectMessageService.ts +3 -3
  112. package/src/services/public/FetcherService.ts +25 -18
  113. package/src/services/public/ListService.ts +5 -5
  114. package/src/services/public/SpaceService.ts +65 -0
  115. package/src/services/public/TweetService.ts +27 -24
  116. package/src/services/public/UserService.ts +247 -23
  117. package/src/types/RettiwtConfig.ts +35 -3
  118. package/src/types/args/FetchArgs.ts +41 -1
  119. package/src/types/args/PostArgs.ts +50 -1
  120. package/src/types/data/Space.ts +122 -0
  121. package/src/types/data/UserAbout.ts +87 -0
  122. package/src/types/raw/base/Space.ts +42 -22
  123. package/src/types/raw/space/AudioSpaceById.ts +57 -0
  124. package/src/types/raw/space/Details.ts +3 -352
  125. package/src/types/raw/tweet/Post.ts +19 -1
  126. package/src/types/raw/user/About.ts +77 -0
  127. package/src/types/raw/user/ChangePassword.ts +8 -0
  128. package/src/types/raw/user/ProfileUpdate.ts +1 -0
  129. package/src/types/raw/user/Settings.ts +23 -0
  130. package/tsconfig.json +2 -2
@@ -71,7 +71,7 @@ export interface IFetchArgs {
71
71
  *
72
72
  * @remarks
73
73
  * - Required for all resources except {@link ResourceType.TWEET_SEARCH} and {@link ResourceType.USER_TIMELINE_RECOMMENDED}.
74
- * - For {@link ResourceType.USER_DETAILS_BY_USERNAME} and {@link ResourceType.USER_SEARCH}, can be alphanumeric, while for others, is strictly numeric.
74
+ * - For {@link ResourceType.USER_DETAILS_BY_USERNAME}, {@link ResourceType.USER_ABOUT_BY_USERNAME}, and {@link ResourceType.USER_SEARCH}, can be alphanumeric, while for others, is strictly numeric.
75
75
  */
76
76
  id?: string;
77
77
 
@@ -83,6 +83,30 @@ export interface IFetchArgs {
83
83
  */
84
84
  ids?: string[];
85
85
 
86
+ /**
87
+ * Whether to include replay information when fetching space details.
88
+ *
89
+ * @remarks
90
+ * - Only works for {@link ResourceType.SPACE_DETAILS}.
91
+ */
92
+ withReplays?: boolean;
93
+
94
+ /**
95
+ * Whether to include listeners information when fetching space details.
96
+ *
97
+ * @remarks
98
+ * - Only works for {@link ResourceType.SPACE_DETAILS}.
99
+ */
100
+ withListeners?: boolean;
101
+
102
+ /**
103
+ * Whether to request metatags for space details.
104
+ *
105
+ * @remarks
106
+ * - Only works for {@link ResourceType.SPACE_DETAILS}.
107
+ */
108
+ isMetatagsQuery?: boolean;
109
+
86
110
  /**
87
111
  * The sorting to use for tweet results.
88
112
  *
@@ -132,6 +156,22 @@ export interface IFetchArgs {
132
156
  showVerifiedFollowers?: boolean;
133
157
  }
134
158
 
159
+ /**
160
+ * Options specifying the data that is to be fetched for space details.
161
+ *
162
+ * @public
163
+ */
164
+ export interface ISpaceDetailsOptions {
165
+ /** Whether to include replay information. */
166
+ withReplays?: boolean;
167
+
168
+ /** Whether to include listeners information. */
169
+ withListeners?: boolean;
170
+
171
+ /** Whether the request is a metatags query. */
172
+ isMetatagsQuery?: boolean;
173
+ }
174
+
135
175
  /**
136
176
  * The filter to be used for searching tweets.
137
177
  *
@@ -20,9 +20,20 @@ export interface IPostArgs {
20
20
  * - {@link ResourceType.TWEET_UNRETWEET}
21
21
  * - {@link ResourceType.USER_FOLLOW}
22
22
  * - {@link ResourceType.USER_UNFOLLOW}
23
+ *
24
+ * For {@link ResourceType.USER_USERNAME_CHANGE}, use {@link IPostArgs.username}.
25
+ * `id` is still accepted for backward compatibility.
23
26
  */
24
27
  id?: string;
25
28
 
29
+ /**
30
+ * The new username to set.
31
+ *
32
+ * @remarks
33
+ * Required only when changing username using {@link ResourceType.USER_USERNAME_CHANGE}.
34
+ */
35
+ username?: string;
36
+
26
37
  /**
27
38
  * The tweet that is to be posted.
28
39
  *
@@ -67,6 +78,30 @@ export interface IPostArgs {
67
78
  * Required only when updating user profile using {@link ResourceType.USER_PROFILE_UPDATE}
68
79
  */
69
80
  profileOptions?: IProfileUpdateOptions;
81
+
82
+ /**
83
+ * Base64-encoded profile image data.
84
+ *
85
+ * @remarks
86
+ * Required only when updating profile image using {@link ResourceType.USER_PROFILE_IMAGE_UPDATE}.
87
+ */
88
+ profileImage?: string;
89
+
90
+ /**
91
+ * Base64-encoded profile banner data.
92
+ *
93
+ * @remarks
94
+ * Required only when updating profile banner using {@link ResourceType.USER_PROFILE_BANNER_UPDATE}.
95
+ */
96
+ profileBanner?: string;
97
+
98
+ /**
99
+ * Password change arguments.
100
+ *
101
+ * @remarks
102
+ * Required only when changing password using {@link ResourceType.USER_PASSWORD_CHANGE}.
103
+ */
104
+ changePassword?: IChangePasswordArgs;
70
105
  }
71
106
 
72
107
  /**
@@ -98,7 +133,8 @@ export interface INewTweet {
98
133
  * The text for the tweet to be created.
99
134
  *
100
135
  * @remarks
101
- * Length of the tweet must be \<= 280 characters.
136
+ * Length of the tweet must be \<= 280 characters for non-premium accounts.
137
+ * X Premium (Blue) accounts can post longer tweets (up to 25,000 characters).
102
138
  */
103
139
  text?: string;
104
140
  }
@@ -140,3 +176,16 @@ export interface IUploadArgs {
140
176
  */
141
177
  size?: number;
142
178
  }
179
+
180
+ /**
181
+ * Arguments for changing the account password.
182
+ *
183
+ * @public
184
+ */
185
+ export interface IChangePasswordArgs {
186
+ /** The current account password. */
187
+ currentPassword: string;
188
+
189
+ /** The new password to set. */
190
+ newPassword: string;
191
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The details of a single Space.
3
+ *
4
+ * @public
5
+ */
6
+ export interface ISpace {
7
+ /** The rest id of the space. */
8
+ id: string;
9
+
10
+ /** The current state of the space. */
11
+ state?: string;
12
+
13
+ /** The title of the space. */
14
+ title?: string;
15
+
16
+ /** The media key of the space. */
17
+ mediaKey?: string;
18
+
19
+ /** The creation date of the space. */
20
+ createdAt?: string;
21
+
22
+ /** The scheduled start time of the space. */
23
+ scheduledStart?: string;
24
+
25
+ /** The actual start time of the space. */
26
+ startedAt?: string;
27
+
28
+ /** The end time of the space. */
29
+ endedAt?: string;
30
+
31
+ /** The time at which the space was last updated. */
32
+ updatedAt?: string;
33
+
34
+ /** The id of the user who created the space. */
35
+ creatorId?: string;
36
+
37
+ /** The conversation controls value for the space. */
38
+ conversationControls?: number;
39
+
40
+ /** Whether joining the space is disallowed. */
41
+ disallowJoin?: boolean;
42
+
43
+ /** Whether the space is for employees only. */
44
+ isEmployeeOnly?: boolean;
45
+
46
+ /** Whether the space is locked. */
47
+ isLocked?: boolean;
48
+
49
+ /** Whether the space is muted. */
50
+ isMuted?: boolean;
51
+
52
+ /** Whether clipping is available for the space. */
53
+ isSpaceAvailableForClipping?: boolean;
54
+
55
+ /** Whether replay is available for the space. */
56
+ isSpaceAvailableForReplay?: boolean;
57
+
58
+ /** Whether incognito is disabled for the space. */
59
+ noIncognito?: boolean;
60
+
61
+ /** The total live listeners count for the space. */
62
+ totalLiveListeners?: number;
63
+
64
+ /** The total replay watched count for the space. */
65
+ totalReplayWatched?: number;
66
+
67
+ /** The total participant count reported in the response. */
68
+ participantCount?: number;
69
+
70
+ /** Whether the authenticated user is subscribed to the space. */
71
+ isSubscribed?: boolean;
72
+
73
+ /** The participants information for the space. */
74
+ participants?: ISpaceParticipants;
75
+ }
76
+
77
+ /**
78
+ * The participants of a Space grouped by roles.
79
+ *
80
+ * @public
81
+ */
82
+ export interface ISpaceParticipants {
83
+ /** The total count of participants. */
84
+ total?: number;
85
+
86
+ /** The list of admins in the space. */
87
+ admins: ISpaceParticipant[];
88
+
89
+ /** The list of speakers in the space. */
90
+ speakers: ISpaceParticipant[];
91
+
92
+ /** The list of listeners in the space. */
93
+ listeners: ISpaceParticipant[];
94
+ }
95
+
96
+ /**
97
+ * The details of a single space participant.
98
+ *
99
+ * @public
100
+ */
101
+ export interface ISpaceParticipant {
102
+ /** The rest id of the user. */
103
+ id?: string;
104
+
105
+ /** The screen name of the user. */
106
+ screenName?: string;
107
+
108
+ /** The display name of the user. */
109
+ displayName?: string;
110
+
111
+ /** The avatar URL of the user. */
112
+ avatarUrl?: string;
113
+
114
+ /** Whether the user is verified. */
115
+ isVerified?: boolean;
116
+
117
+ /** Whether the user is muted by admins. */
118
+ isMutedByAdmin?: boolean;
119
+
120
+ /** Whether the user is muted by guests. */
121
+ isMutedByGuest?: boolean;
122
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The about profile details of a single user.
3
+ *
4
+ * @public
5
+ */
6
+ export interface IUserAbout {
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 url of the profile image. */
20
+ profileImage: string;
21
+
22
+ /** The shape of the profile image. */
23
+ profileImageShape?: string;
24
+
25
+ /** Whether the account is verified or not. */
26
+ isVerified: boolean;
27
+
28
+ /** Whether the account is protected. */
29
+ isProtected?: boolean;
30
+
31
+ /** About profile details of the user. */
32
+ aboutProfile?: IUserAboutProfile;
33
+
34
+ /** Verification metadata of the user. */
35
+ verificationInfo?: IUserAboutVerificationInfo;
36
+ }
37
+
38
+ /**
39
+ * About profile information for a user.
40
+ *
41
+ * @public
42
+ */
43
+ export interface IUserAboutProfile {
44
+ /** Whether the created country is accurate. */
45
+ createdCountryAccurate?: boolean;
46
+
47
+ /** The country where the account is based. */
48
+ accountBasedIn?: string;
49
+
50
+ /** Whether the location is accurate. */
51
+ locationAccurate?: boolean;
52
+
53
+ /** The help URL for verified accounts. */
54
+ learnMoreUrl?: string;
55
+
56
+ /** The source platform of the account. */
57
+ source?: string;
58
+
59
+ /** Username change metadata for the user. */
60
+ usernameChanges?: IUserAboutUsernameChanges;
61
+ }
62
+
63
+ /**
64
+ * Username change metadata for a user.
65
+ *
66
+ * @public
67
+ */
68
+ export interface IUserAboutUsernameChanges {
69
+ /** The number of username changes. */
70
+ count?: number;
71
+
72
+ /** The last time the username was changed. */
73
+ lastChangedAt?: string;
74
+ }
75
+
76
+ /**
77
+ * Verification metadata for a user.
78
+ *
79
+ * @public
80
+ */
81
+ export interface IUserAboutVerificationInfo {
82
+ /** Whether the user's identity is verified. */
83
+ isIdentityVerified?: boolean;
84
+
85
+ /** When the account was verified. */
86
+ verifiedSince?: string;
87
+ }
@@ -9,27 +9,47 @@ import { ITweet } from './Tweet';
9
9
  *
10
10
  * @public
11
11
  */
12
- export interface ISpace {
12
+ export interface IRawSpace {
13
13
  rest_id: string;
14
- state: string;
15
- title: string;
16
- media_key: string;
17
- created_at: number;
18
- started_at: number;
19
- ended_at: string;
20
- replay_start_time: number;
21
- updated_at: number;
22
- creator_results: IDataResult<IUser>;
23
- conversation_controls: number;
24
- disallow_join: boolean;
25
- is_employee_only: boolean;
26
- is_locked: boolean;
27
- is_muted: boolean;
28
- is_space_available_for_clipping: boolean;
29
- is_space_available_for_replay: boolean;
30
- narrow_cast_space_type: number;
31
- no_incognito: boolean;
32
- total_replay_watched: number;
33
- total_live_listeners: number;
34
- tweet_results: IDataResult<ITweet>;
14
+ state?: string;
15
+ title?: string;
16
+ media_key?: string;
17
+ content_type?: string;
18
+ created_at?: number | string;
19
+ scheduled_start?: number | string;
20
+ started_at?: number | string;
21
+ ended_at?: number | string;
22
+ replay_start_time?: number | string;
23
+ updated_at?: number | string;
24
+ creator_id?: string;
25
+ creator_results?: IDataResult<IUser>;
26
+ conversation_controls?: number;
27
+ disallow_join?: boolean;
28
+ is_employee_only?: boolean;
29
+ is_locked?: boolean;
30
+ is_muted?: boolean;
31
+ is_space_available_for_clipping?: boolean;
32
+ is_space_available_for_replay?: boolean;
33
+ narrow_cast_space_type?: number;
34
+ no_incognito?: boolean;
35
+ pending_admin_twitter_user_ids?: Array<{ rest_id?: string }>;
36
+ total_replay_watched?: number;
37
+ total_live_listeners?: number;
38
+ participant_count?: number;
39
+ subscriber_count?: number;
40
+ max_guest_sessions?: number;
41
+ max_admin_capacity?: number;
42
+ is_ticketed?: boolean | string;
43
+ lang?: string;
44
+ host_ids?: string[];
45
+ speaker_ids?: string[];
46
+ invited_user_ids?: string[];
47
+ topics?: IRawSpaceTopic[];
48
+ tweet_results?: IDataResult<ITweet>;
49
+ }
50
+
51
+ export interface IRawSpaceTopic {
52
+ id: string;
53
+ name: string;
54
+ description?: string;
35
55
  }
@@ -0,0 +1,57 @@
1
+ /* eslint-disable */
2
+
3
+ import { IRawSpace } from '../base/Space';
4
+
5
+ /**
6
+ * The raw data received when fetching the details of a given Space.
7
+ *
8
+ * @public
9
+ */
10
+ export interface IAudioSpaceByIdResponse {
11
+ data?: {
12
+ audioSpace?: IAudioSpace;
13
+ };
14
+ errors?: unknown[];
15
+ }
16
+
17
+ export interface IAudioSpace {
18
+ metadata?: IRawSpace;
19
+ participants?: IAudioSpaceParticipants;
20
+ sharings?: IAudioSpaceSharings;
21
+ is_subscribed?: boolean;
22
+ }
23
+
24
+ export interface IAudioSpaceParticipants {
25
+ total?: number;
26
+ admins?: IAudioSpaceParticipant[];
27
+ speakers?: IAudioSpaceParticipant[];
28
+ listeners?: IAudioSpaceParticipant[];
29
+ }
30
+
31
+ export interface IAudioSpaceParticipant {
32
+ periscope_user_id?: string;
33
+ start?: number | string;
34
+ twitter_screen_name?: string;
35
+ display_name?: string;
36
+ avatar_url?: string;
37
+ is_verified?: boolean;
38
+ is_muted_by_admin?: boolean;
39
+ is_muted_by_guest?: boolean;
40
+ user_results?: {
41
+ rest_id?: string;
42
+ result?: {
43
+ __typename?: string;
44
+ rest_id?: string;
45
+ is_blue_verified?: boolean;
46
+ verification?: {
47
+ verified_type?: string;
48
+ verified?: boolean;
49
+ };
50
+ };
51
+ };
52
+ }
53
+
54
+ export interface IAudioSpaceSharings {
55
+ items?: unknown[];
56
+ slice_info?: unknown;
57
+ }