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