Skip to content

Commit

Permalink
fix start_cursor request type (issue:makenotion#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sho-ki committed May 5, 2024
1 parent 7950edc commit 4d66528
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default class Client {
const url = new URL(`${this.#prefixUrl}${path}`)
if (query) {
for (const [key, value] of Object.entries(query)) {
if (value !== undefined) {
if (value !== undefined && value !== null) {
if (Array.isArray(value)) {
value.forEach(val =>
url.searchParams.append(key, decodeURIComponent(val))
Expand Down Expand Up @@ -615,6 +615,8 @@ export default class Client {
* Type aliases to support the generic request interface.
*/
type Method = "get" | "post" | "patch" | "delete"
type QueryParams = Record<string, string | number | string[]> | URLSearchParams
type QueryParams =
| Record<string, string | number | string[] | null>
| URLSearchParams

type WithAuth<P> = P & { auth?: string }
14 changes: 7 additions & 7 deletions src/api-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9956,7 +9956,7 @@ export const getUser = {
} as const

type ListUsersQueryParameters = {
start_cursor?: string
start_cursor?: string | null
page_size?: number
}

Expand Down Expand Up @@ -10521,7 +10521,7 @@ type GetPagePropertyPathParameters = {
}

type GetPagePropertyQueryParameters = {
start_cursor?: string
start_cursor?: string | null
page_size?: number
}

Expand Down Expand Up @@ -10848,7 +10848,7 @@ type ListBlockChildrenPathParameters = {
}

type ListBlockChildrenQueryParameters = {
start_cursor?: string
start_cursor?: string | null
page_size?: number
}

Expand Down Expand Up @@ -11215,7 +11215,7 @@ type QueryDatabaseBodyParameters = {
| PropertyFilter
| TimestampCreatedTimeFilter
| TimestampLastEditedTimeFilter
start_cursor?: string
start_cursor?: string | null
page_size?: number
archived?: boolean
in_trash?: boolean
Expand Down Expand Up @@ -11256,7 +11256,7 @@ export const queryDatabase = {
} as const

type ListDatabasesQueryParameters = {
start_cursor?: string
start_cursor?: string | null
page_size?: number
}

Expand Down Expand Up @@ -11475,7 +11475,7 @@ type SearchBodyParameters = {
direction: "ascending" | "descending"
}
query?: string
start_cursor?: string
start_cursor?: string | null
page_size?: number
filter?: { property: "object"; value: "page" | "database" }
}
Expand Down Expand Up @@ -11527,7 +11527,7 @@ export const createComment = {

type ListCommentsQueryParameters = {
block_id: IdRequest
start_cursor?: string
start_cursor?: string | null
page_size?: number
}

Expand Down

0 comments on commit 4d66528

Please sign in to comment.