mirror of
https://github.com/dstotijn/go-notion.git
synced 2024-11-24 08:42:26 +02:00
Add created_by
and last_edited_by
support, add archived
for DB (#30)
This commit is contained in:
parent
264ec2c28f
commit
1320ab0ee0
22
block.go
22
block.go
@ -12,6 +12,8 @@ type Block interface {
|
|||||||
ID() string
|
ID() string
|
||||||
Parent() Parent
|
Parent() Parent
|
||||||
CreatedTime() time.Time
|
CreatedTime() time.Time
|
||||||
|
CreatedBy() BaseUser
|
||||||
|
LastEditedBy() BaseUser
|
||||||
LastEditedTime() time.Time
|
LastEditedTime() time.Time
|
||||||
HasChildren() bool
|
HasChildren() bool
|
||||||
Archived() bool
|
Archived() bool
|
||||||
@ -23,7 +25,9 @@ type blockDTO struct {
|
|||||||
Parent *Parent `json:"parent,omitempty"`
|
Parent *Parent `json:"parent,omitempty"`
|
||||||
Type BlockType `json:"type,omitempty"`
|
Type BlockType `json:"type,omitempty"`
|
||||||
CreatedTime *time.Time `json:"created_time,omitempty"`
|
CreatedTime *time.Time `json:"created_time,omitempty"`
|
||||||
|
CreatedBy *BaseUser `json:"created_by,omitempty"`
|
||||||
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
|
LastEditedTime *time.Time `json:"last_edited_time,omitempty"`
|
||||||
|
LastEditedBy *BaseUser `json:"last_edited_by,omitempty"`
|
||||||
HasChildren bool `json:"has_children,omitempty"`
|
HasChildren bool `json:"has_children,omitempty"`
|
||||||
Archived *bool `json:"archived,omitempty"`
|
Archived *bool `json:"archived,omitempty"`
|
||||||
|
|
||||||
@ -64,7 +68,9 @@ type baseBlock struct {
|
|||||||
id string
|
id string
|
||||||
parent Parent
|
parent Parent
|
||||||
createdTime time.Time
|
createdTime time.Time
|
||||||
|
createdBy BaseUser
|
||||||
lastEditedTime time.Time
|
lastEditedTime time.Time
|
||||||
|
lastEditedBy BaseUser
|
||||||
hasChildren bool
|
hasChildren bool
|
||||||
archived bool
|
archived bool
|
||||||
}
|
}
|
||||||
@ -78,10 +84,18 @@ func (b baseBlock) CreatedTime() time.Time {
|
|||||||
return b.createdTime
|
return b.createdTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b baseBlock) CreatedBy() BaseUser {
|
||||||
|
return b.createdBy
|
||||||
|
}
|
||||||
|
|
||||||
func (b baseBlock) LastEditedTime() time.Time {
|
func (b baseBlock) LastEditedTime() time.Time {
|
||||||
return b.lastEditedTime
|
return b.lastEditedTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b baseBlock) LastEditedBy() BaseUser {
|
||||||
|
return b.lastEditedBy
|
||||||
|
}
|
||||||
|
|
||||||
func (b baseBlock) HasChildren() bool {
|
func (b baseBlock) HasChildren() bool {
|
||||||
return b.hasChildren
|
return b.hasChildren
|
||||||
}
|
}
|
||||||
@ -846,10 +860,18 @@ func (dto blockDTO) Block() Block {
|
|||||||
baseBlock.createdTime = *dto.CreatedTime
|
baseBlock.createdTime = *dto.CreatedTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dto.CreatedBy != nil {
|
||||||
|
baseBlock.createdBy = *dto.CreatedBy
|
||||||
|
}
|
||||||
|
|
||||||
if dto.LastEditedTime != nil {
|
if dto.LastEditedTime != nil {
|
||||||
baseBlock.lastEditedTime = *dto.LastEditedTime
|
baseBlock.lastEditedTime = *dto.LastEditedTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dto.LastEditedBy != nil {
|
||||||
|
baseBlock.lastEditedBy = *dto.LastEditedBy
|
||||||
|
}
|
||||||
|
|
||||||
if dto.Archived != nil {
|
if dto.Archived != nil {
|
||||||
baseBlock.archived = *dto.Archived
|
baseBlock.archived = *dto.Archived
|
||||||
}
|
}
|
||||||
|
100
client_test.go
100
client_test.go
@ -98,6 +98,14 @@ func TestFindDatabaseByID(t *testing.T) {
|
|||||||
"id": "668d797c-76fa-4934-9b05-ad288df2d136",
|
"id": "668d797c-76fa-4934-9b05-ad288df2d136",
|
||||||
"created_time": "2020-03-17T19:10:04.968Z",
|
"created_time": "2020-03-17T19:10:04.968Z",
|
||||||
"last_edited_time": "2020-03-17T21:49:37.913Z",
|
"last_edited_time": "2020-03-17T21:49:37.913Z",
|
||||||
|
"created_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "71e95936-2737-4e11-b03d-f174f6f13087"
|
||||||
|
},
|
||||||
|
"last_edited_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "5ba97cc9-e5e0-4363-b33a-1d80a635577f"
|
||||||
|
},
|
||||||
"url": "https://www.notion.so/668d797c76fa49349b05ad288df2d136",
|
"url": "https://www.notion.so/668d797c76fa49349b05ad288df2d136",
|
||||||
"title": [
|
"title": [
|
||||||
{
|
{
|
||||||
@ -238,7 +246,13 @@ func TestFindDatabaseByID(t *testing.T) {
|
|||||||
ID: "668d797c-76fa-4934-9b05-ad288df2d136",
|
ID: "668d797c-76fa-4934-9b05-ad288df2d136",
|
||||||
CreatedTime: mustParseTime(time.RFC3339, "2020-03-17T19:10:04.968Z"),
|
CreatedTime: mustParseTime(time.RFC3339, "2020-03-17T19:10:04.968Z"),
|
||||||
LastEditedTime: mustParseTime(time.RFC3339, "2020-03-17T21:49:37.913Z"),
|
LastEditedTime: mustParseTime(time.RFC3339, "2020-03-17T21:49:37.913Z"),
|
||||||
URL: "https://www.notion.so/668d797c76fa49349b05ad288df2d136",
|
CreatedBy: notion.BaseUser{
|
||||||
|
ID: "71e95936-2737-4e11-b03d-f174f6f13087",
|
||||||
|
},
|
||||||
|
LastEditedBy: notion.BaseUser{
|
||||||
|
ID: "5ba97cc9-e5e0-4363-b33a-1d80a635577f",
|
||||||
|
},
|
||||||
|
URL: "https://www.notion.so/668d797c76fa49349b05ad288df2d136",
|
||||||
Title: []notion.RichText{
|
Title: []notion.RichText{
|
||||||
{
|
{
|
||||||
Type: notion.RichTextTypeText,
|
Type: notion.RichTextTypeText,
|
||||||
@ -710,7 +724,9 @@ func TestQueryDatabase(t *testing.T) {
|
|||||||
Name: "People",
|
Name: "People",
|
||||||
People: []notion.User{
|
People: []notion.User{
|
||||||
{
|
{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/image.png",
|
AvatarURL: "https://example.com/image.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -774,7 +790,9 @@ func TestQueryDatabase(t *testing.T) {
|
|||||||
Type: notion.DBPropTypeCreatedBy,
|
Type: notion.DBPropTypeCreatedBy,
|
||||||
Name: "Created by",
|
Name: "Created by",
|
||||||
CreatedBy: ¬ion.User{
|
CreatedBy: ¬ion.User{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/image.png",
|
AvatarURL: "https://example.com/image.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -794,7 +812,9 @@ func TestQueryDatabase(t *testing.T) {
|
|||||||
Type: notion.DBPropTypeLastEditedBy,
|
Type: notion.DBPropTypeLastEditedBy,
|
||||||
Name: "Last edited by",
|
Name: "Last edited by",
|
||||||
LastEditedBy: ¬ion.User{
|
LastEditedBy: ¬ion.User{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/image.png",
|
AvatarURL: "https://example.com/image.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -1529,7 +1549,15 @@ func TestFindPageByID(t *testing.T) {
|
|||||||
"object": "page",
|
"object": "page",
|
||||||
"id": "606ed832-7d79-46de-bbed-5b4896e7bc02",
|
"id": "606ed832-7d79-46de-bbed-5b4896e7bc02",
|
||||||
"created_time": "2021-05-19T18:34:00.000Z",
|
"created_time": "2021-05-19T18:34:00.000Z",
|
||||||
|
"created_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "71e95936-2737-4e11-b03d-f174f6f13087"
|
||||||
|
},
|
||||||
"last_edited_time": "2021-05-19T18:34:00.000Z",
|
"last_edited_time": "2021-05-19T18:34:00.000Z",
|
||||||
|
"last_edited_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "5ba97cc9-e5e0-4363-b33a-1d80a635577f"
|
||||||
|
},
|
||||||
"parent": {
|
"parent": {
|
||||||
"type": "page_id",
|
"type": "page_id",
|
||||||
"page_id": "b0668f48-8d66-4733-9bdb-2f82215707f7"
|
"page_id": "b0668f48-8d66-4733-9bdb-2f82215707f7"
|
||||||
@ -1566,10 +1594,16 @@ func TestFindPageByID(t *testing.T) {
|
|||||||
},
|
},
|
||||||
respStatusCode: http.StatusOK,
|
respStatusCode: http.StatusOK,
|
||||||
expPage: notion.Page{
|
expPage: notion.Page{
|
||||||
ID: "606ed832-7d79-46de-bbed-5b4896e7bc02",
|
ID: "606ed832-7d79-46de-bbed-5b4896e7bc02",
|
||||||
CreatedTime: mustParseTime(time.RFC3339Nano, "2021-05-19T18:34:00.000Z"),
|
CreatedTime: mustParseTime(time.RFC3339Nano, "2021-05-19T18:34:00.000Z"),
|
||||||
|
CreatedBy: ¬ion.BaseUser{
|
||||||
|
ID: "71e95936-2737-4e11-b03d-f174f6f13087",
|
||||||
|
},
|
||||||
LastEditedTime: mustParseTime(time.RFC3339Nano, "2021-05-19T18:34:00.000Z"),
|
LastEditedTime: mustParseTime(time.RFC3339Nano, "2021-05-19T18:34:00.000Z"),
|
||||||
URL: "https://www.notion.so/Avocado-251d2b5f268c4de2afe9c71ff92ca95c",
|
LastEditedBy: ¬ion.BaseUser{
|
||||||
|
ID: "5ba97cc9-e5e0-4363-b33a-1d80a635577f",
|
||||||
|
},
|
||||||
|
URL: "https://www.notion.so/Avocado-251d2b5f268c4de2afe9c71ff92ca95c",
|
||||||
Parent: notion.Parent{
|
Parent: notion.Parent{
|
||||||
Type: notion.ParentTypePage,
|
Type: notion.ParentTypePage,
|
||||||
PageID: "b0668f48-8d66-4733-9bdb-2f82215707f7",
|
PageID: "b0668f48-8d66-4733-9bdb-2f82215707f7",
|
||||||
@ -3369,7 +3403,9 @@ func TestFindUserByID(t *testing.T) {
|
|||||||
},
|
},
|
||||||
respStatusCode: http.StatusOK,
|
respStatusCode: http.StatusOK,
|
||||||
expUser: notion.User{
|
expUser: notion.User{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/avatar.png",
|
AvatarURL: "https://example.com/avatar.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -3469,13 +3505,17 @@ func TestFindCurrentUser(t *testing.T) {
|
|||||||
},
|
},
|
||||||
respStatusCode: http.StatusOK,
|
respStatusCode: http.StatusOK,
|
||||||
expUser: notion.User{
|
expUser: notion.User{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Type: notion.UserTypeBot,
|
Type: notion.UserTypeBot,
|
||||||
Bot: ¬ion.Bot{
|
Bot: ¬ion.Bot{
|
||||||
Owner: notion.BotOwner{
|
Owner: notion.BotOwner{
|
||||||
Type: notion.BotOwnerTypeUser,
|
Type: notion.BotOwnerTypeUser,
|
||||||
User: ¬ion.User{
|
User: ¬ion.User{
|
||||||
ID: "5389a034-eb5c-47b5-8a9e-f79c99ef166c",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "5389a034-eb5c-47b5-8a9e-f79c99ef166c",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/avatar.png",
|
AvatarURL: "https://example.com/avatar.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -3595,7 +3635,9 @@ func TestListUsers(t *testing.T) {
|
|||||||
expResponse: notion.ListUsersResponse{
|
expResponse: notion.ListUsersResponse{
|
||||||
Results: []notion.User{
|
Results: []notion.User{
|
||||||
{
|
{
|
||||||
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "be32e790-8292-46df-a248-b784fdf483cf",
|
||||||
|
},
|
||||||
Name: "Jane Doe",
|
Name: "Jane Doe",
|
||||||
AvatarURL: "https://example.com/avatar.png",
|
AvatarURL: "https://example.com/avatar.png",
|
||||||
Type: notion.UserTypePerson,
|
Type: notion.UserTypePerson,
|
||||||
@ -3604,7 +3646,9 @@ func TestListUsers(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "25c9cc08-1afd-4d22-b9e6-31b0f6e7b44f",
|
BaseUser: notion.BaseUser{
|
||||||
|
ID: "25c9cc08-1afd-4d22-b9e6-31b0f6e7b44f",
|
||||||
|
},
|
||||||
Name: "Johnny 5",
|
Name: "Johnny 5",
|
||||||
Type: notion.UserTypeBot,
|
Type: notion.UserTypeBot,
|
||||||
Bot: ¬ion.Bot{},
|
Bot: ¬ion.Bot{},
|
||||||
@ -4013,7 +4057,9 @@ func TestFindBlockByID(t *testing.T) {
|
|||||||
expID string
|
expID string
|
||||||
expParent notion.Parent
|
expParent notion.Parent
|
||||||
expCreatedTime time.Time
|
expCreatedTime time.Time
|
||||||
|
expCreatedBy notion.BaseUser
|
||||||
expLastEditedTime time.Time
|
expLastEditedTime time.Time
|
||||||
|
expLastEditedBy notion.BaseUser
|
||||||
expHasChildren bool
|
expHasChildren bool
|
||||||
expArchived bool
|
expArchived bool
|
||||||
expError error
|
expError error
|
||||||
@ -4031,7 +4077,15 @@ func TestFindBlockByID(t *testing.T) {
|
|||||||
"page_id": "59833787-2cf9-4fdf-8782-e53db20768a5"
|
"page_id": "59833787-2cf9-4fdf-8782-e53db20768a5"
|
||||||
},
|
},
|
||||||
"created_time": "2021-10-02T06:09:00.000Z",
|
"created_time": "2021-10-02T06:09:00.000Z",
|
||||||
|
"created_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "71e95936-2737-4e11-b03d-f174f6f13087"
|
||||||
|
},
|
||||||
"last_edited_time": "2021-10-02T06:31:00.000Z",
|
"last_edited_time": "2021-10-02T06:31:00.000Z",
|
||||||
|
"last_edited_by": {
|
||||||
|
"object": "user",
|
||||||
|
"id": "5ba97cc9-e5e0-4363-b33a-1d80a635577f"
|
||||||
|
},
|
||||||
"has_children": true,
|
"has_children": true,
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"type": "child_page",
|
"type": "child_page",
|
||||||
@ -4050,11 +4104,17 @@ func TestFindBlockByID(t *testing.T) {
|
|||||||
Type: notion.ParentTypePage,
|
Type: notion.ParentTypePage,
|
||||||
PageID: "59833787-2cf9-4fdf-8782-e53db20768a5",
|
PageID: "59833787-2cf9-4fdf-8782-e53db20768a5",
|
||||||
},
|
},
|
||||||
expCreatedTime: mustParseTime(time.RFC3339, "2021-10-02T06:09:00Z"),
|
expCreatedTime: mustParseTime(time.RFC3339, "2021-10-02T06:09:00Z"),
|
||||||
|
expCreatedBy: notion.BaseUser{
|
||||||
|
ID: "71e95936-2737-4e11-b03d-f174f6f13087",
|
||||||
|
},
|
||||||
expLastEditedTime: mustParseTime(time.RFC3339, "2021-10-02T06:31:00Z"),
|
expLastEditedTime: mustParseTime(time.RFC3339, "2021-10-02T06:31:00Z"),
|
||||||
expHasChildren: true,
|
expLastEditedBy: notion.BaseUser{
|
||||||
expArchived: false,
|
ID: "5ba97cc9-e5e0-4363-b33a-1d80a635577f",
|
||||||
expError: nil,
|
},
|
||||||
|
expHasChildren: true,
|
||||||
|
expArchived: false,
|
||||||
|
expError: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "error response not found",
|
name: "error response not found",
|
||||||
@ -4118,10 +4178,18 @@ func TestFindBlockByID(t *testing.T) {
|
|||||||
t.Fatalf("createdTime not equal (expected: %v, got: %v)", tt.expCreatedTime, block.CreatedTime())
|
t.Fatalf("createdTime not equal (expected: %v, got: %v)", tt.expCreatedTime, block.CreatedTime())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tt.expCreatedBy != block.CreatedBy() {
|
||||||
|
t.Fatalf("createdBy not equal (expected: %v, got: %v)", tt.expCreatedBy, block.CreatedBy())
|
||||||
|
}
|
||||||
|
|
||||||
if tt.expLastEditedTime != block.LastEditedTime() {
|
if tt.expLastEditedTime != block.LastEditedTime() {
|
||||||
t.Fatalf("lastEditedTime not equal (expected: %v, got: %v)", tt.expLastEditedTime, block.LastEditedTime())
|
t.Fatalf("lastEditedTime not equal (expected: %v, got: %v)", tt.expLastEditedTime, block.LastEditedTime())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tt.expLastEditedBy != block.LastEditedBy() {
|
||||||
|
t.Fatalf("lastEditedBy not equal (expected: %v, got: %v)", tt.expLastEditedBy, block.LastEditedBy())
|
||||||
|
}
|
||||||
|
|
||||||
if tt.expHasChildren != block.HasChildren() {
|
if tt.expHasChildren != block.HasChildren() {
|
||||||
t.Fatalf("hasChildren not equal (expected: %v, got: %v)", tt.expHasChildren, block.HasChildren())
|
t.Fatalf("hasChildren not equal (expected: %v, got: %v)", tt.expHasChildren, block.HasChildren())
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,16 @@ import (
|
|||||||
type Database struct {
|
type Database struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreatedTime time.Time `json:"created_time"`
|
CreatedTime time.Time `json:"created_time"`
|
||||||
|
CreatedBy BaseUser `json:"created_by"`
|
||||||
LastEditedTime time.Time `json:"last_edited_time"`
|
LastEditedTime time.Time `json:"last_edited_time"`
|
||||||
|
LastEditedBy BaseUser `json:"last_edited_by"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Title []RichText `json:"title"`
|
Title []RichText `json:"title"`
|
||||||
Properties DatabaseProperties `json:"properties"`
|
Properties DatabaseProperties `json:"properties"`
|
||||||
Parent Parent `json:"parent"`
|
Parent Parent `json:"parent"`
|
||||||
Icon *Icon `json:"icon,omitempty"`
|
Icon *Icon `json:"icon,omitempty"`
|
||||||
Cover *Cover `json:"cover,omitempty"`
|
Cover *Cover `json:"cover,omitempty"`
|
||||||
|
Archived bool `json:"archived"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DatabaseProperties is a mapping of properties defined on a database.
|
// DatabaseProperties is a mapping of properties defined on a database.
|
||||||
@ -496,6 +499,7 @@ type UpdateDatabaseParams struct {
|
|||||||
Properties map[string]*DatabaseProperty `json:"properties,omitempty"`
|
Properties map[string]*DatabaseProperty `json:"properties,omitempty"`
|
||||||
Icon *Icon `json:"icon,omitempty"`
|
Icon *Icon `json:"icon,omitempty"`
|
||||||
Cover *Cover `json:"cover,omitempty"`
|
Cover *Cover `json:"cover,omitempty"`
|
||||||
|
Archived *bool `json:"archived,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates params for updating a database.
|
// Validate validates params for updating a database.
|
||||||
|
2
page.go
2
page.go
@ -13,7 +13,9 @@ import (
|
|||||||
type Page struct {
|
type Page struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
CreatedTime time.Time `json:"created_time"`
|
CreatedTime time.Time `json:"created_time"`
|
||||||
|
CreatedBy *BaseUser `json:"created_by,omitempty"`
|
||||||
LastEditedTime time.Time `json:"last_edited_time"`
|
LastEditedTime time.Time `json:"last_edited_time"`
|
||||||
|
LastEditedBy *BaseUser `json:"last_edited_by,omitempty"`
|
||||||
Parent Parent `json:"parent"`
|
Parent Parent `json:"parent"`
|
||||||
Archived bool `json:"archived"`
|
Archived bool `json:"archived"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
|
9
user.go
9
user.go
@ -28,8 +28,15 @@ type BotOwner struct {
|
|||||||
User *User `json:"user"`
|
User *User `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BaseUser contains the fields that are always returned for user objects.
|
||||||
|
// See: https://developers.notion.com/reference/user#where-user-objects-appear-in-the-api
|
||||||
|
type BaseUser struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string `json:"id"`
|
BaseUser
|
||||||
|
|
||||||
Type UserType `json:"type"`
|
Type UserType `json:"type"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
AvatarURL string `json:"avatar_url"`
|
AvatarURL string `json:"avatar_url"`
|
||||||
|
Loading…
Reference in New Issue
Block a user