Skip to content

Commit

Permalink
Add parent to Database type. (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
pllnk authored Jun 23, 2021
1 parent caca095 commit 266cd48
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export interface UnsupportedBlock extends BlockBase {
export interface Database {
object: "database"
id: string
parent: ParentPage | ParentWorkspace
created_time: string
last_edited_time: string
title: RichText[]
Expand Down Expand Up @@ -523,7 +524,7 @@ export interface Sort {
export interface Page {
object: "page"
id: string
parent: Parent
parent: ParentDatabase | ParentPage | ParentWorkspace
created_time: string
last_edited_time: string
archived: boolean
Expand All @@ -533,24 +534,22 @@ export interface Page {
/*
* Parent
*/

export type Parent = DatabaseParent | PageParent | WorkspaceParent
export type ParentInput =
| Omit<DatabaseParent, "type">
| Omit<PageParent, "type">
| Omit<ParentDatabase, "type">
| Omit<ParentPage, "type">
// TODO: use DistributiveOmit?

export interface DatabaseParent {
interface ParentDatabase {
type: "database_id"
database_id: string
}

export interface PageParent {
interface ParentPage {
type: "page_id"
page_id: string
}

export interface WorkspaceParent {
interface ParentWorkspace {
type: "workspace"
}

Expand Down

0 comments on commit 266cd48

Please sign in to comment.