qwksearch-api-client 0.0.7 → 0.0.9

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.
@@ -298,48 +298,51 @@ GET /search?q={query}&cat={category}&recency={filter}&lang={language}
298
298
  #### Example Usage
299
299
 
300
300
  ```javascript
301
+ import * as qwk from 'qwksearch-api-client';
302
+
301
303
  // Basic search
302
- const response = await fetch('https://qwksearch.com/api/search?q=quantum+computing');
303
- const { results } = await response.json();
304
+ const searchResults = await qwk.searchWeb({
305
+ query: {
306
+ q: 'quantum computing'
307
+ }
308
+ });
304
309
 
305
- results.forEach(result => {
310
+ searchResults.results.forEach(result => {
306
311
  console.log(result.title, result.url);
307
312
  });
308
313
 
309
314
  // Advanced search
310
- const response = await fetch('https://qwksearch.com/api/search?' + new URLSearchParams({
311
- q: 'climate change',
312
- cat: 'science',
313
- recency: 'month',
314
- lang: 'en-US',
315
- page: 1
316
- }));
317
-
318
- const { results } = await response.json();
319
- ```
320
-
321
- ```python
322
- # Python example
323
- import requests
324
-
325
- # News search
326
- response = requests.get('https://qwksearch.com/api/search', params={
327
- 'q': 'artificial intelligence',
328
- 'cat': 'news',
329
- 'recency': 'week',
330
- 'page': 1
331
- })
315
+ const scienceResults = await qwk.searchWeb({
316
+ query: {
317
+ q: 'climate change',
318
+ cat: 'science',
319
+ recency: 'month',
320
+ lang: 'en-US',
321
+ page: 1
322
+ }
323
+ });
332
324
 
333
- results = response.json()['results']
325
+ // News search
326
+ const newsResults = await qwk.searchWeb({
327
+ query: {
328
+ q: 'artificial intelligence',
329
+ cat: 'news',
330
+ recency: 'week',
331
+ page: 1
332
+ }
333
+ });
334
334
 
335
- for item in results:
336
- print(f"{item['title']}\n{item['url']}\n{item['snippet']}\n")
335
+ newsResults.results.forEach(item => {
336
+ console.log(`${item.title}\n${item.url}\n${item.snippet}\n`);
337
+ });
337
338
 
338
- # Video search
339
- videos = requests.get('https://qwksearch.com/api/search', params={
340
- 'q': 'machine learning tutorial',
341
- 'cat': 'videos'
342
- }).json()['results']
339
+ // Video search
340
+ const videoResults = await qwk.searchWeb({
341
+ query: {
342
+ q: 'machine learning tutorial',
343
+ cat: 'videos'
344
+ }
345
+ });
343
346
  ```
344
347
 
345
348
  ---
@@ -365,18 +368,16 @@ pip install qwksearch-api-client
365
368
  Combine all three endpoints to create a complete research pipeline:
366
369
 
367
370
  ```javascript
368
- import { QwkSearchClient } from 'qwksearch-api-client';
369
-
370
- const client = new QwkSearchClient({
371
- groqApiKey: process.env.GROQ_API_KEY
372
- });
371
+ import * as qwk from 'qwksearch-api-client';
373
372
 
374
373
  async function researchTopic(topic) {
375
374
  // 1. Search for relevant articles
376
- const searchResults = await client.search({
377
- q: topic,
378
- cat: 'science',
379
- recency: 'month'
375
+ const searchResults = await qwk.searchWeb({
376
+ query: {
377
+ q: topic,
378
+ cat: 'science',
379
+ recency: 'month'
380
+ }
380
381
  });
381
382
 
382
383
  console.log(`Found ${searchResults.results.length} results`);
@@ -384,8 +385,10 @@ async function researchTopic(topic) {
384
385
  // 2. Extract content from top 3 results
385
386
  const articles = await Promise.all(
386
387
  searchResults.results.slice(0, 3).map(async (result) => {
387
- const content = await client.extract({
388
- url: result.url
388
+ const content = await qwk.extractContent({
389
+ query: {
390
+ url: result.url
391
+ }
389
392
  });
390
393
  return content;
391
394
  })
@@ -396,10 +399,13 @@ async function researchTopic(topic) {
396
399
  .map(a => `${a.title}\n\n${a.html}`)
397
400
  .join('\n\n---\n\n');
398
401
 
399
- const summary = await client.generateLanguage({
400
- provider: 'groq',
401
- agent: 'summarize-bullets',
402
- article: combinedText
402
+ const summary = await qwk.generateLanguage({
403
+ body: {
404
+ provider: 'groq',
405
+ key: process.env.GROQ_API_KEY,
406
+ agent: 'summarize-bullets',
407
+ article: combinedText
408
+ }
403
409
  });
404
410
 
405
411
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwksearch-api-client",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "QwkSearch API Client - Generated from openapi-docs.yml",
5
5
  "type": "module",
6
6
  "main": "./dist/api-client.js",