Procházet zdrojové kódy

Add post creation GoDoc example

pull/6/head
Matt Baer před 6 roky
rodič
revize
1864082f94
1 změnil soubory, kde provedl 18 přidání a 0 odebrání
  1. +18
    -0
      post_test.go

+ 18
- 0
post_test.go Zobrazit soubor

@@ -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)
}

Načítá se…
Zrušit
Uložit