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
10
search.go
10
search.go
@ -7,17 +7,19 @@ import (
|
|||||||
|
|
||||||
type SearchOpts struct {
|
type SearchOpts struct {
|
||||||
Query string `json:"query,omitempty"`
|
Query string `json:"query,omitempty"`
|
||||||
Sort *SearchFilter `json:"sort,omitempty"`
|
Sort *SearchSort `json:"sort,omitempty"`
|
||||||
Filter *SearchFilter `json:"filter,omitempty"`
|
Filter *SearchFilter `json:"filter,omitempty"`
|
||||||
StartCursor string `json:"start_cursor,omitempty"`
|
StartCursor string `json:"start_cursor,omitempty"`
|
||||||
PageSize int `json:"page_size,omitempty"`
|
PageSize int `json:"page_size,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchSort struct {
|
type SearchSort struct {
|
||||||
Direction SortDirection `json:"direction,omitempty"`
|
Direction SortDirection `json:"direction,omitempty"`
|
||||||
Timestamp string `json:"timestamp"`
|
Timestamp SearchSortTimestamp `json:"timestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SearchSortTimestamp string
|
||||||
|
|
||||||
type SearchFilter struct {
|
type SearchFilter struct {
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
Property string `json:"property"`
|
Property string `json:"property"`
|
||||||
@ -32,6 +34,8 @@ type SearchResponse struct {
|
|||||||
|
|
||||||
type SearchResults []interface{}
|
type SearchResults []interface{}
|
||||||
|
|
||||||
|
const SearchSortTimestampLastEditedTime SearchSortTimestamp = "last_edited_time"
|
||||||
|
|
||||||
func (sr *SearchResults) UnmarshalJSON(b []byte) error {
|
func (sr *SearchResults) UnmarshalJSON(b []byte) error {
|
||||||
rawResults := []json.RawMessage{}
|
rawResults := []json.RawMessage{}
|
||||||
err := json.Unmarshal(b, &rawResults)
|
err := json.Unmarshal(b, &rawResults)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user