Add GetInstanceActivity and GetInstancePeers
This commit is contained in:
parent
0d8819ecaf
commit
e0de6af209
4 changed files with 113 additions and 0 deletions
20
unixtime.go
Normal file
20
unixtime.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package mastodon
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Unixtime time.Time
|
||||
|
||||
func (t *Unixtime) UnmarshalJSON(data []byte) error {
|
||||
if len(data) > 0 && data[0] == '"' && data[len(data)-1] == '"' {
|
||||
data = data[1 : len(data)-1]
|
||||
}
|
||||
ts, err := strconv.ParseInt(string(data), 10, 64)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*t = Unixtime(time.Unix(ts, 0))
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue