From 89c047d2660b0d3ad4acbbc4908dcd9c17e27c91 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Fri, 26 Nov 2021 18:39:20 -0500 Subject: [PATCH] Support setting categories on posts --- category.go | 8 ++++++++ post.go | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 category.go diff --git a/category.go b/category.go new file mode 100644 index 0000000..e498e19 --- /dev/null +++ b/category.go @@ -0,0 +1,8 @@ +package writeas + +// Category represents a post tag with additional metadata, like a title and slug. +type Category struct { + Hashtag string `json:"hashtag"` + Slug string `json:"slug"` + Title string `json:"title"` +} diff --git a/post.go b/post.go index 2a5de4c..a98269e 100644 --- a/post.go +++ b/post.go @@ -52,7 +52,8 @@ type ( IsRTL *bool `json:"rtl,omitempty"` Language *string `json:"lang,omitempty"` - AuthorSlug *string `json:"author"` + AuthorSlug *string `json:"author,omitempty"` + Categories []Category `json:"categories,omitempty"` // Parameters only for creating Crosspost []map[string]string `json:"crosspost,omitempty"`