-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from LinkupPlatform/feat/axios
Fix pre publish
- Loading branch information
Showing
23 changed files
with
5,882 additions
and
3,491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Run Tests | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ["18.x", "19.x", "20.x"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install | ||
run: npm install | ||
- name: Build | ||
run: npm run build | ||
- name: Lint | ||
run: npm run lint | ||
- name: Test | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: PR targeting Main | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/_run-tests.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Push on Main | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/_run-tests.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish to npm | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
run-tests: | ||
uses: ./.github/workflows/_run-tests.yaml | ||
|
||
build-and-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm publish --provenance --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,71 @@ | ||
# linkup-js-sdk | ||
A Javascript SDK for the Linkup API | ||
# 🚀 Linkup JS/TS SDK | ||
|
||
[![npm package](https://badge.fury.io/js/linkup-sdk.svg)](https://www.npmjs.com/package/linkup-sdk) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) | ||
|
||
A JS/TS SDK for the [Linkup API](https://linkup-api.readme.io/reference/getting-started), allowing | ||
easy integration with Linkup's services. 🐍 | ||
|
||
## 🌟 Features | ||
|
||
- ✅ **Simple and intuitive API client.** | ||
- 🔍 **Supports both standard and deep search queries.** | ||
- 🔒 **Handles authentication and request management.** | ||
|
||
## 📦 Installation | ||
|
||
Simply install the Linkup JS SDK using `npm` or any other package manager: | ||
|
||
```bash | ||
npm i linkup-sdk | ||
``` | ||
|
||
## 🛠️ Usage | ||
|
||
### Setting Up Your Environment | ||
|
||
#### 1. **🔑 Obtain an API Key:** | ||
|
||
Sign up on [Linkup](https://app.linkup.so) to get your API key. | ||
|
||
#### 2. **⚙️ Set-up the API Key:** | ||
|
||
Pass the Linkup API key to the Linkup Client when creating it. | ||
|
||
```typescript | ||
import { LinkupClient } from 'linkup-sdk'; | ||
|
||
const client = new LinkupClient({ | ||
apiKey: '<YOUR API KEY>', | ||
}); | ||
``` | ||
|
||
### 📋 Examples | ||
|
||
All search queries can be used with two very different modes: | ||
|
||
- with `standard` `depth`, the search will be straightforward and fast, suited for relatively simple | ||
queries (e.g. "What's the weather in Paris today?") | ||
- with `deep` `depth`, the search will use an agentic workflow, which makes it in general slower, | ||
but it will be able to solve more complex queries (e.g. "What is the company profile of LangChain | ||
accross the last few years, and how does it compare to its concurrents?") | ||
|
||
#### 📝 Standard Search Query | ||
|
||
```typescript | ||
import { LinkupClient } from 'linkup-js-sdk'; | ||
|
||
const client = new LinkupClient({ | ||
apiKey: '<YOUR API KEY>', | ||
}); | ||
|
||
const askLinkup = async () => { | ||
return await client.search({ | ||
query: 'Can you tell me which women were awared the Physics Nobel Prize', | ||
depth: 'standard', | ||
outputType: 'sourcedAnswer', | ||
}); | ||
}; | ||
|
||
askLinkup().then(console.log); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import js from '@eslint/js'; | ||
import typescript from '@typescript-eslint/eslint-plugin'; | ||
import tsParser from '@typescript-eslint/parser'; | ||
import prettier from 'eslint-plugin-prettier'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
import globals from 'globals'; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
{ | ||
files: ['**/*.ts'], | ||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
globals: { | ||
...globals.node, | ||
...globals.jest | ||
} | ||
}, | ||
plugins: { | ||
'@typescript-eslint': typescript, | ||
'prettier': prettier | ||
}, | ||
rules: { | ||
...typescript.configs.recommended.rules, | ||
...eslintConfigPrettier.rules, | ||
'prettier/prettier': ['error', { | ||
'useTabs': false, | ||
'tabWidth': 2 | ||
}], | ||
'no-tabs': 'error', | ||
'indent': ['error', 2, { 'SwitchCase': 1 }] | ||
} | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"], | ||
moduleFileExtensions: ["ts", "js", "json", "node"], | ||
collectCoverage: true, | ||
coverageDirectory: "coverage", | ||
coverageReporters: ["text", "lcov"], | ||
transform: { | ||
"^.+\\.ts$": ["ts-jest", { tsconfig: "tsconfig.json" }], | ||
}, | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testMatch: ['**/__tests__/**/*.ts'], | ||
moduleFileExtensions: ['ts', 'js', 'json', 'node'], | ||
collectCoverage: true, | ||
coverageDirectory: 'coverage', | ||
coverageReporters: ['text', 'lcov'], | ||
transform: { | ||
'^.+\\.ts$': ['ts-jest', { tsconfig: 'tsconfig.json' }], | ||
}, | ||
}; |
Oops, something went wrong.