jerrysniffs-node-sdk
v1.0.0
Published
Official Node.js SDK for the JerrySniffs API
Downloads
148
Maintainers
Readme
jerrysniffs-node-sdk
Official Node.js SDK for the JerrySniffs API.
Provides typed access to web search, Twitter/X search & tweet lookup, Reddit post search, URL-to-Markdown conversion, and API call logs.
For detailed docs, refer JerrySniffs Docs
Install
npm install jerrysniffs-node-sdkQuick start
import JerrySniffs from "jerrysniffs-node-sdk";
const client = new JerrySniffs({ apiKey: "YOUR_API_TOKEN" });
// Web search
const results = await client.search.search("site:docs.stripe.com webhooks");
console.log(results.urls);
// Twitter search
const tweets = await client.twitter.search("openai agents", { limit: 5 });
console.log(tweets.tweets);
// Tweet lookup
const tweet = await client.twitter.lookup("1234567890123456789");
console.log(tweet.tweet);
// Reddit search
const posts = await client.reddit.searchPosts("best docs search api", {
subreddit: "SaaS",
sort: "top",
time: "month",
});
console.log(posts.posts);
// URL to Markdown
const md = await client.urlToMarkdown.convert("https://example.com");
console.log(md.markdown);
// Call logs
const logs = await client.callLogs.list({ page: 1, limit: 10 });
console.log(logs.rows);Authentication
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.
Configuration
const client = new JerrySniffs({
apiKey: "YOUR_API_TOKEN", // required
baseUrl: "https://jerrysniffs.online", // optional, this is the default
});API Reference
client.search.search(query, options?)
| Param | Type | Description |
|-------|------|-------------|
| query | string | Search query (required) |
| options.limit | number | Max results (1–50) |
| options.country | string | Country code, e.g. "US" |
| options.page | number | Page number (1-based) |
| options.start | number | Result offset |
| options.tbs | string | Time-based search filter, e.g. "qdr:w" |
Returns SearchResponse: { ok, query, urls, count }
client.twitter.search(query, options?)
| Param | Type | Description |
|-------|------|-------------|
| query | string | Search query (required) |
| options.searchType | "Top" \| "Latest" | Result type |
| options.limit | number | Max results (1–50) |
Returns TwitterSearchResponse: { ok, tweets } where each tweet is an ApiTweet.
client.twitter.lookup(id)
| Param | Type | Description |
|-------|------|-------------|
| id | string | Numeric tweet ID (required) |
Returns TweetLookupResponse: { ok, tweet } where tweet is an ApiTweet.
client.reddit.searchPosts(query, options?)
| Param | Type | Description |
|-------|------|-------------|
| query | string | Search query (required) |
| options.subreddit | string | Restrict to subreddit |
| options.sort | "relevance" \| "hot" \| "top" \| "new" \| "comments" | Sort order |
| options.time | "hour" \| "day" \| "week" \| "month" \| "year" \| "all" | Time range |
| options.limit | number | Max results (1–50) |
Returns RedditSearchPostsResponse: { ok, posts }
client.urlToMarkdown.convert(url, options?)
| Param | Type | Description |
|-------|------|-------------|
| url | string | URL to convert (required). Supports HTML, plain text, PDF, DOC, DOCX |
| options.proxy | string | Proxy URL, e.g. "http://user:pass@proxy:8080" |
Returns UrlToMarkdownResponse: { ok, url, markdown, is_proxy_used }
client.callLogs.list(options?)
| Param | Type | Description |
|-------|------|-------------|
| options.q | string | Full-text search across logs |
| options.endpoint | string | Filter by endpoint name |
| options.status | "success" \| "failure" | Filter by status |
| options.page | number | Page number (1-based) |
| options.limit | number | Page size |
| options.sort_by | "created_at" \| "endpoint" \| "status" \| "http_code" \| "duration_ms" | Sort column |
| options.sort_dir | "asc" \| "desc" | Sort direction |
Returns CallLogsResponse: { rows, page, limit, total, totalPages }
Error handling
The SDK throws ApiError for non-2xx responses:
import { ApiError } from "jerrysniffs-node-sdk";
try {
await client.search.search("test");
} catch (err) {
if (err instanceof ApiError) {
console.error(err.status); // HTTP status code
console.error(err.body); // Parsed response body
}
}TypeScript types
All request options and response types are exported:
import type {
SearchResponse,
ApiTweet,
ApiTweetAuthor,
ApiTweetMetrics,
RedditPost,
UrlToMarkdownResponse,
CallLogsResponse,
Tweet,
TweetAuthor,
TweetMedia,
TweetPublicMetrics,
} from "jerrysniffs-node-sdk";License
ISC
