connectedpapers-js
Advanced tools
Comparing version
@@ -110,3 +110,3 @@ type PaperId = string; | ||
}): Promise<GraphResponse>; | ||
getRmainingUsages(): Promise<number>; | ||
getRemainingUsages(): Promise<number>; | ||
getFreeAccessPapers(): Promise<PaperId[]>; | ||
@@ -113,0 +113,0 @@ } |
@@ -194,3 +194,3 @@ "use strict"; | ||
} | ||
getRmainingUsages() { | ||
getRemainingUsages() { | ||
return __async(this, null, function* () { | ||
@@ -197,0 +197,0 @@ try { |
{ | ||
"name": "connectedpapers-js", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "The official client for the connected papers API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -24,3 +24,3 @@ # connectedpapers-js | ||
}); | ||
client.getRmainingUsages().then((remainingUses) => { | ||
client.getRemainingUsages().then((remainingUses) => { | ||
console.log(`Remaining uses: ${remainingUses}`); | ||
@@ -35,11 +35,28 @@ }); | ||
The following async functions are part of the connected papers API: | ||
* `getPaper({paper_id: string, fresh_only: boolean})`: Returns the paper with the given id. If `fresh_only` is true, then if the graph is over 30 days old, the call will wait for a rebuild. | ||
* `getRmainingUsages()`: Returns the number of remaining usages for the current API key. | ||
* `getPaper({paper_id: string, fresh_only: boolean})`: Returns the paper with the given ID. If fresh_only is true, then if the graph is over 30 days old, the call will wait for a rebuild. | ||
* `getRemainingUsages()`: Returns the number of remaining usages for the current API key. | ||
* `getFreeAccessPapers()`: Returns the number of free access papers for the current API key. | ||
## Free access papers | ||
If you have accessed a paper's graph in the last 30 days, | ||
accessing it again will not count towards your usage limit | ||
on subsequent calls. This is called a free access paper. | ||
If you've already accessed a paper's graph within the past | ||
30 days, any additional access to the same graph during | ||
this period won't be counted against your usage limit. | ||
Such repeated access is considered "free," and the paper | ||
in question is referred to as a "free access paper." | ||
# Supplying an API key | ||
There are two ways to supply an API key to the client: | ||
* Set the `CONNECTED_PAPERS_API_KEY` environment variable. | ||
```bash | ||
export CONNECTED_PAPERS_API_KEY="<your api key>" | ||
``` | ||
Then create the client without any arguments: | ||
```js | ||
const client = new ConnectedPapersClient(); | ||
``` | ||
* Pass the API key as an argument to the constructor: | ||
```js | ||
const client = new ConnectedPapersClient({access_token: "<your api key>"}); | ||
``` | ||
## Async iterator access | ||
@@ -93,16 +110,1 @@ The client also supports async iterator access to the API. This is useful for | ||
will stop. The `graph_json` field will have the graph at each of these responses. | ||
# Supplying an API key | ||
There are two ways to supply an API key to the client: | ||
* Set the `CONNECTED_PAPERS_API_KEY` environment variable. | ||
```bash | ||
export CONNECTED_PAPERS_API_KEY="<your api key>" | ||
``` | ||
Then create the client without any arguments: | ||
```js | ||
const client = new ConnectedPapersClient(); | ||
``` | ||
* Pass the API key as an argument to the constructor: | ||
```js | ||
const client = new ConnectedPapersClient({access_token: "<your api key>"}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
44119
0.25%108
1.89%