Browse Source

Add post creation GoDoc example

pull/6/head
Matt Baer 6 years ago
parent
commit
1864082f94
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      post_test.go

+ 18
- 0
post_test.go View File

@@ -3,6 +3,7 @@ package writeas
import ( import (
"testing" "testing"


"fmt"
"strings" "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)
}

Loading…
Cancel
Save