@@ -13,7 +13,7 @@ export interface ClientOptions {
13
13
timeoutMs ?: number
14
14
}
15
15
16
- export type PageType =
16
+ export type ItemType =
17
17
| 'ARTICLE'
18
18
| 'BOOK'
19
19
| 'FILE'
@@ -27,6 +27,8 @@ export type PageType =
27
27
28
28
export interface Label {
29
29
name : string
30
+ color : string | null
31
+ description : string | null
30
32
}
31
33
32
34
export type HighlightType = 'HIGHLIGHT' | 'NOTE' | 'REDACTION'
@@ -44,7 +46,7 @@ export interface Highlight {
44
46
highlightPositionAnchorIndex : number | null
45
47
}
46
48
47
- export interface Node {
49
+ export interface Item {
48
50
id : string
49
51
title : string
50
52
siteName : string | null
@@ -56,7 +58,7 @@ export interface Node {
56
58
highlights : Highlight [ ] | null
57
59
updatedAt : string | null
58
60
savedAt : string
59
- pageType : PageType
61
+ pageType : ItemType
60
62
content : string | null
61
63
publishedAt : string | null
62
64
url : string
@@ -77,17 +79,19 @@ export interface PageInfo {
77
79
totalCount : number | null
78
80
}
79
81
82
+ export type ItemFormat = 'html' | 'markdown'
83
+
80
84
export interface SearchItemParameters {
81
- after ?: string
85
+ after ?: number
82
86
first ?: number
83
- format ?: 'html' | 'markdown'
87
+ format ?: ItemFormat
84
88
includeContent ?: boolean
85
89
query ?: string
86
90
}
87
91
88
92
export interface SearchItemResponse {
89
93
edges : {
90
- node : Node
94
+ node : Item
91
95
} [ ]
92
96
pageInfo : PageInfo
93
97
}
@@ -96,34 +100,34 @@ export interface ItemUpdatesParameters {
96
100
since : string
97
101
}
98
102
103
+ export type ItemUpdateReason = 'CREATED' | 'UPDATED' | 'DELETED'
104
+
99
105
export interface ItemUpdatesResponse {
100
106
edges : {
101
107
itemID : string
102
- updateReason : 'CREATED' | 'UPDATED' | 'DELETED'
103
- node : Node | null
108
+ updateReason : ItemUpdateReason
109
+ node : Item | null
104
110
} [ ]
105
111
pageInfo : PageInfo
106
112
}
107
113
114
+ export type LibraryItemState =
115
+ | 'DELETED'
116
+ | 'ARCHIVED'
117
+ | 'CONTENT_NOT_FETCHED'
118
+ | 'FAILED'
119
+ | 'PROCESSING'
120
+ | 'SUCCEEDED'
121
+
108
122
export interface SaveItemByUrlParameters {
109
123
url : string
110
124
clientRequestId ?: string
111
125
source ?: string
112
- state ?:
113
- | 'DELETED'
114
- | 'ARCHIVED'
115
- | 'CONTENT_NOT_FETCHED'
116
- | 'FAILED'
117
- | 'PROCESSING'
118
- | 'SUCCEEDED'
126
+ state ?: LibraryItemState
119
127
timezone ?: string
120
128
locale ?: string
121
129
folder ?: string
122
- labels ?: {
123
- name : string
124
- color ?: string
125
- description ?: string
126
- } [ ]
130
+ labels ?: Label [ ]
127
131
publishedAt : string
128
132
savedAt : string
129
133
}
@@ -163,7 +167,10 @@ export class Omnivore {
163
167
params : SearchItemParameters ,
164
168
) : Promise < SearchItemResponse > => {
165
169
const { data, error } = await this . client
166
- . query ( SearchQuery , params )
170
+ . query ( SearchQuery , {
171
+ ...params ,
172
+ after : params . after ? String ( params . after ) : undefined ,
173
+ } )
167
174
. toPromise ( )
168
175
169
176
const search = data ?. search
0 commit comments