From 1864082f94a1bb18e05c45bc8cf9238435a3ad48 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 15 Feb 2018 15:28:35 -0500 Subject: [PATCH] Add post creation GoDoc example --- post_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/post_test.go b/post_test.go index bb6c578..c76f251 100644 --- a/post_test.go +++ b/post_test.go @@ -3,6 +3,7 @@ package writeas import ( "testing" + "fmt" "strings" ) @@ -71,3 +72,20 @@ func TestGetPost(t *testing.T) { } } } + +func ExampleClient_CreatePost() { + c := NewClient() + + // Publish a post + p, err := c.CreatePost(&PostParams{ + Title: "Title!", + Content: "This is a post.", + Font: "sans", + }) + if err != nil { + fmt.Printf("Unable to create: %v", err) + return + } + + fmt.Printf("%+v", p) +}