Go client for the Write.as API https://developers.write.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
524 B

  1. package writeas
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestGetCollection(t *testing.T) {
  7. wac := NewClient()
  8. res, err := wac.GetCollection("blog")
  9. if err != nil {
  10. t.Errorf("Unexpected fetch results: %+v, err: %v\n", res, err)
  11. } else {
  12. t.Logf("Post: %+v", res)
  13. if res.Title != "write.as" {
  14. t.Errorf("Unexpected fetch results: %+v\n", res)
  15. }
  16. }
  17. }
  18. func ExampleGetCollection() {
  19. c := NewClient()
  20. coll, err := c.GetCollection("blog")
  21. if err != nil {
  22. fmt.Printf("%v", err)
  23. return
  24. }
  25. fmt.Printf("%+v", coll)
  26. }