소스 검색

Add post creation GoDoc example

pull/6/head
Matt Baer 6 년 전
부모
커밋
1864082f94
1개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. +18
    -0
      post_test.go

+ 18
- 0
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)
}

불러오는 중...
취소
저장