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.

README.md 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # go-writeas
  2. Official Write.as Go client library.
  3. ## Installation
  4. ```bash
  5. go get github.com/writeas/go-writeas
  6. ```
  7. ## Documentation
  8. See all functionality and usages in the [API documentation](https://writeas.github.io/docs/).
  9. ### Example usage
  10. ```go
  11. import "github.com/writeas/go-writeas"
  12. func main() {
  13. // Create the client
  14. c := writeas.NewClient()
  15. // Publish a post
  16. p, err := c.CreatePost(&PostParams{
  17. Title: "Title!",
  18. Content: "This is a post.",
  19. Font: "sans",
  20. })
  21. if err != nil {
  22. // Perhaps show err.Error()
  23. }
  24. // Update a published post
  25. p, err := c.UpdatePost(&PostParams{
  26. ID: "3psnxyhqxy3hq",
  27. Token: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  28. Content: "Now it's been updated!",
  29. })
  30. if err != nil {
  31. // handle
  32. }
  33. // Get a published post
  34. p, err := c.GetPost("3psnxyhqxy3hq")
  35. if err != nil {
  36. // handle
  37. }
  38. // Delete a post
  39. err := c.DeletePost(&PostParams{
  40. ID: "3psnxyhqxy3hq",
  41. Token: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  42. })
  43. }
  44. ```
  45. ## Contributing
  46. The library covers our usage, but might not be comprehensive of the API. So we always welcome contributions and improvements from the community. Before sending pull requests, make sure you've done the following:
  47. * Run `go fmt` on all updated .go files.
  48. * Document all structs and funcs.
  49. ## License
  50. MIT