mstdn/ent.Poll

master
Charles Iliya Krempeaux 2024-08-08 09:07:30 -07:00
parent 271f092397
commit 422f33eb2c
1 changed files with 15 additions and 10 deletions

View File

@ -1,20 +1,25 @@
package ent package ent
import ( import (
"github.com/reiver/go-json"
"github.com/reiver/go-jsonint" "github.com/reiver/go-jsonint"
"github.com/reiver/go-opt" "github.com/reiver/go-opt"
"github.com/reiver/go-nul" "github.com/reiver/go-nul"
) )
type Poll struct { type Poll struct {
ID opt.Optional[string] `json:"id"` ID opt.Optional[string] `json:"id,omitempty"`
ExpiresAt nul.Nullable[string] `json:"expires_at"` ExpiresAt nul.Nullable[string] `json:"expires_at,omitempty"`
Expired opt.Optional[bool] `json:"expired"` Expired opt.Optional[bool] `json:"expired,omitempty"`
Multiple opt.Optional[bool] `json:"multiple"` Multiple opt.Optional[bool] `json:"multiple,omitempty"`
VotesCount opt.Optional[jsonint.Int] `json:"votes_count"` VotesCount opt.Optional[jsonint.Int] `json:"votes_count,omitempty"`
VotersCount opt.Optional[jsonint.Int] `json:"voters_count"` VotersCount opt.Optional[jsonint.Int] `json:"voters_count,omitempty"`
Options []PollOption `json:"options"` Options []PollOption `json:"options,omitempty"`
Emojis []CustomEmoji `json:"emojis"` Emojis []CustomEmoji `json:"emojis,omitempty"`
Voted opt.Optional[bool] `json:"voted"` Voted opt.Optional[bool] `json:"voted,omitempty"`
OwnVotes []jsonint.Int `json:"own_votes"` OwnVotes []jsonint.Int `json:"own_votes,omitempty"`
}
func (receiver *Poll) MarshalJSON() ([]byte, error) {
return json.Marshal(*receiver)
} }