Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix start_cursor request type (issue:#498) #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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