jerrysniffs-node-sdk 1.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.
- package/README.md +179 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +48 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/call-logs.d.ts +14 -0
- package/dist/resources/call-logs.d.ts.map +1 -0
- package/dist/resources/call-logs.js +25 -0
- package/dist/resources/call-logs.js.map +1 -0
- package/dist/resources/reddit.d.ts +15 -0
- package/dist/resources/reddit.d.ts.map +1 -0
- package/dist/resources/reddit.js +22 -0
- package/dist/resources/reddit.js.map +1 -0
- package/dist/resources/search.d.ts +15 -0
- package/dist/resources/search.d.ts.map +1 -0
- package/dist/resources/search.js +19 -0
- package/dist/resources/search.js.map +1 -0
- package/dist/resources/twitter.d.ts +22 -0
- package/dist/resources/twitter.d.ts.map +1 -0
- package/dist/resources/twitter.js +31 -0
- package/dist/resources/twitter.js.map +1 -0
- package/dist/resources/url-to-markdown.d.ts +16 -0
- package/dist/resources/url-to-markdown.d.ts.map +1 -0
- package/dist/resources/url-to-markdown.js +20 -0
- package/dist/resources/url-to-markdown.js.map +1 -0
- package/dist/twitter-response-types.d.ts +371 -0
- package/dist/twitter-response-types.d.ts.map +1 -0
- package/dist/twitter-response-types.js +29 -0
- package/dist/twitter-response-types.js.map +1 -0
- package/dist/types.d.ts +153 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# jerrysniffs-node-sdk
|
|
2
|
+
|
|
3
|
+
Official Node.js SDK for the [JerrySniffs](https://jerrysniffs.online) API.
|
|
4
|
+
|
|
5
|
+
Provides typed access to web search, Twitter/X search & tweet lookup, Reddit post search, URL-to-Markdown conversion, and API call logs.
|
|
6
|
+
|
|
7
|
+
For detailed docs, refer [JerrySniffs Docs](https://jerrysniffs.online/docs)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install jerrysniffs-node-sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import JerrySniffs from "jerrysniffs-node-sdk";
|
|
19
|
+
|
|
20
|
+
const client = new JerrySniffs({ apiKey: "YOUR_API_TOKEN" });
|
|
21
|
+
|
|
22
|
+
// Web search
|
|
23
|
+
const results = await client.search.search("site:docs.stripe.com webhooks");
|
|
24
|
+
console.log(results.urls);
|
|
25
|
+
|
|
26
|
+
// Twitter search
|
|
27
|
+
const tweets = await client.twitter.search("openai agents", { limit: 5 });
|
|
28
|
+
console.log(tweets.tweets);
|
|
29
|
+
|
|
30
|
+
// Tweet lookup
|
|
31
|
+
const tweet = await client.twitter.lookup("1234567890123456789");
|
|
32
|
+
console.log(tweet.tweet);
|
|
33
|
+
|
|
34
|
+
// Reddit search
|
|
35
|
+
const posts = await client.reddit.searchPosts("best docs search api", {
|
|
36
|
+
subreddit: "SaaS",
|
|
37
|
+
sort: "top",
|
|
38
|
+
time: "month",
|
|
39
|
+
});
|
|
40
|
+
console.log(posts.posts);
|
|
41
|
+
|
|
42
|
+
// URL to Markdown
|
|
43
|
+
const md = await client.urlToMarkdown.convert("https://example.com");
|
|
44
|
+
console.log(md.markdown);
|
|
45
|
+
|
|
46
|
+
// Call logs
|
|
47
|
+
const logs = await client.callLogs.list({ page: 1, limit: 10 });
|
|
48
|
+
console.log(logs.rows);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Authentication
|
|
52
|
+
|
|
53
|
+
All requests use an API token passed via `Authorization: Bearer`. Create a token in the JerrySniffs dashboard or via the `/api/v1/auth/api-tokens` endpoint.
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const client = new JerrySniffs({
|
|
59
|
+
apiKey: "YOUR_API_TOKEN", // required
|
|
60
|
+
baseUrl: "https://jerrysniffs.online", // optional, this is the default
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API Reference
|
|
65
|
+
|
|
66
|
+
### `client.search.search(query, options?)`
|
|
67
|
+
|
|
68
|
+
| Param | Type | Description |
|
|
69
|
+
|-------|------|-------------|
|
|
70
|
+
| `query` | `string` | Search query (required) |
|
|
71
|
+
| `options.limit` | `number` | Max results (1–50) |
|
|
72
|
+
| `options.country` | `string` | Country code, e.g. `"US"` |
|
|
73
|
+
| `options.page` | `number` | Page number (1-based) |
|
|
74
|
+
| `options.start` | `number` | Result offset |
|
|
75
|
+
| `options.tbs` | `string` | Time-based search filter, e.g. `"qdr:w"` |
|
|
76
|
+
|
|
77
|
+
Returns `SearchResponse`: `{ ok, query, urls, count }`
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### `client.twitter.search(query, options?)`
|
|
82
|
+
|
|
83
|
+
| Param | Type | Description |
|
|
84
|
+
|-------|------|-------------|
|
|
85
|
+
| `query` | `string` | Search query (required) |
|
|
86
|
+
| `options.searchType` | `"Top" \| "Latest"` | Result type |
|
|
87
|
+
| `options.limit` | `number` | Max results (1–50) |
|
|
88
|
+
|
|
89
|
+
Returns `TwitterSearchResponse`: `{ ok, tweets }` where each tweet is an `ApiTweet`.
|
|
90
|
+
|
|
91
|
+
### `client.twitter.lookup(id)`
|
|
92
|
+
|
|
93
|
+
| Param | Type | Description |
|
|
94
|
+
|-------|------|-------------|
|
|
95
|
+
| `id` | `string` | Numeric tweet ID (required) |
|
|
96
|
+
|
|
97
|
+
Returns `TweetLookupResponse`: `{ ok, tweet }` where tweet is an `ApiTweet`.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### `client.reddit.searchPosts(query, options?)`
|
|
102
|
+
|
|
103
|
+
| Param | Type | Description |
|
|
104
|
+
|-------|------|-------------|
|
|
105
|
+
| `query` | `string` | Search query (required) |
|
|
106
|
+
| `options.subreddit` | `string` | Restrict to subreddit |
|
|
107
|
+
| `options.sort` | `"relevance" \| "hot" \| "top" \| "new" \| "comments"` | Sort order |
|
|
108
|
+
| `options.time` | `"hour" \| "day" \| "week" \| "month" \| "year" \| "all"` | Time range |
|
|
109
|
+
| `options.limit` | `number` | Max results (1–50) |
|
|
110
|
+
|
|
111
|
+
Returns `RedditSearchPostsResponse`: `{ ok, posts }`
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### `client.urlToMarkdown.convert(url, options?)`
|
|
116
|
+
|
|
117
|
+
| Param | Type | Description |
|
|
118
|
+
|-------|------|-------------|
|
|
119
|
+
| `url` | `string` | URL to convert (required). Supports HTML, plain text, PDF, DOC, DOCX |
|
|
120
|
+
| `options.proxy` | `string` | Proxy URL, e.g. `"http://user:pass@proxy:8080"` |
|
|
121
|
+
|
|
122
|
+
Returns `UrlToMarkdownResponse`: `{ ok, url, markdown, is_proxy_used }`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### `client.callLogs.list(options?)`
|
|
127
|
+
|
|
128
|
+
| Param | Type | Description |
|
|
129
|
+
|-------|------|-------------|
|
|
130
|
+
| `options.q` | `string` | Full-text search across logs |
|
|
131
|
+
| `options.endpoint` | `string` | Filter by endpoint name |
|
|
132
|
+
| `options.status` | `"success" \| "failure"` | Filter by status |
|
|
133
|
+
| `options.page` | `number` | Page number (1-based) |
|
|
134
|
+
| `options.limit` | `number` | Page size |
|
|
135
|
+
| `options.sort_by` | `"created_at" \| "endpoint" \| "status" \| "http_code" \| "duration_ms"` | Sort column |
|
|
136
|
+
| `options.sort_dir` | `"asc" \| "desc"` | Sort direction |
|
|
137
|
+
|
|
138
|
+
Returns `CallLogsResponse`: `{ rows, page, limit, total, totalPages }`
|
|
139
|
+
|
|
140
|
+
## Error handling
|
|
141
|
+
|
|
142
|
+
The SDK throws `ApiError` for non-2xx responses:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { ApiError } from "jerrysniffs-node-sdk";
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
await client.search.search("test");
|
|
149
|
+
} catch (err) {
|
|
150
|
+
if (err instanceof ApiError) {
|
|
151
|
+
console.error(err.status); // HTTP status code
|
|
152
|
+
console.error(err.body); // Parsed response body
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## TypeScript types
|
|
158
|
+
|
|
159
|
+
All request options and response types are exported:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import type {
|
|
163
|
+
SearchResponse,
|
|
164
|
+
ApiTweet,
|
|
165
|
+
ApiTweetAuthor,
|
|
166
|
+
ApiTweetMetrics,
|
|
167
|
+
RedditPost,
|
|
168
|
+
UrlToMarkdownResponse,
|
|
169
|
+
CallLogsResponse,
|
|
170
|
+
Tweet,
|
|
171
|
+
TweetAuthor,
|
|
172
|
+
TweetMedia,
|
|
173
|
+
TweetPublicMetrics,
|
|
174
|
+
} from "jerrysniffs-node-sdk";
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
ISC
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { JerrySniffsConfig } from "./types.js";
|
|
2
|
+
export declare class ApiError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
body: unknown;
|
|
5
|
+
constructor(message: string, status: number, body: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare class HttpClient {
|
|
8
|
+
private apiKey;
|
|
9
|
+
private baseUrl;
|
|
10
|
+
constructor(config: JerrySniffsConfig);
|
|
11
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
12
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
13
|
+
get<T>(path: string): Promise<T>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,iBAAiB;IAQ/B,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC;IAgCb,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAGjC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const DEFAULT_BASE_URL = "https://jerrysniffs.online";
|
|
2
|
+
export class ApiError extends Error {
|
|
3
|
+
constructor(message, status, body) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = "ApiError";
|
|
6
|
+
this.status = status;
|
|
7
|
+
this.body = body;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class HttpClient {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
if (!config.apiKey) {
|
|
13
|
+
throw new Error("apiKey is required");
|
|
14
|
+
}
|
|
15
|
+
this.apiKey = config.apiKey;
|
|
16
|
+
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
17
|
+
}
|
|
18
|
+
async request(method, path, body) {
|
|
19
|
+
const url = `${this.baseUrl}${path}`;
|
|
20
|
+
const headers = {
|
|
21
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
22
|
+
};
|
|
23
|
+
const init = { method, headers };
|
|
24
|
+
if (body !== undefined) {
|
|
25
|
+
headers["Content-Type"] = "application/json";
|
|
26
|
+
init.body = JSON.stringify(body);
|
|
27
|
+
}
|
|
28
|
+
const res = await fetch(url, init);
|
|
29
|
+
if (!res.ok) {
|
|
30
|
+
let errorBody;
|
|
31
|
+
try {
|
|
32
|
+
errorBody = await res.json();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
errorBody = await res.text().catch(() => null);
|
|
36
|
+
}
|
|
37
|
+
throw new ApiError(`JerrySniffs API error: ${res.status} ${res.statusText}`, res.status, errorBody);
|
|
38
|
+
}
|
|
39
|
+
return res.json();
|
|
40
|
+
}
|
|
41
|
+
post(path, body) {
|
|
42
|
+
return this.request("POST", path, body);
|
|
43
|
+
}
|
|
44
|
+
get(path) {
|
|
45
|
+
return this.request("GET", path);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAEtD,MAAM,OAAO,QAAS,SAAQ,KAAK;IAIjC,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED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,UAAU,EAAE,EACxD,GAAG,CAAC,MAAM,EACV,SAAS,CACV,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAC;IAClC,CAAC;IAED,IAAI,CAAI,IAAY,EAAE,IAAc;QAClC,OAAO,IAAI,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,GAAG,CAAI,IAAY;QACjB,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Search } from "./resources/search.js";
|
|
2
|
+
import { Twitter } from "./resources/twitter.js";
|
|
3
|
+
import { Reddit } from "./resources/reddit.js";
|
|
4
|
+
import { UrlToMarkdown } from "./resources/url-to-markdown.js";
|
|
5
|
+
import { CallLogs } from "./resources/call-logs.js";
|
|
6
|
+
import type { JerrySniffsConfig } from "./types.js";
|
|
7
|
+
export declare class JerrySniffs {
|
|
8
|
+
readonly search: Search;
|
|
9
|
+
readonly twitter: Twitter;
|
|
10
|
+
readonly reddit: Reddit;
|
|
11
|
+
readonly urlToMarkdown: UrlToMarkdown;
|
|
12
|
+
readonly callLogs: CallLogs;
|
|
13
|
+
constructor(config: JerrySniffsConfig);
|
|
14
|
+
}
|
|
15
|
+
export { ApiError } from "./client.js";
|
|
16
|
+
export type { JerrySniffsConfig, SearchResponse, SearchOptions, UrlToMarkdownResponse, UrlToMarkdownOptions, TwitterSearchResponse, TwitterSearchOptions, TweetLookupResponse, RedditSearchPostsResponse, RedditSearchPostsOptions, CallLogsResponse, CallLogsOptions, CallLog, ApiTweet, ApiTweetAuthor, ApiTweetMetrics, ApiTweetMedia, ApiMediaVariant, RedditPost, RedditAuthorInfo, RedditSubreddit, } from "./types.js";
|
|
17
|
+
export type { LanguageCode, SnowflakeId, TwitterDateString, ISODateString, MediaType, ContentType, ReplySettings, TweetType, MediaVariant, TweetMedia, UrlEntity, HashtagEntity, MentionEntity, CashtagEntity, AnnotationEntity, TweetEntities, TweetAuthor, TweetPublicMetrics, TweetNonPublicMetrics, TweetOrganicMetrics, TweetPromotedMetrics, Coordinates, BoundingBox, TweetPlace, ReferencedTweet, ContextAnnotation, PollOption, TweetPoll, WithheldInfo, Tweet, TwitterApiResponse, VideoMedia, PhotoMedia, AnimatedGifMedia, } from "./types.js";
|
|
18
|
+
export { isVideoMedia, isPhotoMedia, isAnimatedGif, getHighestQualityVariant, } from "./types.js";
|
|
19
|
+
export default JerrySniffs;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,qBAAa,WAAW;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBAEhB,MAAM,EAAE,iBAAiB;CAQtC;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,cAAc,EACd,eAAe,EACf,aAAa,EACb,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,eAAe,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HttpClient } from "./client.js";
|
|
2
|
+
import { Search } from "./resources/search.js";
|
|
3
|
+
import { Twitter } from "./resources/twitter.js";
|
|
4
|
+
import { Reddit } from "./resources/reddit.js";
|
|
5
|
+
import { UrlToMarkdown } from "./resources/url-to-markdown.js";
|
|
6
|
+
import { CallLogs } from "./resources/call-logs.js";
|
|
7
|
+
export class JerrySniffs {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
const client = new HttpClient(config);
|
|
10
|
+
this.search = new Search(client);
|
|
11
|
+
this.twitter = new Twitter(client);
|
|
12
|
+
this.reddit = new Reddit(client);
|
|
13
|
+
this.urlToMarkdown = new UrlToMarkdown(client);
|
|
14
|
+
this.callLogs = new CallLogs(client);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { ApiError } from "./client.js";
|
|
18
|
+
export { isVideoMedia, isPhotoMedia, isAnimatedGif, getHighestQualityVariant, } from "./types.js";
|
|
19
|
+
export default JerrySniffs;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,MAAM,OAAO,WAAW;IAOtB,YAAY,MAAyB;QACnC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACF;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA+DvC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HttpClient } from "../client.js";
|
|
2
|
+
import type { CallLogsResponse, CallLogsOptions } from "../types.js";
|
|
3
|
+
export declare class CallLogs {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Search the authenticated user's API invocation logs.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Optional filters: q, endpoint, status, page, limit, sort_by, sort_dir
|
|
10
|
+
* @returns Paginated call log results
|
|
11
|
+
*/
|
|
12
|
+
list(options?: CallLogsOptions): Promise<CallLogsResponse>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=call-logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-logs.d.ts","sourceRoot":"","sources":["../../src/resources/call-logs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErE,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;OAKG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAajE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class CallLogs {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Search the authenticated user's API invocation logs.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Optional filters: q, endpoint, status, page, limit, sort_by, sort_dir
|
|
9
|
+
* @returns Paginated call log results
|
|
10
|
+
*/
|
|
11
|
+
async list(options) {
|
|
12
|
+
const params = new URLSearchParams();
|
|
13
|
+
if (options) {
|
|
14
|
+
for (const [key, value] of Object.entries(options)) {
|
|
15
|
+
if (value !== undefined && value !== null) {
|
|
16
|
+
params.set(key, String(value));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const qs = params.toString();
|
|
21
|
+
const path = `/api/v1/call_logs${qs ? `?${qs}` : ""}`;
|
|
22
|
+
return this.client.get(path);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=call-logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-logs.js","sourceRoot":"","sources":["../../src/resources/call-logs.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,QAAQ;IACnB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAyB;QAClC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAC1C,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmB,IAAI,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HttpClient } from "../client.js";
|
|
2
|
+
import type { RedditSearchPostsResponse, RedditSearchPostsOptions } from "../types.js";
|
|
3
|
+
export declare class Reddit {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Search Reddit posts matching a query.
|
|
8
|
+
*
|
|
9
|
+
* @param query - Search query
|
|
10
|
+
* @param options - Optional: subreddit, sort, time, limit
|
|
11
|
+
* @returns Matching Reddit posts
|
|
12
|
+
*/
|
|
13
|
+
searchPosts(query: string, options?: RedditSearchPostsOptions): Promise<RedditSearchPostsResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=reddit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reddit.d.ts","sourceRoot":"","sources":["../../src/resources/reddit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,qBAAa,MAAM;IACL,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;;OAMG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,yBAAyB,CAAC;CAYtC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class Reddit {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Search Reddit posts matching a query.
|
|
7
|
+
*
|
|
8
|
+
* @param query - Search query
|
|
9
|
+
* @param options - Optional: subreddit, sort, time, limit
|
|
10
|
+
* @returns Matching Reddit posts
|
|
11
|
+
*/
|
|
12
|
+
async searchPosts(query, options) {
|
|
13
|
+
return this.client.post("/api/v1/reddit_search_posts", {
|
|
14
|
+
query,
|
|
15
|
+
subreddit: options?.subreddit,
|
|
16
|
+
sort: options?.sort,
|
|
17
|
+
time: options?.time,
|
|
18
|
+
limit: options?.limit,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=reddit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reddit.js","sourceRoot":"","sources":["../../src/resources/reddit.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,MAAM;IACjB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,KAAa,EACb,OAAkC;QAElC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,6BAA6B,EAC7B;YACE,KAAK;YACL,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,IAAI,EAAE,OAAO,EAAE,IAAI;YACnB,IAAI,EAAE,OAAO,EAAE,IAAI;YACnB,KAAK,EAAE,OAAO,EAAE,KAAK;SACtB,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HttpClient } from "../client.js";
|
|
2
|
+
import type { SearchResponse, SearchOptions } from "../types.js";
|
|
3
|
+
export declare class Search {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Search the web via JerrySniffs.
|
|
8
|
+
*
|
|
9
|
+
* @param query - Search query string
|
|
10
|
+
* @param options - Optional filters (limit, country, page, start, tbs)
|
|
11
|
+
* @returns Matching URLs and metadata
|
|
12
|
+
*/
|
|
13
|
+
search(query: string, options?: SearchOptions): Promise<SearchResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/resources/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAErB,qBAAa,MAAM;IACL,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;;OAMG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;CAM9E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class Search {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Search the web via JerrySniffs.
|
|
7
|
+
*
|
|
8
|
+
* @param query - Search query string
|
|
9
|
+
* @param options - Optional filters (limit, country, page, start, tbs)
|
|
10
|
+
* @returns Matching URLs and metadata
|
|
11
|
+
*/
|
|
12
|
+
async search(query, options) {
|
|
13
|
+
return this.client.post("/api/v1/search", {
|
|
14
|
+
query,
|
|
15
|
+
...options,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/resources/search.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,MAAM;IACjB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAAuB;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAiB,gBAAgB,EAAE;YACxD,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HttpClient } from "../client.js";
|
|
2
|
+
import type { TwitterSearchResponse, TwitterSearchOptions, TweetLookupResponse } from "../types.js";
|
|
3
|
+
export declare class Twitter {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Search Twitter/X for tweets matching a query.
|
|
8
|
+
*
|
|
9
|
+
* @param query - Search query
|
|
10
|
+
* @param options - Optional: searchType ("Top" | "Latest"), limit
|
|
11
|
+
* @returns Matching tweets
|
|
12
|
+
*/
|
|
13
|
+
search(query: string, options?: TwitterSearchOptions): Promise<TwitterSearchResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Look up a single tweet by its numeric ID.
|
|
16
|
+
*
|
|
17
|
+
* @param id - Numeric tweet ID (snowflake)
|
|
18
|
+
* @returns The tweet object
|
|
19
|
+
*/
|
|
20
|
+
lookup(id: string): Promise<TweetLookupResponse>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=twitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twitter.d.ts","sourceRoot":"","sources":["../../src/resources/twitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,qBAAa,OAAO;IACN,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;;OAMG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;IAQjC;;;;;OAKG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAKvD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class Twitter {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Search Twitter/X for tweets matching a query.
|
|
7
|
+
*
|
|
8
|
+
* @param query - Search query
|
|
9
|
+
* @param options - Optional: searchType ("Top" | "Latest"), limit
|
|
10
|
+
* @returns Matching tweets
|
|
11
|
+
*/
|
|
12
|
+
async search(query, options) {
|
|
13
|
+
return this.client.post("/api/v1/twitter_search", {
|
|
14
|
+
query,
|
|
15
|
+
search_type: options?.searchType,
|
|
16
|
+
limit: options?.limit,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Look up a single tweet by its numeric ID.
|
|
21
|
+
*
|
|
22
|
+
* @param id - Numeric tweet ID (snowflake)
|
|
23
|
+
* @returns The tweet object
|
|
24
|
+
*/
|
|
25
|
+
async lookup(id) {
|
|
26
|
+
return this.client.post("/api/v1/tweet_lookup", {
|
|
27
|
+
id,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=twitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twitter.js","sourceRoot":"","sources":["../../src/resources/twitter.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,OAAO;IAClB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,KAAa,EACb,OAA8B;QAE9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAwB,wBAAwB,EAAE;YACvE,KAAK;YACL,WAAW,EAAE,OAAO,EAAE,UAAU;YAChC,KAAK,EAAE,OAAO,EAAE,KAAK;SACtB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAsB,sBAAsB,EAAE;YACnE,EAAE;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpClient } from "../client.js";
|
|
2
|
+
import type { UrlToMarkdownResponse, UrlToMarkdownOptions } from "../types.js";
|
|
3
|
+
export declare class UrlToMarkdown {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Convert a URL to markdown. Supports HTML pages, plain text, PDFs,
|
|
8
|
+
* DOC, and DOCX files.
|
|
9
|
+
*
|
|
10
|
+
* @param url - The URL to convert
|
|
11
|
+
* @param options - Optional: proxy URL
|
|
12
|
+
* @returns The extracted markdown content
|
|
13
|
+
*/
|
|
14
|
+
convert(url: string, options?: UrlToMarkdownOptions): Promise<UrlToMarkdownResponse>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=url-to-markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-to-markdown.d.ts","sourceRoot":"","sources":["../../src/resources/url-to-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;;;;OAOG;IACG,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;CAMlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class UrlToMarkdown {
|
|
2
|
+
constructor(client) {
|
|
3
|
+
this.client = client;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Convert a URL to markdown. Supports HTML pages, plain text, PDFs,
|
|
7
|
+
* DOC, and DOCX files.
|
|
8
|
+
*
|
|
9
|
+
* @param url - The URL to convert
|
|
10
|
+
* @param options - Optional: proxy URL
|
|
11
|
+
* @returns The extracted markdown content
|
|
12
|
+
*/
|
|
13
|
+
async convert(url, options) {
|
|
14
|
+
return this.client.post("/api/v1/url_to_markdown", {
|
|
15
|
+
url,
|
|
16
|
+
proxy: options?.proxy,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=url-to-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-to-markdown.js","sourceRoot":"","sources":["../../src/resources/url-to-markdown.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,aAAa;IACxB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CACX,GAAW,EACX,OAA8B;QAE9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAwB,yBAAyB,EAAE;YACxE,GAAG;YACH,KAAK,EAAE,OAAO,EAAE,KAAK;SACtB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript schema for Twitter/X API response.
|
|
3
|
+
*
|
|
4
|
+
* Fields marked [v2] come from the Twitter API v2 spec.
|
|
5
|
+
* Fields marked [v1.1] come from the legacy REST API spec.
|
|
6
|
+
* Fields marked [sample] were observed directly in the provided response.
|
|
7
|
+
*/
|
|
8
|
+
/** BCP-47 language tag or "zxx" (no linguistic content) */
|
|
9
|
+
export type LanguageCode = string;
|
|
10
|
+
/** Snowflake ID — always a string to avoid JS integer precision loss */
|
|
11
|
+
export type SnowflakeId = string;
|
|
12
|
+
/** Twitter date string — "Mon Jun 15 08:21:13 +0000 2026" (v1.1 format) */
|
|
13
|
+
export type TwitterDateString = string;
|
|
14
|
+
/** ISO 8601 date string — "2026-06-15T08:21:13.000Z" (v2 format) */
|
|
15
|
+
export type ISODateString = string;
|
|
16
|
+
export type MediaType = "photo" | "video" | "animated_gif";
|
|
17
|
+
export type ContentType = "video/mp4" | "video/ogg" | "video/webm" | "application/x-mpegURL" | "application/dash+xml";
|
|
18
|
+
export type ReplySettings = "everyone" | "mentionedUsers" | "subscribers" | "following";
|
|
19
|
+
export type TweetType = "tweet" | "retweet" | "quote" | "reply";
|
|
20
|
+
export interface MediaVariant {
|
|
21
|
+
/** Direct URL to this media rendition */
|
|
22
|
+
url: string;
|
|
23
|
+
content_type: ContentType;
|
|
24
|
+
/**
|
|
25
|
+
* Bitrate in bits per second. Present for non-HLS variants.
|
|
26
|
+
* 0 for animated_gif MP4 (no audio track, bitrate not meaningful).
|
|
27
|
+
*/
|
|
28
|
+
bitrate?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface TweetMedia {
|
|
31
|
+
/** [sample] Media type */
|
|
32
|
+
type: MediaType;
|
|
33
|
+
/** [sample] Direct URL — present for photos; absent for video/gif (use variants instead) */
|
|
34
|
+
url?: string;
|
|
35
|
+
/** [sample] HLS/MP4 variants with different bitrates/resolutions. Present for video & animated_gif */
|
|
36
|
+
variants?: MediaVariant[];
|
|
37
|
+
/** [sample] Duration in milliseconds. Present for video & animated_gif */
|
|
38
|
+
duration_ms?: number;
|
|
39
|
+
/** [sample] Thumbnail / poster image URL */
|
|
40
|
+
thumbnail_url?: string;
|
|
41
|
+
/** [v2] Unique stable key for this media asset (e.g. "3_123456789") */
|
|
42
|
+
media_key?: string;
|
|
43
|
+
/** [v1.1 / v2] Width in pixels */
|
|
44
|
+
width?: number;
|
|
45
|
+
/** [v1.1 / v2] Height in pixels */
|
|
46
|
+
height?: number;
|
|
47
|
+
/** [v2] Alt text for accessibility */
|
|
48
|
+
alt_text?: string;
|
|
49
|
+
/** [v2] Preview image URL (same as thumbnail_url in most cases) */
|
|
50
|
+
preview_image_url?: string;
|
|
51
|
+
/** [v2] Source of the media (e.g. tweet, user profile) */
|
|
52
|
+
source_status_id?: SnowflakeId;
|
|
53
|
+
}
|
|
54
|
+
export interface UrlEntity {
|
|
55
|
+
/** t.co shortened URL as it appears in tweet text */
|
|
56
|
+
url: string;
|
|
57
|
+
/** Fully expanded destination URL */
|
|
58
|
+
expanded_url: string;
|
|
59
|
+
/** Human-readable display URL (truncated) */
|
|
60
|
+
display_url: string;
|
|
61
|
+
/** [start, end] character indices within the tweet text */
|
|
62
|
+
indices?: [number, number];
|
|
63
|
+
/** HTTP status code returned when the URL was last fetched [v2] */
|
|
64
|
+
status?: number;
|
|
65
|
+
/** Page title of the linked resource [v2] */
|
|
66
|
+
title?: string;
|
|
67
|
+
/** Page description of the linked resource [v2] */
|
|
68
|
+
description?: string;
|
|
69
|
+
/** Unwound (final redirect) URL [v2] */
|
|
70
|
+
unwound_url?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface HashtagEntity {
|
|
73
|
+
text: string;
|
|
74
|
+
indices?: [number, number];
|
|
75
|
+
}
|
|
76
|
+
export interface MentionEntity {
|
|
77
|
+
screen_name: string;
|
|
78
|
+
name: string;
|
|
79
|
+
id_str: SnowflakeId;
|
|
80
|
+
indices?: [number, number];
|
|
81
|
+
}
|
|
82
|
+
export interface CashtagEntity {
|
|
83
|
+
text: string;
|
|
84
|
+
indices?: [number, number];
|
|
85
|
+
}
|
|
86
|
+
export interface AnnotationEntity {
|
|
87
|
+
/** [v2] Named entity type, e.g. "Person", "Organization", "Place", "Product" */
|
|
88
|
+
type: string;
|
|
89
|
+
normalized_text: string;
|
|
90
|
+
probability: number;
|
|
91
|
+
start: number;
|
|
92
|
+
end: number;
|
|
93
|
+
}
|
|
94
|
+
export interface TweetEntities {
|
|
95
|
+
urls?: UrlEntity[];
|
|
96
|
+
hashtags?: HashtagEntity[];
|
|
97
|
+
user_mentions?: MentionEntity[];
|
|
98
|
+
symbols?: CashtagEntity[];
|
|
99
|
+
annotations?: AnnotationEntity[];
|
|
100
|
+
media?: Pick<TweetMedia, "media_key" | "url" | "type">[];
|
|
101
|
+
}
|
|
102
|
+
export interface TweetAuthor {
|
|
103
|
+
/** [sample] Display name */
|
|
104
|
+
name: string;
|
|
105
|
+
/** [sample] @handle without the '@' */
|
|
106
|
+
screen_name: string;
|
|
107
|
+
/** [sample] Profile picture URL (usually ends in _normal.jpg for 48×48) */
|
|
108
|
+
avatar: string;
|
|
109
|
+
/** [sample] Profile bio / description */
|
|
110
|
+
description: string;
|
|
111
|
+
/**
|
|
112
|
+
* [sample] Blue-check verified status.
|
|
113
|
+
* Note: Twitter v2 distinguishes verified (legacy blue) from verified_type.
|
|
114
|
+
*/
|
|
115
|
+
verified: boolean;
|
|
116
|
+
/** [sample] Follower count */
|
|
117
|
+
followers_count: number;
|
|
118
|
+
/** [sample] Profile URL (link in bio) */
|
|
119
|
+
url?: string;
|
|
120
|
+
/** [sample] Location string (free-text, not geocoded) */
|
|
121
|
+
location?: string;
|
|
122
|
+
/** [v1.1] Number of accounts this user follows */
|
|
123
|
+
friends_count?: number;
|
|
124
|
+
/** [v1.1] Total tweets + retweets the user has posted */
|
|
125
|
+
statuses_count?: number;
|
|
126
|
+
/** [v1.1] Number of public lists the user is a member of */
|
|
127
|
+
listed_count?: number;
|
|
128
|
+
/** [v1.1] Number of tweets the user has liked */
|
|
129
|
+
favourites_count?: number;
|
|
130
|
+
/** [v1.1 / v2] Account creation timestamp */
|
|
131
|
+
created_at?: TwitterDateString | ISODateString;
|
|
132
|
+
/** [v1.1] Whether tweets are protected (private) */
|
|
133
|
+
protected?: boolean;
|
|
134
|
+
/** [v1.1] Profile banner/header image URL */
|
|
135
|
+
profile_banner_url?: string;
|
|
136
|
+
/** [v1.1] Profile background color (hex without #) */
|
|
137
|
+
profile_background_color?: string;
|
|
138
|
+
/** [v2] Unique numeric user ID */
|
|
139
|
+
id_str?: SnowflakeId;
|
|
140
|
+
/**
|
|
141
|
+
* [v2] Granular verification type.
|
|
142
|
+
* "blue" → Twitter Blue subscriber
|
|
143
|
+
* "business" → Gold checkmark (advertiser)
|
|
144
|
+
* "government" → Grey checkmark
|
|
145
|
+
* "none" → No verification
|
|
146
|
+
*/
|
|
147
|
+
verified_type?: "blue" | "business" | "government" | "none";
|
|
148
|
+
/** [v2] Whether the authenticated user follows this author */
|
|
149
|
+
following?: boolean;
|
|
150
|
+
/** [v2] Whether this author follows the authenticated user */
|
|
151
|
+
followed_by?: boolean;
|
|
152
|
+
/** [v2] Whether DMs from authenticated user to this author are restricted */
|
|
153
|
+
can_dm?: boolean;
|
|
154
|
+
/** [v2] Pinned tweet ID */
|
|
155
|
+
pinned_tweet_id?: SnowflakeId;
|
|
156
|
+
}
|
|
157
|
+
export interface TweetPublicMetrics {
|
|
158
|
+
/** [sample] Total impression count (views) */
|
|
159
|
+
views: number;
|
|
160
|
+
/** [sample] Quote tweet count */
|
|
161
|
+
quotes: number;
|
|
162
|
+
/** [sample] Reply count */
|
|
163
|
+
replies: number;
|
|
164
|
+
/** [sample] Retweet count (not including quotes) */
|
|
165
|
+
retweets: number;
|
|
166
|
+
/** [sample] Bookmark count */
|
|
167
|
+
bookmarks: number;
|
|
168
|
+
/**
|
|
169
|
+
* [sample] Like count.
|
|
170
|
+
* Named "favorites" in v1.1; "like_count" in v2.
|
|
171
|
+
*/
|
|
172
|
+
favorites: number;
|
|
173
|
+
}
|
|
174
|
+
/** [v2] Non-public metrics — only available for your own tweets via OAuth */
|
|
175
|
+
export interface TweetNonPublicMetrics {
|
|
176
|
+
impression_count: number;
|
|
177
|
+
url_link_clicks: number;
|
|
178
|
+
user_profile_clicks: number;
|
|
179
|
+
}
|
|
180
|
+
/** [v2] Organic (non-promoted) metrics */
|
|
181
|
+
export interface TweetOrganicMetrics extends TweetPublicMetrics {
|
|
182
|
+
url_link_clicks: number;
|
|
183
|
+
user_profile_clicks: number;
|
|
184
|
+
}
|
|
185
|
+
/** [v2] Promoted metrics (only if tweet was promoted) */
|
|
186
|
+
export type TweetPromotedMetrics = TweetOrganicMetrics;
|
|
187
|
+
export interface Coordinates {
|
|
188
|
+
type: "Point";
|
|
189
|
+
coordinates: [longitude: number, latitude: number];
|
|
190
|
+
}
|
|
191
|
+
export interface BoundingBox {
|
|
192
|
+
type: "Polygon";
|
|
193
|
+
/** Array of [longitude, latitude] corners */
|
|
194
|
+
coordinates: [number, number][][];
|
|
195
|
+
}
|
|
196
|
+
export interface TweetPlace {
|
|
197
|
+
/** [v2] Place ID (e.g. "01a9a39529b27f36") */
|
|
198
|
+
id: string;
|
|
199
|
+
name: string;
|
|
200
|
+
full_name: string;
|
|
201
|
+
country: string;
|
|
202
|
+
country_code: string;
|
|
203
|
+
place_type: "city" | "admin" | "country" | "neighborhood" | "poi" | "unknown";
|
|
204
|
+
geo?: BoundingBox;
|
|
205
|
+
contained_within?: TweetPlace[];
|
|
206
|
+
}
|
|
207
|
+
export interface ReferencedTweet {
|
|
208
|
+
/** "retweeted" | "quoted" | "replied_to" */
|
|
209
|
+
type: "retweeted" | "quoted" | "replied_to";
|
|
210
|
+
id: SnowflakeId;
|
|
211
|
+
/** Expanded tweet object — present when expansions=referenced_tweets.id is requested */
|
|
212
|
+
tweet?: Tweet;
|
|
213
|
+
}
|
|
214
|
+
/** [v2] Domain + entity pair for contextual annotations */
|
|
215
|
+
export interface ContextAnnotation {
|
|
216
|
+
domain: {
|
|
217
|
+
id: string;
|
|
218
|
+
name: string;
|
|
219
|
+
description?: string;
|
|
220
|
+
};
|
|
221
|
+
entity: {
|
|
222
|
+
id: string;
|
|
223
|
+
name: string;
|
|
224
|
+
description?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export interface PollOption {
|
|
228
|
+
position: number;
|
|
229
|
+
label: string;
|
|
230
|
+
votes: number;
|
|
231
|
+
}
|
|
232
|
+
export interface TweetPoll {
|
|
233
|
+
id: string;
|
|
234
|
+
options: PollOption[];
|
|
235
|
+
/** ISO 8601 expiry datetime */
|
|
236
|
+
end_datetime: ISODateString;
|
|
237
|
+
/** ISO 8601 duration string, e.g. "PT24H" */
|
|
238
|
+
duration_minutes: number;
|
|
239
|
+
voting_status: "open" | "closed";
|
|
240
|
+
}
|
|
241
|
+
export interface WithheldInfo {
|
|
242
|
+
/** Whether the entire tweet or only specific fields are withheld */
|
|
243
|
+
copyright: boolean;
|
|
244
|
+
/** ISO 3166-1 alpha-2 country codes where this tweet is withheld */
|
|
245
|
+
country_codes: string[];
|
|
246
|
+
scope?: "tweet" | "user";
|
|
247
|
+
}
|
|
248
|
+
export interface Tweet {
|
|
249
|
+
/** [sample] Snowflake ID of the tweet */
|
|
250
|
+
tweet_id: SnowflakeId;
|
|
251
|
+
/** [sample] Canonical URL to the tweet */
|
|
252
|
+
url: string;
|
|
253
|
+
/** [sample] BCP-47 language code detected for the tweet text */
|
|
254
|
+
lang: LanguageCode;
|
|
255
|
+
/** [sample] The @screen_name of the tweet author (denormalized) */
|
|
256
|
+
screen_name: string;
|
|
257
|
+
/** [sample] Tweet text (up to 280 chars; 10,000 for Twitter Blue subscribers) */
|
|
258
|
+
text: string;
|
|
259
|
+
/** [sample] Creation timestamp in v1.1 date string format */
|
|
260
|
+
created_at: TwitterDateString;
|
|
261
|
+
/** [sample] ID of the root tweet in the thread/conversation */
|
|
262
|
+
conversation_id: SnowflakeId;
|
|
263
|
+
/** [sample] Expanded URLs extracted from the tweet text */
|
|
264
|
+
urls: string[];
|
|
265
|
+
/** [sample] Attached media items */
|
|
266
|
+
media: TweetMedia[];
|
|
267
|
+
/** [sample] Author profile */
|
|
268
|
+
author: TweetAuthor;
|
|
269
|
+
/** [sample] Engagement & impression metrics */
|
|
270
|
+
metrics: TweetPublicMetrics;
|
|
271
|
+
/** [v1.1 / v2] ID of the tweet this is a reply to */
|
|
272
|
+
in_reply_to_status_id?: SnowflakeId;
|
|
273
|
+
/** [v1.1] @screen_name of the user being replied to */
|
|
274
|
+
in_reply_to_screen_name?: string;
|
|
275
|
+
/** [v1.1 / v2] User ID of the user being replied to */
|
|
276
|
+
in_reply_to_user_id?: SnowflakeId;
|
|
277
|
+
/** [v1.1] Whether this tweet is a retweet */
|
|
278
|
+
retweeted?: boolean;
|
|
279
|
+
/** [v1.1] The original tweet when this is a retweet */
|
|
280
|
+
retweeted_status?: Tweet;
|
|
281
|
+
/** [v2] Referenced tweets (retweets, quotes, reply parents) */
|
|
282
|
+
referenced_tweets?: ReferencedTweet[];
|
|
283
|
+
/** [v1.1] Retweet count (denormalized from metrics) */
|
|
284
|
+
retweet_count?: number;
|
|
285
|
+
/** [v1.1 / v2] Parsed entities (URLs, mentions, hashtags, etc.) */
|
|
286
|
+
entities?: TweetEntities;
|
|
287
|
+
/** [v2] Named entity + topic annotations */
|
|
288
|
+
context_annotations?: ContextAnnotation[];
|
|
289
|
+
/**
|
|
290
|
+
* [v1.1] If the tweet text was truncated due to legacy 140-char limit.
|
|
291
|
+
* Always false for tweets > 2014 and for v2.
|
|
292
|
+
*/
|
|
293
|
+
truncated?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* [v1.1] Extended tweet object present when tweet exceeds old 140-char limit.
|
|
296
|
+
* Only relevant for v1.1 compat layer.
|
|
297
|
+
*/
|
|
298
|
+
extended_tweet?: {
|
|
299
|
+
full_text: string;
|
|
300
|
+
display_text_range: [number, number];
|
|
301
|
+
entities: TweetEntities;
|
|
302
|
+
};
|
|
303
|
+
/** [v2] Character range [start, end] of the actual tweet text to display */
|
|
304
|
+
display_text_range?: [number, number];
|
|
305
|
+
/** [v1.1] Exact coordinates if geotagged */
|
|
306
|
+
coordinates?: Coordinates;
|
|
307
|
+
/** [v1.1 / v2] Named place associated with the tweet */
|
|
308
|
+
place?: TweetPlace;
|
|
309
|
+
/** [v2] Poll attached to the tweet */
|
|
310
|
+
poll?: TweetPoll;
|
|
311
|
+
/** [v1.1] HTML anchor tag identifying the client used to post */
|
|
312
|
+
source?: string;
|
|
313
|
+
/** [v2] Who can reply to this tweet */
|
|
314
|
+
reply_settings?: ReplySettings;
|
|
315
|
+
/** [v1.1] Whether the tweet is flagged as potentially sensitive */
|
|
316
|
+
possibly_sensitive?: boolean;
|
|
317
|
+
/** [v2] Countries/reasons for content withholding */
|
|
318
|
+
withheld?: WithheldInfo;
|
|
319
|
+
/** [v2] Impressions & click metrics — only for authenticated author */
|
|
320
|
+
non_public_metrics?: TweetNonPublicMetrics;
|
|
321
|
+
/** [v2] Organic engagement breakdown */
|
|
322
|
+
organic_metrics?: TweetOrganicMetrics;
|
|
323
|
+
/** [v2] Promoted post metrics */
|
|
324
|
+
promoted_metrics?: TweetPromotedMetrics;
|
|
325
|
+
}
|
|
326
|
+
export interface TwitterApiResponse {
|
|
327
|
+
/** [sample] Whether the request succeeded */
|
|
328
|
+
ok: boolean;
|
|
329
|
+
/** [sample] List of tweets returned */
|
|
330
|
+
tweets: Tweet[];
|
|
331
|
+
/** [v2] Pagination token for the next page */
|
|
332
|
+
next_token?: string;
|
|
333
|
+
/** [v2] Pagination token for the previous page */
|
|
334
|
+
previous_token?: string;
|
|
335
|
+
/** [v2] Total count of results matching the query (not just this page) */
|
|
336
|
+
result_count?: number;
|
|
337
|
+
/** [v2] Newest tweet ID in the result set */
|
|
338
|
+
newest_id?: SnowflakeId;
|
|
339
|
+
/** [v2] Oldest tweet ID in the result set */
|
|
340
|
+
oldest_id?: SnowflakeId;
|
|
341
|
+
}
|
|
342
|
+
/** Narrows a TweetMedia to a video with guaranteed variants */
|
|
343
|
+
export type VideoMedia = TweetMedia & {
|
|
344
|
+
type: "video";
|
|
345
|
+
variants: MediaVariant[];
|
|
346
|
+
duration_ms: number;
|
|
347
|
+
thumbnail_url: string;
|
|
348
|
+
};
|
|
349
|
+
/** Narrows a TweetMedia to a photo */
|
|
350
|
+
export type PhotoMedia = TweetMedia & {
|
|
351
|
+
type: "photo";
|
|
352
|
+
url: string;
|
|
353
|
+
};
|
|
354
|
+
/** Narrows a TweetMedia to an animated GIF */
|
|
355
|
+
export type AnimatedGifMedia = TweetMedia & {
|
|
356
|
+
type: "animated_gif";
|
|
357
|
+
variants: MediaVariant[];
|
|
358
|
+
thumbnail_url: string;
|
|
359
|
+
};
|
|
360
|
+
/** Type guard: is this media a video? */
|
|
361
|
+
export declare function isVideoMedia(media: TweetMedia): media is VideoMedia;
|
|
362
|
+
/** Type guard: is this media a photo? */
|
|
363
|
+
export declare function isPhotoMedia(media: TweetMedia): media is PhotoMedia;
|
|
364
|
+
/** Type guard: is this media an animated GIF? */
|
|
365
|
+
export declare function isAnimatedGif(media: TweetMedia): media is AnimatedGifMedia;
|
|
366
|
+
/**
|
|
367
|
+
* Returns the highest-bitrate MP4 variant from a video media item.
|
|
368
|
+
* Useful for downloading or embedding at max quality.
|
|
369
|
+
*/
|
|
370
|
+
export declare function getHighestQualityVariant(media: VideoMedia): MediaVariant | undefined;
|
|
371
|
+
//# sourceMappingURL=twitter-response-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twitter-response-types.d.ts","sourceRoot":"","sources":["../src/twitter-response-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,2DAA2D;AAC3D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,cAAc,CAAC;AAE3D,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,WAAW,GACX,YAAY,GACZ,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,gBAAgB,GAAG,aAAa,GAAG,WAAW,CAAC;AAExF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAMhE,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,IAAI,EAAE,SAAS,CAAC;IAEhB,4FAA4F;IAC5F,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,sGAAsG;IACtG,QAAQ,CAAC,EAAE,YAAY,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kD;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB;AAMD,+DAA+D;AAC/D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,8CAA8C;AAC9C,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG;IAC1C,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,UAAU,CAEnE;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,UAAU,CAEnE;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,IAAI,gBAAgB,CAE1E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAIpF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript schema for Twitter/X API response.
|
|
3
|
+
*
|
|
4
|
+
* Fields marked [v2] come from the Twitter API v2 spec.
|
|
5
|
+
* Fields marked [v1.1] come from the legacy REST API spec.
|
|
6
|
+
* Fields marked [sample] were observed directly in the provided response.
|
|
7
|
+
*/
|
|
8
|
+
/** Type guard: is this media a video? */
|
|
9
|
+
export function isVideoMedia(media) {
|
|
10
|
+
return media.type === "video";
|
|
11
|
+
}
|
|
12
|
+
/** Type guard: is this media a photo? */
|
|
13
|
+
export function isPhotoMedia(media) {
|
|
14
|
+
return media.type === "photo";
|
|
15
|
+
}
|
|
16
|
+
/** Type guard: is this media an animated GIF? */
|
|
17
|
+
export function isAnimatedGif(media) {
|
|
18
|
+
return media.type === "animated_gif";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the highest-bitrate MP4 variant from a video media item.
|
|
22
|
+
* Useful for downloading or embedding at max quality.
|
|
23
|
+
*/
|
|
24
|
+
export function getHighestQualityVariant(media) {
|
|
25
|
+
return media.variants
|
|
26
|
+
.filter((v) => v.content_type === "video/mp4")
|
|
27
|
+
.sort((a, b) => (b.bitrate ?? 0) - (a.bitrate ?? 0))[0];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=twitter-response-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"twitter-response-types.js","sourceRoot":"","sources":["../src/twitter-response-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2hBH,yCAAyC;AACzC,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAiB;IACxD,OAAO,KAAK,CAAC,QAAQ;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,WAAW,CAAC;SAC7C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
export type { LanguageCode, SnowflakeId, TwitterDateString, ISODateString, MediaType, ContentType, ReplySettings, TweetType, MediaVariant, TweetMedia, UrlEntity, HashtagEntity, MentionEntity, CashtagEntity, AnnotationEntity, TweetEntities, TweetAuthor, TweetPublicMetrics, TweetNonPublicMetrics, TweetOrganicMetrics, TweetPromotedMetrics, Coordinates, BoundingBox, TweetPlace, ReferencedTweet, ContextAnnotation, PollOption, TweetPoll, WithheldInfo, Tweet, TwitterApiResponse, VideoMedia, PhotoMedia, AnimatedGifMedia, } from "./twitter-response-types.js";
|
|
2
|
+
export { isVideoMedia, isPhotoMedia, isAnimatedGif, getHighestQualityVariant, } from "./twitter-response-types.js";
|
|
3
|
+
export interface ApiTweetAuthor {
|
|
4
|
+
screen_name: string | null;
|
|
5
|
+
name: string | null;
|
|
6
|
+
verified: boolean | null;
|
|
7
|
+
verified_type: string | null;
|
|
8
|
+
followers_count: number | null;
|
|
9
|
+
description: string | null;
|
|
10
|
+
url: string | null;
|
|
11
|
+
avatar: string | null;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiTweetMetrics {
|
|
15
|
+
views: number | null;
|
|
16
|
+
bookmarks: number | null;
|
|
17
|
+
favorites: number | null;
|
|
18
|
+
quotes: number | null;
|
|
19
|
+
replies: number | null;
|
|
20
|
+
retweets: number | null;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiTweetMedia {
|
|
24
|
+
type: "photo" | "video" | "animated_gif";
|
|
25
|
+
url?: string | null;
|
|
26
|
+
thumbnail_url?: string | null;
|
|
27
|
+
duration_ms?: number | null;
|
|
28
|
+
variants?: ApiMediaVariant[] | null;
|
|
29
|
+
width?: number | null;
|
|
30
|
+
height?: number | null;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
export interface ApiMediaVariant {
|
|
34
|
+
url: string;
|
|
35
|
+
content_type: string;
|
|
36
|
+
bitrate?: number | null;
|
|
37
|
+
}
|
|
38
|
+
export interface ApiTweet {
|
|
39
|
+
tweet_id: string | null;
|
|
40
|
+
url: string | null;
|
|
41
|
+
screen_name: string | null;
|
|
42
|
+
created_at: string | null;
|
|
43
|
+
text: string | null;
|
|
44
|
+
display_text: string | null;
|
|
45
|
+
lang: string | null;
|
|
46
|
+
conversation_id: string | null;
|
|
47
|
+
reply_to: string | null;
|
|
48
|
+
in_reply_to_screen_name: string | null;
|
|
49
|
+
in_reply_to_status_id: string | null;
|
|
50
|
+
in_reply_to_user_id: string | null;
|
|
51
|
+
sensitive: boolean | null;
|
|
52
|
+
status: string | null;
|
|
53
|
+
author: ApiTweetAuthor;
|
|
54
|
+
metrics: ApiTweetMetrics;
|
|
55
|
+
urls: string[] | null;
|
|
56
|
+
media: ApiTweetMedia[];
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface RedditAuthorInfo {
|
|
60
|
+
id: string | null;
|
|
61
|
+
name: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface RedditSubreddit {
|
|
64
|
+
name: string | null;
|
|
65
|
+
subscribersCount: number | null;
|
|
66
|
+
}
|
|
67
|
+
export interface RedditPost {
|
|
68
|
+
id: string | null;
|
|
69
|
+
createdAt: number | null;
|
|
70
|
+
postTitle: string | null;
|
|
71
|
+
url: string | null;
|
|
72
|
+
content: string | null;
|
|
73
|
+
score: number | null;
|
|
74
|
+
commentCount: number | null;
|
|
75
|
+
authorInfo: RedditAuthorInfo;
|
|
76
|
+
upvoteRatio: number | null;
|
|
77
|
+
subreddit: RedditSubreddit;
|
|
78
|
+
}
|
|
79
|
+
export interface CallLog {
|
|
80
|
+
id: string;
|
|
81
|
+
endpoint: string;
|
|
82
|
+
status: "success" | "failure";
|
|
83
|
+
http_code: number | null;
|
|
84
|
+
duration_ms: number | null;
|
|
85
|
+
error_message: string | null;
|
|
86
|
+
created_at: string;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface SearchResponse {
|
|
90
|
+
ok: boolean;
|
|
91
|
+
query: string;
|
|
92
|
+
urls: string[];
|
|
93
|
+
count: number;
|
|
94
|
+
}
|
|
95
|
+
export interface UrlToMarkdownResponse {
|
|
96
|
+
ok: boolean;
|
|
97
|
+
url: string;
|
|
98
|
+
markdown: string;
|
|
99
|
+
is_proxy_used: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface TwitterSearchResponse {
|
|
102
|
+
ok: boolean;
|
|
103
|
+
tweets: ApiTweet[];
|
|
104
|
+
}
|
|
105
|
+
export interface TweetLookupResponse {
|
|
106
|
+
ok: boolean;
|
|
107
|
+
tweet: ApiTweet;
|
|
108
|
+
}
|
|
109
|
+
export interface RedditSearchPostsResponse {
|
|
110
|
+
ok: boolean;
|
|
111
|
+
posts: RedditPost[];
|
|
112
|
+
}
|
|
113
|
+
export interface CallLogsResponse {
|
|
114
|
+
rows: CallLog[];
|
|
115
|
+
page: number;
|
|
116
|
+
limit: number;
|
|
117
|
+
total: number;
|
|
118
|
+
totalPages: number;
|
|
119
|
+
}
|
|
120
|
+
export interface SearchOptions {
|
|
121
|
+
limit?: number;
|
|
122
|
+
country?: string;
|
|
123
|
+
page?: number;
|
|
124
|
+
start?: number;
|
|
125
|
+
tbs?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface UrlToMarkdownOptions {
|
|
128
|
+
proxy?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface TwitterSearchOptions {
|
|
131
|
+
searchType?: "Top" | "Latest";
|
|
132
|
+
limit?: number;
|
|
133
|
+
}
|
|
134
|
+
export interface RedditSearchPostsOptions {
|
|
135
|
+
subreddit?: string;
|
|
136
|
+
sort?: "relevance" | "hot" | "top" | "new" | "comments";
|
|
137
|
+
time?: "hour" | "day" | "week" | "month" | "year" | "all";
|
|
138
|
+
limit?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface CallLogsOptions {
|
|
141
|
+
q?: string;
|
|
142
|
+
endpoint?: string;
|
|
143
|
+
status?: "success" | "failure";
|
|
144
|
+
page?: number;
|
|
145
|
+
limit?: number;
|
|
146
|
+
sort_by?: "created_at" | "endpoint" | "status" | "http_code" | "duration_ms";
|
|
147
|
+
sort_dir?: "asc" | "desc";
|
|
148
|
+
}
|
|
149
|
+
export interface JerrySniffsConfig {
|
|
150
|
+
apiKey: string;
|
|
151
|
+
baseUrl?: string;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACX,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AAIrC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,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3B;AAID,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// ── Twitter types (from TWITTER_RESPONSE_TYPES.js) ──────────────────────────
|
|
2
|
+
// Re-exported for consumers who need the full rich Tweet shape.
|
|
3
|
+
export { isVideoMedia, isPhotoMedia, isAnimatedGif, getHighestQualityVariant, } from "./twitter-response-types.js";
|
|
4
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gEAAgE;AAuChE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,wBAAwB,GACzB,MAAM,6BAA6B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jerrysniffs-node-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Official Node.js SDK for the JerrySniffs API",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"jerrysniffs",
|
|
24
|
+
"twitter",
|
|
25
|
+
"reddit",
|
|
26
|
+
"search",
|
|
27
|
+
"scraping",
|
|
28
|
+
"api",
|
|
29
|
+
"sdk"
|
|
30
|
+
],
|
|
31
|
+
"author": "JerrySniffs",
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "^5.5.0",
|
|
35
|
+
"@types/node": "^20.14.0"
|
|
36
|
+
}
|
|
37
|
+
}
|