Skip to content

Commit 84003e3

Browse files
committed
feat: add fetch endpoint
BREAKING CHANGE: removed endpoint parameter in constructor
1 parent 7bbcff4 commit 84003e3

File tree

10 files changed

+265
-155
lines changed

10 files changed

+265
-155
lines changed

README.md

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const client = new LinkupClient({
4141
});
4242
```
4343

44-
### 📋 Examples
44+
### 📋 Search Endpoint
4545

4646
All search queries can be used with two very different modes:
4747

@@ -51,7 +51,7 @@ All search queries can be used with two very different modes:
5151
but it will be able to solve more complex queries (e.g. "What is the company profile of LangChain
5252
accross the last few years, and how does it compare to its concurrents?")
5353

54-
#### 📝 Standard Search Query
54+
#### 📝 Example standard search query
5555

5656
```typescript
5757
import { LinkupClient } from 'linkup-js-sdk';
@@ -60,13 +60,39 @@ const client = new LinkupClient({
6060
apiKey: '<YOUR API KEY>',
6161
});
6262

63-
const askLinkup = async () => {
64-
return await client.search({
65-
query: 'Can you tell me which women were awared the Physics Nobel Prize',
66-
depth: 'standard',
67-
outputType: 'sourcedAnswer',
68-
});
69-
};
63+
const askLinkup = () => client.search({
64+
query: 'Can you tell me which women were awared the Physics Nobel Prize',
65+
depth: 'standard',
66+
outputType: 'sourcedAnswer',
67+
});
68+
69+
askLinkup()
70+
.then(console.log);
71+
.catch(console.error);
72+
```
73+
74+
### ⬇️ Fetch Endpoint
75+
76+
You can use the fetch endpoint to retrieve the content of a given URL either in `html` or `markdown` format.
77+
78+
You can also use the `renderJS` flag to execute the JavaScript code of the page before returning the content.
79+
80+
#### 📝 Example
81+
82+
```typescript
83+
import { LinkupClient } from 'linkup-js-sdk';
84+
85+
const client = new LinkupClient({
86+
apiKey: '<YOUR API KEY>',
87+
});
88+
89+
const fetchLinkup = async () => client.fetch({
90+
url: 'https://www.linkup.so',
91+
outputFormat: 'html',
92+
renderJS: true,
93+
});
7094

71-
askLinkup().then(console.log);
95+
fetchLinkup()
96+
.then(console.log)
97+
.catch(console.error);
7298
```

0 commit comments

Comments
 (0)