twitterapi-io-client 1.0.0 → 1.0.2

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 CHANGED
@@ -10,12 +10,16 @@ npm install twitterapi-io-client
10
10
 
11
11
  ## Usage
12
12
 
13
+ ### Setup
14
+
13
15
  ```typescript
14
16
  import { TwitterAPIIOClient } from 'twitterapi-io-client';
15
17
 
16
18
  const client = new TwitterAPIIOClient({
17
19
  apiKey: 'your-api-key'
18
20
  });
21
+
22
+ const accountInfo = await client.getUserProfileAbout("jorvixsky")
19
23
  ```
20
24
 
21
25
  ## Supported Endpoints
@@ -25,6 +29,7 @@ const client = new TwitterAPIIOClient({
25
29
  | Endpoint | Method | Status | Notes |
26
30
  |----------|--------|--------|-------|
27
31
  | Get User Profile About | `GET /twitter/user_about` | ✅ Supported | `client.users.getUserProfileAbout(userName)` |
32
+ | Batch Get User Info By UserIds | `GET /twitter/user/batch_info_by_ids` | ✅ Supported | `client.users.batchGetUserInfoByUserIds(userIds)` |
28
33
  | Get User Info | `GET /twitter/user/info` | ✅ Supported | `client.users.getUserInfo(userName)` |
29
34
  | Get User Last Tweets | `GET /twitter/user/latest_tweets` | ✅ Supported | `client.users.getUserLatestTweets(userId?, userName?, cursor?, pageSize?, includeReplies?)` |
30
35
  | Get User Followers | `GET /twitter/user/followers` | ✅ Supported | `client.users.getUserFollowers(userName, cursor?, pageSize?)` |
@@ -33,7 +38,6 @@ const client = new TwitterAPIIOClient({
33
38
  | Check Follow Relationship | `GET /twitter/user/check_follow_relationship` | ✅ Supported | `client.users.checkFollowRelationship(sourceUserName, targetUserName)` |
34
39
  | Search user by keyword | `GET /twitter/user/search` | ✅ Supported | `client.users.searchUserByKeyword(query, cursor?)` |
35
40
  | Get User Verified Followers | `GET /twitter/user/verifiedFollowers` | ✅ Supported | `client.users.getUserVerifiedFollowers(userId, cursor?)` |
36
- | Batch Get User Info By UserIds | `GET /twitter/user/batch` | ❌ Not Supported | - |
37
41
 
38
42
  ### ✅ List Endpoint
39
43
 
@@ -132,7 +136,7 @@ The following endpoints are marked as deprecated in the API documentation and ar
132
136
 
133
137
  ## Implementation Status Summary
134
138
 
135
- - **Fully Supported**: 26 endpoints (9 User endpoints + 2 List endpoints + 1 My endpoint + 5 Communities endpoints + 1 Trend endpoint + 1 Spaces endpoint + 7 Tweet endpoints)
139
+ - **Fully Supported**: 27 endpoints (10 User endpoints + 2 List endpoints + 1 My endpoint + 5 Communities endpoints + 1 Trend endpoint + 1 Spaces endpoint + 7 Tweet endpoints)
136
140
  - **Not Implemented**: ~16+ endpoints across multiple categories
137
141
 
138
142
  ## Contributing
@@ -1,9 +1,10 @@
1
1
  import type { HttpClient } from "../httpClient";
2
- import type { FollowRelationshipResponse, SearchUserByKeywordResponse, UserFollowersResponse, UserFollowingsResponse, UserInfoResponse, UserLatestTweetsResponse, UserMentionsResponse, UserProfileAboutResponse, UserVerifiedFollowersResponse } from "../types/users";
2
+ import type { BatchUserInfoByUserIdsResponse, FollowRelationshipResponse, SearchUserByKeywordResponse, UserFollowersResponse, UserFollowingsResponse, UserInfoResponse, UserLatestTweetsResponse, UserMentionsResponse, UserProfileAboutResponse, UserVerifiedFollowersResponse } from "../types/users";
3
3
  export declare class UsersApi {
4
4
  private http;
5
5
  constructor(http: HttpClient);
6
6
  getUserProfileAbout(userName: string): Promise<UserProfileAboutResponse>;
7
+ batchGetUserInfoByUserIds(userIds: string[]): Promise<BatchUserInfoByUserIdsResponse>;
7
8
  getUserInfo(userName: string): Promise<UserInfoResponse>;
8
9
  getUserLatestTweets(userId?: string, userName?: string, cursor?: string, pageSize?: number, includeReplies?: boolean): Promise<UserLatestTweetsResponse>;
9
10
  getUserFollowers(userName: string, cursor?: string, pageSize?: number): Promise<UserFollowersResponse>;
@@ -11,6 +11,11 @@ class UsersApi {
11
11
  const response = await this.http.request(`/twitter/user_about?${params.toString()}`);
12
12
  return response;
13
13
  }
14
+ async batchGetUserInfoByUserIds(userIds) {
15
+ const params = new URLSearchParams({ userIds: userIds.join(",") });
16
+ const response = await this.http.request(`/twitter/user/batch_info_by_ids?${params.toString()}`);
17
+ return response;
18
+ }
14
19
  async getUserInfo(userName) {
15
20
  const params = new URLSearchParams({ userName });
16
21
  const response = await this.http.request(`/twitter/user/info?${params.toString()}`);
@@ -45,7 +50,7 @@ class UsersApi {
45
50
  has_next_page: data.has_next_page ?? false,
46
51
  next_cursor: data.next_cursor ?? "",
47
52
  status: data.status || response.status || "success",
48
- message: data.message || response.msg
53
+ msg: data.msg || response.msg
49
54
  };
50
55
  }
51
56
  // If data doesn't have tweets, return empty structure (API might be returning wrong data)
@@ -54,7 +59,7 @@ class UsersApi {
54
59
  has_next_page: false,
55
60
  next_cursor: "",
56
61
  status: response.status || "success",
57
- message: response.msg
62
+ msg: response.msg
58
63
  };
59
64
  }
60
65
  return response;
@@ -94,7 +99,7 @@ class UsersApi {
94
99
  has_next_page: data.has_next_page ?? false,
95
100
  next_cursor: data.next_cursor ?? "",
96
101
  status: data.status || response.status || "success",
97
- message: data.message || response.msg
102
+ msg: data.msg || response.msg
98
103
  };
99
104
  }
100
105
  // If data doesn't have tweets, return empty structure
@@ -103,7 +108,7 @@ class UsersApi {
103
108
  has_next_page: false,
104
109
  next_cursor: "",
105
110
  status: response.status || "success",
106
- message: response.msg
111
+ msg: response.msg
107
112
  };
108
113
  }
109
114
  return response;
@@ -11,33 +11,33 @@ export interface CommunityInfoResponse {
11
11
  banner_image?: string;
12
12
  profile_image?: string;
13
13
  status: string;
14
- message?: string;
14
+ msg: string;
15
15
  }
16
16
  export interface CommunityMembersResponse {
17
17
  members: UserInfoResponse[];
18
18
  has_next_page: boolean;
19
19
  next_cursor: string;
20
20
  status: string;
21
- msg?: string;
21
+ msg: string;
22
22
  }
23
23
  export interface CommunityModeratorsResponse {
24
24
  moderators: UserInfoResponse[];
25
25
  has_next_page: boolean;
26
26
  next_cursor: string;
27
27
  status: string;
28
- msg?: string;
28
+ msg: string;
29
29
  }
30
30
  export interface CommunityTweetsResponse {
31
31
  tweets: Tweet[];
32
32
  has_next_page: boolean;
33
33
  next_cursor: string;
34
34
  status: string;
35
- message?: string;
35
+ msg: string;
36
36
  }
37
37
  export interface CommunitySearchResponse {
38
38
  tweets: Tweet[];
39
39
  has_next_page: boolean;
40
40
  next_cursor: string;
41
41
  status: string;
42
- message?: string;
42
+ msg: string;
43
43
  }
@@ -4,12 +4,12 @@ export interface ListFollowersResponse {
4
4
  has_next_page: boolean;
5
5
  next_cursor: string;
6
6
  status: string;
7
- msg?: string;
7
+ msg: string;
8
8
  }
9
9
  export interface ListMembersResponse {
10
10
  members: UserInfoResponse[];
11
11
  has_next_page: boolean;
12
12
  next_cursor: string;
13
13
  status: string;
14
- msg?: string;
14
+ msg: string;
15
15
  }
@@ -19,5 +19,5 @@ export interface SpaceDetailResponse {
19
19
  hosts?: UserInfoResponse[];
20
20
  speakers?: UserInfoResponse[];
21
21
  status: string;
22
- message?: string;
22
+ msg: string;
23
23
  }
@@ -15,5 +15,5 @@ export interface TrendsResponse {
15
15
  created_at: string;
16
16
  locations: TrendLocation[];
17
17
  status: string;
18
- message?: string;
18
+ msg: string;
19
19
  }
@@ -44,33 +44,33 @@ export interface Tweet {
44
44
  export interface TweetsByIdsResponse {
45
45
  tweets: Tweet[];
46
46
  status: string;
47
- message?: string;
47
+ msg: string;
48
48
  }
49
49
  export interface TweetRepliesResponse {
50
50
  tweets: Tweet[];
51
51
  has_next_page: boolean;
52
52
  next_cursor: string;
53
53
  status: string;
54
- message?: string;
54
+ msg: string;
55
55
  }
56
56
  export interface TweetQuotationsResponse {
57
57
  tweets: Tweet[];
58
58
  has_next_page: boolean;
59
59
  next_cursor: string;
60
60
  status: string;
61
- message?: string;
61
+ msg: string;
62
62
  }
63
63
  export interface TweetRetweetersResponse {
64
64
  retweeters: UserInfoResponse[];
65
65
  has_next_page: boolean;
66
66
  next_cursor: string;
67
67
  status: string;
68
- message?: string;
68
+ msg: string;
69
69
  }
70
70
  export interface TweetThreadContextResponse {
71
71
  tweets: Tweet[];
72
72
  status: string;
73
- message?: string;
73
+ msg: string;
74
74
  }
75
75
  export interface ArticleResponse {
76
76
  article: {
@@ -83,12 +83,12 @@ export interface ArticleResponse {
83
83
  content?: string;
84
84
  };
85
85
  status: string;
86
- message?: string;
86
+ msg: string;
87
87
  }
88
88
  export interface SearchTweetsResponse {
89
89
  tweets: Tweet[];
90
90
  has_next_page: boolean;
91
91
  next_cursor: string;
92
92
  status: string;
93
- message?: string;
93
+ msg: string;
94
94
  }
@@ -27,7 +27,7 @@ export interface UserInfoResponse {
27
27
  isAutomated: boolean;
28
28
  automatedBy: string;
29
29
  unavailable?: boolean;
30
- message?: string;
30
+ msg: string;
31
31
  unavailableReason?: string;
32
32
  profile_bio: {
33
33
  description: string;
@@ -56,14 +56,14 @@ export interface UserFollowersResponse {
56
56
  has_next_page: boolean;
57
57
  next_cursor: string;
58
58
  status: string;
59
- message?: string;
59
+ msg: string;
60
60
  }
61
61
  export interface UserFollowingsResponse {
62
62
  followings: UserInfoResponse[];
63
63
  has_next_page: boolean;
64
64
  next_cursor: string;
65
65
  status: string;
66
- message?: string;
66
+ msg: string;
67
67
  }
68
68
  export interface UserProfileAboutResponse {
69
69
  data: {
@@ -118,14 +118,14 @@ export interface UserLatestTweetsResponse {
118
118
  has_next_page: boolean;
119
119
  next_cursor: string;
120
120
  status: string;
121
- message?: string;
121
+ msg: string;
122
122
  }
123
123
  export interface UserMentionsResponse {
124
124
  tweets: Tweet[];
125
125
  has_next_page: boolean;
126
126
  next_cursor: string;
127
127
  status: string;
128
- message?: string;
128
+ msg: string;
129
129
  }
130
130
  export interface FollowRelationshipResponse {
131
131
  data: {
@@ -133,17 +133,22 @@ export interface FollowRelationshipResponse {
133
133
  followed_by: boolean;
134
134
  };
135
135
  status: string;
136
- message?: string;
136
+ msg: string;
137
137
  }
138
138
  export interface SearchUserByKeywordResponse {
139
139
  users: UserInfoResponse[];
140
140
  has_next_page: boolean;
141
141
  next_cursor: string;
142
142
  status: string;
143
- msg?: string;
143
+ msg: string;
144
144
  }
145
145
  export interface UserVerifiedFollowersResponse {
146
146
  followers: UserInfoResponse[];
147
147
  status: string;
148
- message?: string;
148
+ msg: string;
149
+ }
150
+ export interface BatchUserInfoByUserIdsResponse {
151
+ users: UserInfoResponse[];
152
+ status: string;
153
+ msg: string;
149
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twitterapi-io-client",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A TypeScript client library for the TwitterAPI.io API",
5
5
  "author": "jorvixsky",
6
6
  "license": "MIT",
@@ -22,11 +22,21 @@
22
22
  "build": "tsc -p tsconfig.json",
23
23
  "prepublishOnly": "npm run build && npm test",
24
24
  "test": "vitest run",
25
- "test:watch": "vitest"
25
+ "test:watch": "vitest",
26
+ "test:environment": "vitest run test/environment.test.ts",
27
+ "test:users": "vitest run test/users.test.ts",
28
+ "test:list": "vitest run test/list.test.ts",
29
+ "test:communities": "vitest run test/communities.test.ts",
30
+ "test:trends": "vitest run test/trends.test.ts",
31
+ "test:spaces": "vitest run test/spaces.test.ts",
32
+ "test:tweets": "vitest run test/tweets.test.ts"
26
33
  },
27
34
  "devDependencies": {
28
35
  "@types/node": "24.10.0",
29
36
  "typescript": "5.9.3",
30
37
  "vitest": "4.0.15"
38
+ },
39
+ "repository": {
40
+ "url": "git+https://github.com/jorvixsky/twitterapi-io-client.git"
31
41
  }
32
- }
42
+ }