mirror of
https://github.com/dstotijn/go-notion.git
synced 2025-06-06 23:36:14 +02:00
Fix faulty search sort type, add consts for sort props
This commit is contained in:
parent
132dd31efd
commit
5197b070b9
@ -7,7 +7,7 @@ import (
|
||||
|
||||
type SearchOpts struct {
|
||||
Query string `json:"query,omitempty"`
|
||||
Sort *SearchFilter `json:"sort,omitempty"`
|
||||
Sort *SearchSort `json:"sort,omitempty"`
|
||||
Filter *SearchFilter `json:"filter,omitempty"`
|
||||
StartCursor string `json:"start_cursor,omitempty"`
|
||||
PageSize int `json:"page_size,omitempty"`
|
||||
@ -15,9 +15,11 @@ type SearchOpts struct {
|
||||
|
||||
type SearchSort struct {
|
||||
Direction SortDirection `json:"direction,omitempty"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Timestamp SearchSortTimestamp `json:"timestamp"`
|
||||
}
|
||||
|
||||
type SearchSortTimestamp string
|
||||
|
||||
type SearchFilter struct {
|
||||
Value string `json:"value"`
|
||||
Property string `json:"property"`
|
||||
@ -32,6 +34,8 @@ type SearchResponse struct {
|
||||
|
||||
type SearchResults []interface{}
|
||||
|
||||
const SearchSortTimestampLastEditedTime SearchSortTimestamp = "last_edited_time"
|
||||
|
||||
func (sr *SearchResults) UnmarshalJSON(b []byte) error {
|
||||
rawResults := []json.RawMessage{}
|
||||
err := json.Unmarshal(b, &rawResults)
|
||||
|
Loading…
x
Reference in New Issue
Block a user