stophy 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 +29 -9
- package/dist/index.cjs +44 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8226 -19511
- package/dist/index.d.ts +8226 -19511
- package/dist/index.js +44 -160
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -102,29 +102,18 @@ function isRecord(value) {
|
|
|
102
102
|
|
|
103
103
|
// src/bind.ts
|
|
104
104
|
function post(path, call) {
|
|
105
|
-
|
|
106
|
-
return call({ method: "POST", path, body, options });
|
|
107
|
-
}
|
|
108
|
-
return run;
|
|
105
|
+
return (body, options) => call({ method: "POST", path, body, options });
|
|
109
106
|
}
|
|
110
107
|
function postOptional(path, call) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return run;
|
|
108
|
+
return (body, options) => call({
|
|
109
|
+
method: "POST",
|
|
110
|
+
path,
|
|
111
|
+
body: body ?? {},
|
|
112
|
+
options
|
|
113
|
+
});
|
|
118
114
|
}
|
|
119
115
|
function get(path, call) {
|
|
120
|
-
|
|
121
|
-
return call({ method: "GET", path, options });
|
|
122
|
-
}
|
|
123
|
-
return run;
|
|
124
|
-
}
|
|
125
|
-
function isMarkdownOptions(value) {
|
|
126
|
-
if (typeof value !== "object" || value === null) return false;
|
|
127
|
-
return "format" in value && value.format === "markdown";
|
|
116
|
+
return (options) => call({ method: "GET", path, options });
|
|
128
117
|
}
|
|
129
118
|
|
|
130
119
|
// src/generated/surface.gen.ts
|
|
@@ -139,20 +128,14 @@ function bindSurface(call) {
|
|
|
139
128
|
youtube: {
|
|
140
129
|
search: post("/v1/youtube/search", call),
|
|
141
130
|
video: post("/v1/youtube/video", call),
|
|
142
|
-
|
|
143
|
-
comments: Object.assign(post("/v1/youtube/comments", call), {
|
|
144
|
-
replies: post("/v1/youtube/comments/replies", call)
|
|
145
|
-
}),
|
|
131
|
+
comments: post("/v1/youtube/comments", call),
|
|
146
132
|
channel: post("/v1/youtube/channel", call),
|
|
147
|
-
playlist: post("/v1/youtube/playlist", call)
|
|
148
|
-
suggest: post("/v1/youtube/suggest", call)
|
|
133
|
+
playlist: post("/v1/youtube/playlist", call)
|
|
149
134
|
},
|
|
135
|
+
transcript: post("/v1/transcript", call),
|
|
150
136
|
reddit: {
|
|
151
137
|
search: post("/v1/reddit/search", call),
|
|
152
138
|
post: post("/v1/reddit/post", call),
|
|
153
|
-
comments: {
|
|
154
|
-
more: post("/v1/reddit/comments/more", call)
|
|
155
|
-
},
|
|
156
139
|
subreddit: post("/v1/reddit/subreddit", call),
|
|
157
140
|
user: post("/v1/reddit/user", call),
|
|
158
141
|
domain: post("/v1/reddit/domain", call)
|
|
@@ -164,59 +147,34 @@ function bindSurface(call) {
|
|
|
164
147
|
},
|
|
165
148
|
instagram: {
|
|
166
149
|
profile: post("/v1/instagram/profile", call),
|
|
167
|
-
posts: post("/v1/instagram/posts", call),
|
|
168
150
|
post: post("/v1/instagram/post", call),
|
|
169
|
-
url: post("/v1/instagram/url", call),
|
|
170
151
|
search: post("/v1/instagram/search", call),
|
|
171
|
-
|
|
172
|
-
comments: Object.assign(post("/v1/instagram/comments", call), {
|
|
173
|
-
replies: post("/v1/instagram/comments/replies", call)
|
|
174
|
-
})
|
|
152
|
+
comments: post("/v1/instagram/comments", call)
|
|
175
153
|
},
|
|
176
154
|
tiktok: {
|
|
177
155
|
profile: post("/v1/tiktok/profile", call),
|
|
178
156
|
video: post("/v1/tiktok/video", call),
|
|
179
|
-
url: post("/v1/tiktok/url", call),
|
|
180
|
-
transcript: post("/v1/tiktok/transcript", call),
|
|
181
|
-
posts: post("/v1/tiktok/posts", call),
|
|
182
157
|
hashtag: post("/v1/tiktok/hashtag", call),
|
|
183
|
-
comments:
|
|
184
|
-
|
|
185
|
-
}),
|
|
186
|
-
search: post("/v1/tiktok/search", call),
|
|
187
|
-
ads: {
|
|
188
|
-
search: postOptional("/v1/tiktok/ads/search", call),
|
|
189
|
-
ad: post("/v1/tiktok/ads/ad", call)
|
|
190
|
-
}
|
|
158
|
+
comments: post("/v1/tiktok/comments", call),
|
|
159
|
+
search: post("/v1/tiktok/search", call)
|
|
191
160
|
},
|
|
192
161
|
bluesky: {
|
|
193
162
|
profile: post("/v1/bluesky/profile", call),
|
|
194
|
-
posts: post("/v1/bluesky/posts", call),
|
|
195
163
|
post: post("/v1/bluesky/post", call),
|
|
196
164
|
followers: post("/v1/bluesky/followers", call)
|
|
197
165
|
},
|
|
198
|
-
mastodon: {
|
|
199
|
-
profile: post("/v1/mastodon/profile", call),
|
|
200
|
-
posts: post("/v1/mastodon/posts", call),
|
|
201
|
-
post: post("/v1/mastodon/post", call),
|
|
202
|
-
hashtag: post("/v1/mastodon/hashtag", call)
|
|
203
|
-
},
|
|
204
166
|
threads: {
|
|
205
167
|
profile: post("/v1/threads/profile", call),
|
|
206
|
-
posts: post("/v1/threads/posts", call),
|
|
207
168
|
post: post("/v1/threads/post", call),
|
|
208
169
|
search: post("/v1/threads/search", call)
|
|
209
170
|
},
|
|
210
171
|
telegram: {
|
|
211
|
-
channel: post("/v1/telegram/channel", call),
|
|
212
172
|
posts: post("/v1/telegram/posts", call),
|
|
213
173
|
post: post("/v1/telegram/post", call)
|
|
214
174
|
},
|
|
215
175
|
meta: {
|
|
216
176
|
ads: {
|
|
217
|
-
|
|
218
|
-
page: post("/v1/meta/ads/page", call),
|
|
219
|
-
ad: post("/v1/meta/ads/ad", call)
|
|
177
|
+
page: post("/v1/meta/ads/page", call)
|
|
220
178
|
}
|
|
221
179
|
},
|
|
222
180
|
linkedin: {
|
|
@@ -224,82 +182,40 @@ function bindSurface(call) {
|
|
|
224
182
|
search: postOptional("/v1/linkedin/jobs/search", call),
|
|
225
183
|
job: post("/v1/linkedin/jobs/job", call)
|
|
226
184
|
},
|
|
227
|
-
|
|
228
|
-
search: postOptional("/v1/linkedin/ads/search", call),
|
|
229
|
-
ad: post("/v1/linkedin/ads/ad", call)
|
|
230
|
-
},
|
|
231
|
-
company: Object.assign(post("/v1/linkedin/company", call), {
|
|
232
|
-
posts: post("/v1/linkedin/company/posts", call)
|
|
233
|
-
}),
|
|
185
|
+
company: post("/v1/linkedin/company", call),
|
|
234
186
|
profile: post("/v1/linkedin/profile", call),
|
|
235
187
|
posts: postOptional("/v1/linkedin/posts", call)
|
|
236
188
|
},
|
|
237
189
|
zillow: {
|
|
238
|
-
search:
|
|
190
|
+
search: post("/v1/zillow/search", call),
|
|
239
191
|
property: post("/v1/zillow/property", call)
|
|
240
192
|
},
|
|
241
|
-
google: {
|
|
242
|
-
ads: {
|
|
243
|
-
advertisers: post("/v1/google/ads/advertisers", call),
|
|
244
|
-
search: postOptional("/v1/google/ads/search", call),
|
|
245
|
-
ad: post("/v1/google/ads/ad", call)
|
|
246
|
-
},
|
|
247
|
-
suggest: post("/v1/google/suggest", call),
|
|
248
|
-
trends: {
|
|
249
|
-
interest: post("/v1/google/trends/interest", call),
|
|
250
|
-
regions: post("/v1/google/trends/regions", call),
|
|
251
|
-
related: post("/v1/google/trends/related", call),
|
|
252
|
-
trending: postOptional("/v1/google/trends/trending", call)
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
193
|
upwork: {
|
|
256
194
|
search: postOptional("/v1/upwork/search", call),
|
|
257
195
|
job: post("/v1/upwork/job", call)
|
|
258
196
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
197
|
+
google: {
|
|
198
|
+
trends: Object.assign(post("/v1/google/trends", call), {
|
|
199
|
+
related: post("/v1/google/trends/related", call),
|
|
200
|
+
trending: postOptional("/v1/google/trends/trending", call)
|
|
201
|
+
})
|
|
264
202
|
},
|
|
265
203
|
site: {
|
|
266
|
-
map: post("/v1/site/map", call),
|
|
267
204
|
seo: post("/v1/site/seo", call)
|
|
268
205
|
},
|
|
269
|
-
domain: {
|
|
270
|
-
whois: post("/v1/domain/whois", call),
|
|
271
|
-
dns: post("/v1/domain/dns", call),
|
|
272
|
-
tech: post("/v1/domain/tech", call)
|
|
273
|
-
},
|
|
274
206
|
email: {
|
|
275
|
-
check: post("/v1/email/check", call)
|
|
207
|
+
check: post("/v1/email/check", call),
|
|
208
|
+
find: post("/v1/email/find", call)
|
|
276
209
|
},
|
|
277
210
|
crypto: {
|
|
278
211
|
coins: postOptional("/v1/crypto/coins", call),
|
|
279
212
|
coin: post("/v1/crypto/coin", call),
|
|
280
213
|
history: post("/v1/crypto/history", call),
|
|
281
|
-
trending: postOptional("/v1/crypto/trending", call),
|
|
282
|
-
categories: postOptional("/v1/crypto/categories", call),
|
|
283
|
-
movers: postOptional("/v1/crypto/movers", call),
|
|
284
|
-
new: postOptional("/v1/crypto/new", call),
|
|
285
214
|
dex: {
|
|
286
215
|
search: post("/v1/crypto/dex/search", call),
|
|
287
|
-
|
|
288
|
-
token: post("/v1/crypto/dex/token", call),
|
|
289
|
-
new: postOptional("/v1/crypto/dex/new", call)
|
|
290
|
-
},
|
|
291
|
-
pump: {
|
|
292
|
-
coins: postOptional("/v1/crypto/pump/coins", call),
|
|
293
|
-
coin: post("/v1/crypto/pump/coin", call),
|
|
294
|
-
trades: post("/v1/crypto/pump/trades", call)
|
|
216
|
+
token: post("/v1/crypto/dex/token", call)
|
|
295
217
|
},
|
|
296
|
-
wallet: post("/v1/crypto/wallet", call)
|
|
297
|
-
token: {
|
|
298
|
-
holders: post("/v1/crypto/token/holders", call)
|
|
299
|
-
},
|
|
300
|
-
binance: {
|
|
301
|
-
announcements: postOptional("/v1/crypto/binance/announcements", call)
|
|
302
|
-
}
|
|
218
|
+
wallet: post("/v1/crypto/wallet", call)
|
|
303
219
|
},
|
|
304
220
|
indeed: {
|
|
305
221
|
search: postOptional("/v1/indeed/search", call),
|
|
@@ -313,6 +229,11 @@ function bindSurface(call) {
|
|
|
313
229
|
googletravel: {
|
|
314
230
|
flights: post("/v1/googletravel/flights", call)
|
|
315
231
|
},
|
|
232
|
+
amazon: {
|
|
233
|
+
search: postOptional("/v1/amazon/search", call),
|
|
234
|
+
product: post("/v1/amazon/product", call),
|
|
235
|
+
bestsellers: post("/v1/amazon/bestsellers", call)
|
|
236
|
+
},
|
|
316
237
|
shopify: {
|
|
317
238
|
products: post("/v1/shopify/products", call),
|
|
318
239
|
collections: post("/v1/shopify/collections", call),
|
|
@@ -343,14 +264,6 @@ function bindSurface(call) {
|
|
|
343
264
|
calendar: post("/v1/airbnb/calendar", call),
|
|
344
265
|
reviews: post("/v1/airbnb/reviews", call)
|
|
345
266
|
},
|
|
346
|
-
redfin: {
|
|
347
|
-
search: post("/v1/redfin/search", call),
|
|
348
|
-
property: post("/v1/redfin/property", call)
|
|
349
|
-
},
|
|
350
|
-
realtor: {
|
|
351
|
-
search: post("/v1/realtor/search", call),
|
|
352
|
-
property: post("/v1/realtor/property", call)
|
|
353
|
-
},
|
|
354
267
|
rightmove: {
|
|
355
268
|
search: post("/v1/rightmove/search", call),
|
|
356
269
|
property: post("/v1/rightmove/property", call)
|
|
@@ -363,54 +276,28 @@ function bindSurface(call) {
|
|
|
363
276
|
search: post("/v1/pinterest/search", call),
|
|
364
277
|
pin: post("/v1/pinterest/pin", call),
|
|
365
278
|
board: post("/v1/pinterest/board", call),
|
|
366
|
-
user: post("/v1/pinterest/user", call)
|
|
367
|
-
ads: {
|
|
368
|
-
search: post("/v1/pinterest/ads/search", call),
|
|
369
|
-
ad: post("/v1/pinterest/ads/ad", call)
|
|
370
|
-
}
|
|
279
|
+
user: post("/v1/pinterest/user", call)
|
|
371
280
|
},
|
|
372
281
|
x: {
|
|
373
|
-
|
|
374
|
-
},
|
|
375
|
-
kick: {
|
|
376
|
-
channel: post("/v1/kick/channel", call),
|
|
377
|
-
videos: post("/v1/kick/videos", call),
|
|
378
|
-
clips: post("/v1/kick/clips", call)
|
|
282
|
+
post: post("/v1/x/post", call)
|
|
379
283
|
},
|
|
380
284
|
finance: {
|
|
381
285
|
quote: post("/v1/finance/quote", call),
|
|
382
286
|
history: post("/v1/finance/history", call),
|
|
383
287
|
search: post("/v1/finance/search", call),
|
|
384
|
-
|
|
288
|
+
stock: post("/v1/finance/stock", call)
|
|
385
289
|
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
advertisers: post("/v1/microsoft/ads/advertisers", call)
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
snapchat: {
|
|
394
|
-
profile: post("/v1/snapchat/profile", call),
|
|
395
|
-
ads: {
|
|
396
|
-
search: post("/v1/snapchat/ads/search", call),
|
|
397
|
-
ad: post("/v1/snapchat/ads/ad", call)
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
tumblr: {
|
|
401
|
-
blog: post("/v1/tumblr/blog", call),
|
|
402
|
-
posts: post("/v1/tumblr/posts", call),
|
|
403
|
-
post: post("/v1/tumblr/post", call),
|
|
404
|
-
search: post("/v1/tumblr/search", call)
|
|
290
|
+
ads: {
|
|
291
|
+
search: post("/v1/ads/search", call),
|
|
292
|
+
ad: post("/v1/ads/ad", call),
|
|
293
|
+
advertisers: post("/v1/ads/advertisers", call)
|
|
405
294
|
},
|
|
406
|
-
|
|
407
|
-
question: post("/v1/quora/question", call)
|
|
408
|
-
}
|
|
295
|
+
suggest: post("/v1/suggest", call)
|
|
409
296
|
};
|
|
410
297
|
}
|
|
411
298
|
|
|
412
299
|
// package.json
|
|
413
|
-
var version = "1.0.
|
|
300
|
+
var version = "1.0.2";
|
|
414
301
|
|
|
415
302
|
// src/transport.ts
|
|
416
303
|
var DEFAULT_BASE_URL = "https://api.stophy.dev";
|
|
@@ -427,7 +314,6 @@ function createCaller(options) {
|
|
|
427
314
|
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS
|
|
428
315
|
};
|
|
429
316
|
return async (spec) => {
|
|
430
|
-
const markdown = spec.options?.format === "markdown";
|
|
431
317
|
const headers = new Headers(options.headers);
|
|
432
318
|
if (typeof document === "undefined" && !headers.has("user-agent")) {
|
|
433
319
|
headers.set("user-agent", USER_AGENT);
|
|
@@ -435,7 +321,7 @@ function createCaller(options) {
|
|
|
435
321
|
if (options.apiKey) {
|
|
436
322
|
headers.set("authorization", `Bearer ${options.apiKey}`);
|
|
437
323
|
}
|
|
438
|
-
headers.set("accept",
|
|
324
|
+
headers.set("accept", "application/json");
|
|
439
325
|
if (spec.body !== void 0)
|
|
440
326
|
headers.set("content-type", "application/json");
|
|
441
327
|
const url = withQuery(`${baseUrl}${spec.path}`, spec.query);
|
|
@@ -448,13 +334,12 @@ function createCaller(options) {
|
|
|
448
334
|
body: spec.body === void 0 ? void 0 : JSON.stringify(spec.body),
|
|
449
335
|
signal
|
|
450
336
|
}),
|
|
451
|
-
markdown,
|
|
452
337
|
spec.options?.signal,
|
|
453
338
|
retry
|
|
454
339
|
);
|
|
455
340
|
};
|
|
456
341
|
}
|
|
457
|
-
async function send(baseFetch, url, init,
|
|
342
|
+
async function send(baseFetch, url, init, signal, retry) {
|
|
458
343
|
for (let n = 0; ; n += 1) {
|
|
459
344
|
const deadline = withDeadline(signal, retry.timeoutMs);
|
|
460
345
|
let waitMs;
|
|
@@ -475,7 +360,7 @@ async function send(baseFetch, url, init, markdown, signal, retry) {
|
|
|
475
360
|
}
|
|
476
361
|
waitMs = seconds === void 0 ? backoffMs(n, retry.initialDelayMs) : seconds * 1e3;
|
|
477
362
|
} else {
|
|
478
|
-
return await readBody(response
|
|
363
|
+
return await readBody(response);
|
|
479
364
|
}
|
|
480
365
|
} finally {
|
|
481
366
|
deadline.clear();
|
|
@@ -505,10 +390,9 @@ function withDeadline(signal, timeoutMs) {
|
|
|
505
390
|
}
|
|
506
391
|
};
|
|
507
392
|
}
|
|
508
|
-
async function readBody(response
|
|
393
|
+
async function readBody(response) {
|
|
509
394
|
if (!response.ok) throw await errorFrom(response);
|
|
510
395
|
const text = await response.text();
|
|
511
|
-
if (markdown) return text;
|
|
512
396
|
if (!text) {
|
|
513
397
|
throw failed(response, "Stophy returned an empty response", {});
|
|
514
398
|
}
|