mirror of
https://github.com/omnivore-app/omnivore-api.git
synced 2026-05-21 09:10:36 +00:00
replace authToken with apiKey
This commit is contained in:
@@ -20,7 +20,7 @@ Import the `Omnivore` class and create a new instance with your **API Key** and
|
||||
import { Omnivore } from '@omnivore-app/api'
|
||||
|
||||
const omnivore = new Omnivore({
|
||||
authToken: 'your api key',
|
||||
apiKey: 'your api key',
|
||||
baseUrl: 'https://api-prod.omnivore.app',
|
||||
})
|
||||
|
||||
@@ -175,7 +175,7 @@ The `Omnivore` class accepts an options object with the following properties:
|
||||
|
||||
| Option | Default value | Type | Description |
|
||||
| ----------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------ |
|
||||
| `authToken` | `undefined` | `string` | API key required for authentication. |
|
||||
| `apiKey` | `undefined` | `string` | API key required for authentication. |
|
||||
| `baseUrl` | `"https://api-prod.omnivore.app"` | `string` | The base URL for sending API requests. This can be changed to a local-hosted server. |
|
||||
| `timeoutMs` | `0` | `number` | Number of milliseconds to wait before timeout. |
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@omnivore-app/api",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "Omnivore API Client Library for Node.js",
|
||||
"main": "./dist/src/index.js",
|
||||
"types": "./dist/src/index.d.ts",
|
||||
|
||||
+8
-3
@@ -8,7 +8,7 @@ import {
|
||||
} from './graphql'
|
||||
|
||||
export interface ClientOptions {
|
||||
authToken: string
|
||||
apiKey: string
|
||||
baseUrl?: string
|
||||
timeoutMs?: number
|
||||
}
|
||||
@@ -98,6 +98,8 @@ export interface SearchItemResponse {
|
||||
|
||||
export interface ItemUpdatesParameters {
|
||||
since: string
|
||||
after?: number
|
||||
first?: number
|
||||
}
|
||||
|
||||
export type ItemUpdateReason = 'CREATED' | 'UPDATED' | 'DELETED'
|
||||
@@ -153,7 +155,7 @@ export class Omnivore {
|
||||
exchanges: [fetchExchange],
|
||||
fetchOptions: () => ({
|
||||
headers: {
|
||||
Authorization: clientOptions.authToken,
|
||||
Authorization: clientOptions.apiKey,
|
||||
},
|
||||
timeout: clientOptions.timeoutMs || 0,
|
||||
}),
|
||||
@@ -188,7 +190,10 @@ export class Omnivore {
|
||||
params: ItemUpdatesParameters,
|
||||
): Promise<ItemUpdatesResponse> => {
|
||||
const { data, error } = await this.client
|
||||
.query(UpdatesSinceQuery, params)
|
||||
.query(UpdatesSinceQuery, {
|
||||
...params,
|
||||
after: params.after ? String(params.after) : undefined,
|
||||
})
|
||||
.toPromise()
|
||||
|
||||
const updatesSince = data?.updatesSince
|
||||
|
||||
+2
-2
@@ -128,8 +128,8 @@ export const SearchQuery = graphql(
|
||||
|
||||
export const UpdatesSinceQuery = graphql(
|
||||
`
|
||||
query UpdatesSince($since: Date!) {
|
||||
updatesSince(since: $since) {
|
||||
query UpdatesSince($after: String, $first: Int, $since: Date!) {
|
||||
updatesSince(after: $after, first: $first, since: $since) {
|
||||
__typename
|
||||
... on UpdatesSinceSuccess {
|
||||
edges {
|
||||
|
||||
@@ -7,6 +7,7 @@ export {
|
||||
ItemFormat,
|
||||
ItemType,
|
||||
ItemUpdateReason,
|
||||
ItemUpdatesParameters,
|
||||
ItemUpdatesResponse,
|
||||
Label,
|
||||
LibraryItemState,
|
||||
|
||||
Reference in New Issue
Block a user