1
0
mirror of https://github.com/writeas/go-writeas.git synced 2025-07-26 20:38:13 +00:00
Go client for the Write.as API https://developers.write.as
Go to file
Matt Baer bbe9a57d56 Move to h12.io/socks library
Our Code.as site is periodically down, so this should cause fewer problems
2025-01-07 20:20:41 -05:00
.github Update developer.write.as -> developers.write.as 2019-08-15 13:46:30 -04:00
.gitignore
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 Move to h12.io/socks library 2025-01-07 20:20:41 -05:00
go.sum Move to h12.io/socks library 2025-01-07 20:20:41 -05: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 Use /v2 path in README examples 2023-03-16 14:23:51 -04:00
user.go Gracefully catch 401 error in Client.GetMe method 2023-03-16 14:26:19 -04:00
writeas.go Move to h12.io/socks library 2025-01-07 20:20:41 -05:00

go-writeas

godoc

Official Write.as Go client library.

Installation

go get github.com/writeas/go-writeas/v2

Documentation

See all functionality and usages in the API documentation.

Example usage

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

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