Update for 0.19.0-rc.1

This commit is contained in:
2023-10-04 16:16:36 -07:00
parent 5a7463d006
commit 2511d0dcc7
9 changed files with 1425 additions and 1483 deletions

View File

@@ -1,38 +0,0 @@
package types
import (
"encoding/json"
"time"
)
// LemmyTime represents a time value returned by the Lemmy server
type LemmyTime struct {
time.Time
}
// MarshalJSON encodes the Lemmy time to its JSON value
func (lt LemmyTime) MarshalJSON() ([]byte, error) {
return json.Marshal(lt.Time.Format("2006-01-02T15:04:05"))
}
// UnmarshalJSON decodes JSON into the Lemmy time struct
func (lt *LemmyTime) UnmarshalJSON(b []byte) error {
var timeStr string
err := json.Unmarshal(b, &timeStr)
if err != nil {
return err
}
if timeStr == "" {
lt.Time = time.Unix(0, 0)
return nil
}
t, err := time.Parse("2006-01-02T15:04:05", timeStr)
if err != nil {
return err
}
lt.Time = t
return nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -6,12 +6,6 @@ type EmptyResponse struct {
LemmyResponse
}
// EmptyData is a request without any fields. It contains
// an Auth field so that the auth token is sent to the server.
type EmptyData struct {
Auth string `json:"auth" url:"auth,omitempty"`
}
// LemmyResponse is embedded in all response structs
// to capture any errors sent by the Lemmy server.
type LemmyResponse struct {