Add scheduledAt support
parent
9faaa4f0dc
commit
40eaccca40
76
status.go
76
status.go
|
@ -15,35 +15,36 @@ import (
|
||||||
|
|
||||||
// Status is struct to hold status.
|
// Status is struct to hold status.
|
||||||
type Status struct {
|
type Status struct {
|
||||||
ID ID `json:"id"`
|
ID ID `json:"id"`
|
||||||
URI string `json:"uri"`
|
URI string `json:"uri"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Account Account `json:"account"`
|
Account Account `json:"account"`
|
||||||
InReplyToID interface{} `json:"in_reply_to_id"`
|
InReplyToID interface{} `json:"in_reply_to_id"`
|
||||||
InReplyToAccountID interface{} `json:"in_reply_to_account_id"`
|
InReplyToAccountID interface{} `json:"in_reply_to_account_id"`
|
||||||
Reblog *Status `json:"reblog"`
|
Reblog *Status `json:"reblog"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
EditedAt time.Time `json:"edited_at"`
|
EditedAt time.Time `json:"edited_at"`
|
||||||
Emojis []Emoji `json:"emojis"`
|
Emojis []Emoji `json:"emojis"`
|
||||||
RepliesCount int64 `json:"replies_count"`
|
RepliesCount int64 `json:"replies_count"`
|
||||||
ReblogsCount int64 `json:"reblogs_count"`
|
ReblogsCount int64 `json:"reblogs_count"`
|
||||||
FavouritesCount int64 `json:"favourites_count"`
|
FavouritesCount int64 `json:"favourites_count"`
|
||||||
Reblogged interface{} `json:"reblogged"`
|
Reblogged interface{} `json:"reblogged"`
|
||||||
Favourited interface{} `json:"favourited"`
|
Favourited interface{} `json:"favourited"`
|
||||||
Bookmarked interface{} `json:"bookmarked"`
|
Bookmarked interface{} `json:"bookmarked"`
|
||||||
Muted interface{} `json:"muted"`
|
Muted interface{} `json:"muted"`
|
||||||
Sensitive bool `json:"sensitive"`
|
Sensitive bool `json:"sensitive"`
|
||||||
SpoilerText string `json:"spoiler_text"`
|
SpoilerText string `json:"spoiler_text"`
|
||||||
Visibility string `json:"visibility"`
|
Visibility string `json:"visibility"`
|
||||||
MediaAttachments []Attachment `json:"media_attachments"`
|
MediaAttachments []Attachment `json:"media_attachments"`
|
||||||
Mentions []Mention `json:"mentions"`
|
Mentions []Mention `json:"mentions"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
Card *Card `json:"card"`
|
Card *Card `json:"card"`
|
||||||
Poll *Poll `json:"poll"`
|
Poll *Poll `json:"poll"`
|
||||||
Application Application `json:"application"`
|
Application Application `json:"application"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
Pinned interface{} `json:"pinned"`
|
Pinned interface{} `json:"pinned"`
|
||||||
|
ScheduledParams ScheduledParams `json:"params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StatusHistory is a struct to hold status history data.
|
// StatusHistory is a struct to hold status history data.
|
||||||
|
@ -57,6 +58,20 @@ type StatusHistory struct {
|
||||||
MediaAttachments []Attachment `json:"media_attachments"`
|
MediaAttachments []Attachment `json:"media_attachments"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScheduledStatus holds information returned when ScheduledAt is set on a status
|
||||||
|
type ScheduledParams struct {
|
||||||
|
ApplicationID ID `json:"application_id"`
|
||||||
|
Idempotency string `json:"idempotency"`
|
||||||
|
InReplyToID interface{} `json:"in_reply_to_id"`
|
||||||
|
MediaIDs []ID `json:"media_ids"`
|
||||||
|
Poll *Poll `json:"poll"`
|
||||||
|
ScheduledAt *time.Time `json:"scheduled_at,omitempty"`
|
||||||
|
Sensitive bool `json:"sensitive"`
|
||||||
|
SpoilerText string `json:"spoiler_text"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
Visibility string `json:"visibility"`
|
||||||
|
}
|
||||||
|
|
||||||
// Context holds information for a mastodon context.
|
// Context holds information for a mastodon context.
|
||||||
type Context struct {
|
type Context struct {
|
||||||
Ancestors []*Status `json:"ancestors"`
|
Ancestors []*Status `json:"ancestors"`
|
||||||
|
@ -422,6 +437,9 @@ func (c *Client) postStatus(ctx context.Context, toot *Toot, update bool, update
|
||||||
if toot.SpoilerText != "" {
|
if toot.SpoilerText != "" {
|
||||||
params.Set("spoiler_text", toot.SpoilerText)
|
params.Set("spoiler_text", toot.SpoilerText)
|
||||||
}
|
}
|
||||||
|
if !toot.ScheduledAt.IsZero() {
|
||||||
|
params.Set("scheduled_at", toot.ScheduledAt.Format(time.RFC3339))
|
||||||
|
}
|
||||||
|
|
||||||
var status Status
|
var status Status
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Reference in New Issue