1
0
mirror of https://github.com/writeas/go-writeas.git synced 2025-07-27 15:18:28 +00:00
Go client for the Write.as API https://developers.write.as
Go to file
2023-03-16 14:22:15 -04:00
.github Update developer.write.as -> developers.write.as 2019-08-15 13:46:30 -04:00
.gitignore Initial commit 2015-09-30 15:04:38 -04:00
auth_test.go style: Run goimports on everything 2018-12-25 09:27:00 -08:00
auth.go Update developer.write.as -> developers.write.as 2019-08-15 13:46:30 -04:00
author_test.go Support creating an organization contributor 2021-10-14 13:47:34 -04:00
author.go Support creating an organization contributor 2021-10-14 13:47:34 -04:00
category.go Support setting categories on posts 2021-11-26 18:39:20 -05:00
collection_test.go closes T589 update tests to use dev client 2019-05-28 14:52:30 -07:00
collection.go Update developer.write.as -> developers.write.as 2019-08-15 13:46:30 -04:00
formatting_test.go Support Markdown endpoint 2020-10-14 19:00:49 -04:00
formatting.go Support Markdown endpoint 2020-10-14 19:00:49 -04:00
go.mod Support Go Modules 2019-01-13 10:14:14 -06:00
go.sum Support Go Modules 2019-01-13 10:14:14 -06:00
LICENSE Add README and LICENSE 2016-09-04 21:20:28 -04:00
organization.go Add basic organization structs 2021-10-15 15:57:25 -04:00
post_test.go closes T589 update tests to use dev client 2019-05-28 14:52:30 -07:00
post.go Support setting categories on posts 2021-11-26 18:39:20 -05:00
README.md Link to V2 docs in README 2023-03-16 14:22:15 -04:00
user.go Add Client.GetMe() method 2021-11-15 10:30:35 -05:00
writeas.go Add SetClient method 2021-11-26 18:46:56 -05:00

go-writeas

godoc

Official Write.as Go client library.

Installation

go get github.com/writeas/go-writeas

Documentation

See all functionality and usages in the API documentation.

Example usage

import "github.com/writeas/go-writeas"

func main() {
	// Create the client
	c := writeas.NewClient()

	// Publish a post
	p, err := c.CreatePost(&writeas.PostParams{
		Title:   "Title!",
		Content: "This is a post.",
		Font:    "sans",
	})
	if err != nil {
		// Perhaps show err.Error()
	}

	// Save token for later, since it won't ever be returned again
	token := p.Token

	// Update a published post
	p, err = c.UpdatePost(p.ID, token, &writeas.PostParams{
		Content: "Now it's been updated!",
	})
	if err != nil {
		// handle
	}

	// Get a published post
	p, err = c.GetPost(p.ID)
	if err != nil {
		// handle
	}

	// Delete a post
	err = c.DeletePost(p.ID, token)
}

Contributing

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:

  • Run goimports on all updated .go files.
  • Document all exported structs and funcs.

License

MIT