Skip to content

Commit 5b9b239

Browse files
1 parent b818202 commit 5b9b239

File tree

92 files changed

+8156
-710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+8156
-710
lines changed

packages/notion-client/src/notion-api.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const pageIdFixturesSuccess = [
77
'067dd719a912471ea9a3ac10710e7fdf',
88
'https://www.notion.so/saasifysh/Embeds-5d4e290ca4604d8fb809af806a6c1749',
99
'Color-Rainbow-54bf56611797480c951e5c1f96cb06f2',
10-
'e68c18a461904eb5a2ddc3748e76b893'
10+
'e68c18a461904eb5a2ddc3748e76b893',
11+
// collections stress test
12+
'nba-3f92ae505636427c897634a15b9f2892'
1113
]
1214

1315
const pageIdFixturesFailure = [

packages/notion-client/src/notion-api.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// import { promises as fs } from 'fs'
12
import got from 'got'
23
import pMap from 'p-map'
34

@@ -120,6 +121,11 @@ export class NotionAPI {
120121
}
121122
)
122123

124+
// await fs.writeFile(
125+
// `${collectionId}-${collectionViewId}.json`,
126+
// JSON.stringify(collectionData.result, null, 2)
127+
// )
128+
123129
recordMap.block = {
124130
...recordMap.block,
125131
...collectionData.recordMap.block
@@ -259,11 +265,6 @@ export class NotionAPI {
259265
type = 'table'
260266
}
261267

262-
if (query.filter) {
263-
const { filter, ...rest } = query
264-
query = rest
265-
}
266-
267268
const loader: any = {
268269
type,
269270
limit,
@@ -278,9 +279,9 @@ export class NotionAPI {
278279
loader.groups = groups
279280
}
280281

281-
if (type === 'board') {
282-
console.log(JSON.stringify({ query, loader }, null, 2))
283-
}
282+
// if (type === 'board') {
283+
// console.log(JSON.stringify({ query, loader }, null, 2))
284+
// }
284285

285286
return this.fetch<notion.CollectionInstance>({
286287
endpoint: 'queryCollection',

packages/notion-types/src/api.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { RecordMap } from './maps'
2+
3+
// API types
4+
// ----------------------------------------------------------------------------
5+
6+
export interface RecordValues<T> {
7+
results: T[]
8+
}
9+
10+
export interface SearchParams {
11+
ancestorId: string
12+
query: string
13+
filters?: {
14+
isDeletedOnly: boolean
15+
excludeTemplates: boolean
16+
isNavigableOnly: boolean
17+
requireEditPermissions: boolean
18+
}
19+
limit?: number
20+
}
21+
22+
export interface SearchResults {
23+
recordMap: RecordMap
24+
results: SearchResult[]
25+
total: number
26+
}
27+
28+
export interface SearchResult {
29+
id: string
30+
isNavigable: boolean
31+
score: number
32+
highlight: {
33+
pathText: string
34+
text: string
35+
}
36+
}
37+
38+
export interface APIError {
39+
errorId: string
40+
name: string
41+
message: string
42+
}

0 commit comments

Comments
 (0)