diff --git a/mastodon.go b/mastodon.go index 0706981..c704e10 100644 --- a/mastodon.go +++ b/mastodon.go @@ -230,6 +230,7 @@ type Toot struct { Sensitive bool `json:"sensitive"` SpoilerText string `json:"spoiler_text"` Visibility string `json:"visibility"` + Language string `json:"language"` ScheduledAt *time.Time `json:"scheduled_at,omitempty"` Poll *TootPoll `json:"poll"` } diff --git a/mastodon_test.go b/mastodon_test.go index ff3fc5c..0ef9d07 100644 --- a/mastodon_test.go +++ b/mastodon_test.go @@ -252,6 +252,9 @@ func TestPostStatusParams(t *testing.T) { if r.FormValue("visibility") != "" { s.Visibility = (r.FormValue("visibility")) } + if r.FormValue("language") != "" { + s.Language = (r.FormValue("language")) + } if r.FormValue("sensitive") == "true" { s.Sensitive = true s.SpoilerText = fmt.Sprintf("
%s
", r.FormValue("spoiler_text")) @@ -288,6 +291,7 @@ func TestPostStatusParams(t *testing.T) { Status: "foobar", InReplyToID: ID("2"), Visibility: "unlisted", + Language: "sv", Sensitive: true, SpoilerText: "bar", MediaIDs: []ID{"1", "2"}, @@ -310,6 +314,9 @@ func TestPostStatusParams(t *testing.T) { if s.Visibility != "unlisted" { t.Fatalf("want %q but %q", "unlisted", s.Visibility) } + if s.Language != "sv" { + t.Fatalf("want %q but %q", "sv", s.Language) + } if s.Sensitive != true { t.Fatalf("want %t but %t", true, s.Sensitive) } diff --git a/status.go b/status.go index e616366..f5cc451 100644 --- a/status.go +++ b/status.go @@ -365,6 +365,9 @@ func (c *Client) PostStatus(ctx context.Context, toot *Toot) (*Status, error) { if toot.Visibility != "" { params.Set("visibility", fmt.Sprint(toot.Visibility)) } + if toot.Language != "" { + params.Set("language", fmt.Sprint(toot.Language)) + } if toot.Sensitive { params.Set("sensitive", "true") }