From 4d66528bef721298f5b1cc6f3c5e23fdda661819 Mon Sep 17 00:00:00 2001 From: Sho-ki Date: Sun, 5 May 2024 10:59:44 -0700 Subject: [PATCH] fix start_cursor request type (issue:#498) --- src/Client.ts | 6 ++++-- src/api-endpoints.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 338807b9..6d0fd131 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -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)) @@ -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 | URLSearchParams +type QueryParams = + | Record + | URLSearchParams type WithAuth

= P & { auth?: string } diff --git a/src/api-endpoints.ts b/src/api-endpoints.ts index 0af39b58..4167113a 100644 --- a/src/api-endpoints.ts +++ b/src/api-endpoints.ts @@ -9956,7 +9956,7 @@ export const getUser = { } as const type ListUsersQueryParameters = { - start_cursor?: string + start_cursor?: string | null page_size?: number } @@ -10521,7 +10521,7 @@ type GetPagePropertyPathParameters = { } type GetPagePropertyQueryParameters = { - start_cursor?: string + start_cursor?: string | null page_size?: number } @@ -10848,7 +10848,7 @@ type ListBlockChildrenPathParameters = { } type ListBlockChildrenQueryParameters = { - start_cursor?: string + start_cursor?: string | null page_size?: number } @@ -11215,7 +11215,7 @@ type QueryDatabaseBodyParameters = { | PropertyFilter | TimestampCreatedTimeFilter | TimestampLastEditedTimeFilter - start_cursor?: string + start_cursor?: string | null page_size?: number archived?: boolean in_trash?: boolean @@ -11256,7 +11256,7 @@ export const queryDatabase = { } as const type ListDatabasesQueryParameters = { - start_cursor?: string + start_cursor?: string | null page_size?: number } @@ -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" } } @@ -11527,7 +11527,7 @@ export const createComment = { type ListCommentsQueryParameters = { block_id: IdRequest - start_cursor?: string + start_cursor?: string | null page_size?: number }