twitterapi-io-client 1.0.1 → 1.0.3
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 +16 -7
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/resources/stream.d.ts +8 -0
- package/dist/resources/stream.js +34 -0
- package/dist/resources/users.js +4 -4
- package/dist/types/communities.d.ts +5 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/list.d.ts +2 -2
- package/dist/types/spaces.d.ts +1 -1
- package/dist/types/stream.d.ts +10 -0
- package/dist/types/stream.js +2 -0
- package/dist/types/trends.d.ts +1 -1
- package/dist/types/tweets.d.ts +7 -7
- package/dist/types/users.d.ts +8 -8
- package/package.json +12 -4
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
|
|
@@ -82,6 +86,13 @@ const client = new TwitterAPIIOClient({
|
|
|
82
86
|
| Get Article | `GET /twitter/article` | ✅ Supported | `client.tweets.getArticle(articleId)` |
|
|
83
87
|
| Advanced Search | `GET /twitter/search` | ✅ Supported | `client.tweets.searchTweets(query, queryType?, cursor?)` |
|
|
84
88
|
|
|
89
|
+
### ✅ Stream Endpoint
|
|
90
|
+
|
|
91
|
+
| Endpoint | Method | Status | Notes |
|
|
92
|
+
|----------|--------|--------|-------|
|
|
93
|
+
| Add User to Monitor | `POST /oapi/x_user_stream/add_user_to_monitor_tweet` | ✅ Supported | `client.stream.addUserToMonitor(xUserName)` |
|
|
94
|
+
| Remove User from Monitor | `POST /oapi/x_user_stream/remove_user_from_monitor_tweet` | ✅ Supported | `client.stream.removeUserFromMonitor(xUserName)` |
|
|
95
|
+
|
|
85
96
|
## Not Supported Endpoints
|
|
86
97
|
|
|
87
98
|
The following endpoint categories are **not yet implemented**:
|
|
@@ -111,11 +122,6 @@ The following endpoint categories are **not yet implemented**:
|
|
|
111
122
|
- `POST /oapi/webhook/filter/update` - Update Webhook/Websocket Tweet Filter Rule
|
|
112
123
|
- `DELETE /oapi/webhook/filter/delete` - Delete Webhook/Websocket Tweet Filter Rule
|
|
113
124
|
|
|
114
|
-
### ❌ Stream Endpoint
|
|
115
|
-
|
|
116
|
-
- `POST /oapi/stream/add` - Add a twitter user to monitor his tweets
|
|
117
|
-
- `POST /oapi/stream/remove` - Remove a user from monitor list
|
|
118
|
-
|
|
119
125
|
### ❌ Deprecated Endpoints
|
|
120
126
|
|
|
121
127
|
The following endpoints are marked as deprecated in the API documentation and are not implemented:
|
|
@@ -132,8 +138,8 @@ The following endpoints are marked as deprecated in the API documentation and ar
|
|
|
132
138
|
|
|
133
139
|
## Implementation Status Summary
|
|
134
140
|
|
|
135
|
-
- **Fully Supported**:
|
|
136
|
-
- **Not Implemented**: ~
|
|
141
|
+
- **Fully Supported**: 29 endpoints (10 User endpoints + 2 List endpoints + 1 My endpoint + 5 Communities endpoints + 1 Trend endpoint + 1 Spaces endpoint + 7 Tweet endpoints + 2 Stream endpoints)
|
|
142
|
+
- **Not Implemented**: ~14+ endpoints across multiple categories
|
|
137
143
|
|
|
138
144
|
## Contributing
|
|
139
145
|
|
|
@@ -143,3 +149,6 @@ Contributions are welcome! If you'd like to add support for additional endpoints
|
|
|
143
149
|
|
|
144
150
|
For detailed API documentation, visit: [https://docs.twitterapi.io](https://docs.twitterapi.io)
|
|
145
151
|
|
|
152
|
+
## Support the project
|
|
153
|
+
|
|
154
|
+
If you need to create your twitterapi-io account and you want to support this client to help me mantain it and make your implementation easier for you, you can do so by using this [affiliate link](https://twitterapi.io/?ref=jordi666).
|
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { CommunitiesApi } from "./resources/communities";
|
|
|
6
6
|
import { TrendsApi } from "./resources/trends";
|
|
7
7
|
import { SpacesApi } from "./resources/spaces";
|
|
8
8
|
import { TweetsApi } from "./resources/tweets";
|
|
9
|
+
import { StreamApi } from "./resources/stream";
|
|
9
10
|
export interface TwitterAPIIOClientOptions extends HttpClientOptions {
|
|
10
11
|
}
|
|
11
12
|
export declare class TwitterAPIIOClient {
|
|
@@ -16,5 +17,6 @@ export declare class TwitterAPIIOClient {
|
|
|
16
17
|
readonly trends: TrendsApi;
|
|
17
18
|
readonly spaces: SpacesApi;
|
|
18
19
|
readonly tweets: TweetsApi;
|
|
20
|
+
readonly stream: StreamApi;
|
|
19
21
|
constructor(options: TwitterAPIIOClientOptions);
|
|
20
22
|
}
|
package/dist/client.js
CHANGED
|
@@ -9,6 +9,7 @@ const communities_1 = require("./resources/communities");
|
|
|
9
9
|
const trends_1 = require("./resources/trends");
|
|
10
10
|
const spaces_1 = require("./resources/spaces");
|
|
11
11
|
const tweets_1 = require("./resources/tweets");
|
|
12
|
+
const stream_1 = require("./resources/stream");
|
|
12
13
|
class TwitterAPIIOClient {
|
|
13
14
|
users;
|
|
14
15
|
myEndpoint;
|
|
@@ -17,6 +18,7 @@ class TwitterAPIIOClient {
|
|
|
17
18
|
trends;
|
|
18
19
|
spaces;
|
|
19
20
|
tweets;
|
|
21
|
+
stream;
|
|
20
22
|
constructor(options) {
|
|
21
23
|
const http = new httpClient_1.HttpClient(options);
|
|
22
24
|
this.users = new users_1.UsersApi(http);
|
|
@@ -26,6 +28,7 @@ class TwitterAPIIOClient {
|
|
|
26
28
|
this.trends = new trends_1.TrendsApi(http);
|
|
27
29
|
this.spaces = new spaces_1.SpacesApi(http);
|
|
28
30
|
this.tweets = new tweets_1.TweetsApi(http);
|
|
31
|
+
this.stream = new stream_1.StreamApi(http);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
exports.TwitterAPIIOClient = TwitterAPIIOClient;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HttpClient } from "../httpClient";
|
|
2
|
+
import type { StreamResponse } from "../types/stream";
|
|
3
|
+
export declare class StreamApi {
|
|
4
|
+
private http;
|
|
5
|
+
constructor(http: HttpClient);
|
|
6
|
+
addUserToMonitor(xUserName: string): Promise<StreamResponse>;
|
|
7
|
+
removeUserFromMonitor(xUserName: string): Promise<StreamResponse>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamApi = void 0;
|
|
4
|
+
class StreamApi {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async addUserToMonitor(xUserName) {
|
|
10
|
+
const body = {
|
|
11
|
+
x_user_name: xUserName,
|
|
12
|
+
};
|
|
13
|
+
return this.http.request("/oapi/x_user_stream/add_user_to_monitor_tweet", {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
},
|
|
18
|
+
body: JSON.stringify(body),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async removeUserFromMonitor(xUserName) {
|
|
22
|
+
const body = {
|
|
23
|
+
x_user_name: xUserName,
|
|
24
|
+
};
|
|
25
|
+
return this.http.request("/oapi/x_user_stream/remove_user_from_monitor_tweet", {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify(body),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.StreamApi = StreamApi;
|
package/dist/resources/users.js
CHANGED
|
@@ -50,7 +50,7 @@ class UsersApi {
|
|
|
50
50
|
has_next_page: data.has_next_page ?? false,
|
|
51
51
|
next_cursor: data.next_cursor ?? "",
|
|
52
52
|
status: data.status || response.status || "success",
|
|
53
|
-
|
|
53
|
+
msg: data.msg || response.msg
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
// If data doesn't have tweets, return empty structure (API might be returning wrong data)
|
|
@@ -59,7 +59,7 @@ class UsersApi {
|
|
|
59
59
|
has_next_page: false,
|
|
60
60
|
next_cursor: "",
|
|
61
61
|
status: response.status || "success",
|
|
62
|
-
|
|
62
|
+
msg: response.msg
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
return response;
|
|
@@ -99,7 +99,7 @@ class UsersApi {
|
|
|
99
99
|
has_next_page: data.has_next_page ?? false,
|
|
100
100
|
next_cursor: data.next_cursor ?? "",
|
|
101
101
|
status: data.status || response.status || "success",
|
|
102
|
-
|
|
102
|
+
msg: data.msg || response.msg
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
// If data doesn't have tweets, return empty structure
|
|
@@ -108,7 +108,7 @@ class UsersApi {
|
|
|
108
108
|
has_next_page: false,
|
|
109
109
|
next_cursor: "",
|
|
110
110
|
status: response.status || "success",
|
|
111
|
-
|
|
111
|
+
msg: response.msg
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
42
|
+
msg: string;
|
|
43
43
|
}
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/dist/types/list.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ export interface ListFollowersResponse {
|
|
|
4
4
|
has_next_page: boolean;
|
|
5
5
|
next_cursor: string;
|
|
6
6
|
status: string;
|
|
7
|
-
msg
|
|
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
|
|
14
|
+
msg: string;
|
|
15
15
|
}
|
package/dist/types/spaces.d.ts
CHANGED
package/dist/types/trends.d.ts
CHANGED
package/dist/types/tweets.d.ts
CHANGED
|
@@ -44,33 +44,33 @@ export interface Tweet {
|
|
|
44
44
|
export interface TweetsByIdsResponse {
|
|
45
45
|
tweets: Tweet[];
|
|
46
46
|
status: string;
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
+
msg: string;
|
|
69
69
|
}
|
|
70
70
|
export interface TweetThreadContextResponse {
|
|
71
71
|
tweets: Tweet[];
|
|
72
72
|
status: string;
|
|
73
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
+
msg: string;
|
|
94
94
|
}
|
package/dist/types/users.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface UserInfoResponse {
|
|
|
27
27
|
isAutomated: boolean;
|
|
28
28
|
automatedBy: string;
|
|
29
29
|
unavailable?: boolean;
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
128
|
+
msg: string;
|
|
129
129
|
}
|
|
130
130
|
export interface FollowRelationshipResponse {
|
|
131
131
|
data: {
|
|
@@ -133,19 +133,19 @@ export interface FollowRelationshipResponse {
|
|
|
133
133
|
followed_by: boolean;
|
|
134
134
|
};
|
|
135
135
|
status: string;
|
|
136
|
-
|
|
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
|
|
143
|
+
msg: string;
|
|
144
144
|
}
|
|
145
145
|
export interface UserVerifiedFollowersResponse {
|
|
146
146
|
followers: UserInfoResponse[];
|
|
147
147
|
status: string;
|
|
148
|
-
|
|
148
|
+
msg: string;
|
|
149
149
|
}
|
|
150
150
|
export interface BatchUserInfoByUserIdsResponse {
|
|
151
151
|
users: UserInfoResponse[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twitterapi-io-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A TypeScript client library for the TwitterAPI.io API",
|
|
5
5
|
"author": "jorvixsky",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,15 @@
|
|
|
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",
|
|
33
|
+
"test:stream": "vitest run test/stream.test.ts"
|
|
26
34
|
},
|
|
27
35
|
"devDependencies": {
|
|
28
36
|
"@types/node": "24.10.0",
|
|
@@ -30,6 +38,6 @@
|
|
|
30
38
|
"vitest": "4.0.15"
|
|
31
39
|
},
|
|
32
40
|
"repository": {
|
|
33
|
-
"url": "https://github.com/jorvixsky/twitterapi-io-client"
|
|
41
|
+
"url": "git+https://github.com/jorvixsky/twitterapi-io-client.git"
|
|
34
42
|
}
|
|
35
|
-
}
|
|
43
|
+
}
|