model.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright 2022 gorse Project Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package client
  15. import "time"
  16. type Feedback struct {
  17. FeedbackType string `json:"FeedbackType"`
  18. UserId string `json:"UserId"`
  19. ItemId string `json:"ItemId"`
  20. Timestamp string `json:"Timestamp"`
  21. }
  22. type Feedbacks struct {
  23. Cursor string `json:"Cursor"`
  24. Feedback []Feedback `json:"Feedback"`
  25. }
  26. type ErrorMessage string
  27. func (e ErrorMessage) Error() string {
  28. return string(e)
  29. }
  30. type RowAffected struct {
  31. RowAffected int `json:"RowAffected"`
  32. }
  33. type Score struct {
  34. Id string `json:"Id"`
  35. Score float64 `json:"Score"`
  36. }
  37. type User struct {
  38. UserId string `json:"UserId"`
  39. Labels []string `json:"Labels"`
  40. Subscribe []string `json:"Subscribe"`
  41. Comment string `json:"Comment"`
  42. }
  43. type Users struct {
  44. Cursor string `json:"Cursor"`
  45. Users []User `json:"Users"`
  46. }
  47. type UserPatch struct {
  48. Labels []string
  49. Subscribe []string
  50. Comment *string
  51. }
  52. type Item struct {
  53. ItemId string `json:"ItemId"`
  54. IsHidden bool `json:"IsHidden"`
  55. Labels []string `json:"Labels"`
  56. Categories []string `json:"Categories"`
  57. Timestamp string `json:"Timestamp"`
  58. Comment string `json:"Comment"`
  59. }
  60. type Items struct {
  61. Cursor string `json:"Cursor"`
  62. Items []Item `json:"Items"`
  63. }
  64. type ItemPatch struct {
  65. IsHidden *bool
  66. Categories []string
  67. Timestamp *time.Time
  68. Labels []string
  69. Comment *string
  70. }
  71. type Health struct {
  72. CacheStoreConnected bool `json:"CacheStoreConnected"`
  73. CacheStoreError string `json:"CacheStoreError"`
  74. DataStoreConnected bool `json:"DataStoreConnected"`
  75. DataStoreError string `json:"DataStoreError"`
  76. Ready bool `json:"Ready"`
  77. }