@@ -4,4 +4,4 @@ | |||||
## Implementation | ## Implementation | ||||
[API documentation](https://developer.write.as/docs/api/?go#TODO-ENTER-SECTION-HERE). | |||||
[API documentation](https://developers.write.as/docs/api/?go#TODO-ENTER-SECTION-HERE). |
@@ -16,7 +16,7 @@ go get go.code.as/writeas.v2 | |||||
## Documentation | ## Documentation | ||||
See all functionality and usages in the [API documentation](https://developer.write.as/docs/api/). | |||||
See all functionality and usages in the [API documentation](https://developers.write.as/docs/api/). | |||||
### Example usage | ### Example usage | ||||
@@ -6,7 +6,7 @@ import ( | |||||
) | ) | ||||
// LogIn authenticates a user with Write.as. | // LogIn authenticates a user with Write.as. | ||||
// See https://developer.write.as/docs/api/#authenticate-a-user | |||||
// See https://developers.write.as/docs/api/#authenticate-a-user | |||||
func (c *Client) LogIn(username, pass string) (*AuthUser, error) { | func (c *Client) LogIn(username, pass string) (*AuthUser, error) { | ||||
u := &AuthUser{} | u := &AuthUser{} | ||||
up := struct { | up := struct { | ||||
@@ -34,7 +34,7 @@ type ( | |||||
// CreateCollection creates a new collection, returning a user-friendly error | // CreateCollection creates a new collection, returning a user-friendly error | ||||
// if one comes up. Requires a Write.as subscription. See | // if one comes up. Requires a Write.as subscription. See | ||||
// https://developer.write.as/docs/api/#create-a-collection | |||||
// https://developers.write.as/docs/api/#create-a-collection | |||||
func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) { | func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) { | ||||
p := &Collection{} | p := &Collection{} | ||||
env, err := c.post("/collections", sp, p) | env, err := c.post("/collections", sp, p) | ||||
@@ -65,7 +65,7 @@ func (c *Client) CreateCollection(sp *CollectionParams) (*Collection, error) { | |||||
// GetCollection retrieves a collection, returning the Collection and any error | // GetCollection retrieves a collection, returning the Collection and any error | ||||
// (in user-friendly form) that occurs. See | // (in user-friendly form) that occurs. See | ||||
// https://developer.write.as/docs/api/#retrieve-a-collection | |||||
// https://developers.write.as/docs/api/#retrieve-a-collection | |||||
func (c *Client) GetCollection(alias string) (*Collection, error) { | func (c *Client) GetCollection(alias string) (*Collection, error) { | ||||
coll := &Collection{} | coll := &Collection{} | ||||
env, err := c.get(fmt.Sprintf("/collections/%s", alias), coll) | env, err := c.get(fmt.Sprintf("/collections/%s", alias), coll) | ||||
@@ -90,7 +90,7 @@ func (c *Client) GetCollection(alias string) (*Collection, error) { | |||||
// GetCollectionPosts retrieves a collection's posts, returning the Posts | // GetCollectionPosts retrieves a collection's posts, returning the Posts | ||||
// and any error (in user-friendly form) that occurs. See | // and any error (in user-friendly form) that occurs. See | ||||
// https://developer.write.as/docs/api/#retrieve-collection-posts | |||||
// https://developers.write.as/docs/api/#retrieve-collection-posts | |||||
func (c *Client) GetCollectionPosts(alias string) (*[]Post, error) { | func (c *Client) GetCollectionPosts(alias string) (*[]Post, error) { | ||||
coll := &Collection{} | coll := &Collection{} | ||||
env, err := c.get(fmt.Sprintf("/collections/%s/posts", alias), coll) | env, err := c.get(fmt.Sprintf("/collections/%s/posts", alias), coll) | ||||
@@ -84,7 +84,7 @@ type ( | |||||
// GetPost retrieves a published post, returning the Post and any error (in | // GetPost retrieves a published post, returning the Post and any error (in | ||||
// user-friendly form) that occurs. See | // user-friendly form) that occurs. See | ||||
// https://developer.write.as/docs/api/#retrieve-a-post. | |||||
// https://developers.write.as/docs/api/#retrieve-a-post. | |||||
func (c *Client) GetPost(id string) (*Post, error) { | func (c *Client) GetPost(id string) (*Post, error) { | ||||
p := &Post{} | p := &Post{} | ||||
env, err := c.get(fmt.Sprintf("/posts/%s", id), p) | env, err := c.get(fmt.Sprintf("/posts/%s", id), p) | ||||
@@ -109,7 +109,7 @@ func (c *Client) GetPost(id string) (*Post, error) { | |||||
} | } | ||||
// CreatePost publishes a new post, returning a user-friendly error if one comes | // CreatePost publishes a new post, returning a user-friendly error if one comes | ||||
// up. See https://developer.write.as/docs/api/#publish-a-post. | |||||
// up. See https://developers.write.as/docs/api/#publish-a-post. | |||||
func (c *Client) CreatePost(sp *PostParams) (*Post, error) { | func (c *Client) CreatePost(sp *PostParams) (*Post, error) { | ||||
p := &Post{} | p := &Post{} | ||||
endPre := "" | endPre := "" | ||||
@@ -137,7 +137,7 @@ func (c *Client) CreatePost(sp *PostParams) (*Post, error) { | |||||
} | } | ||||
// UpdatePost updates a published post with the given PostParams. See | // UpdatePost updates a published post with the given PostParams. See | ||||
// https://developer.write.as/docs/api/#update-a-post. | |||||
// https://developers.write.as/docs/api/#update-a-post. | |||||
func (c *Client) UpdatePost(id, token string, sp *PostParams) (*Post, error) { | func (c *Client) UpdatePost(id, token string, sp *PostParams) (*Post, error) { | ||||
return c.updatePost("", id, token, sp) | return c.updatePost("", id, token, sp) | ||||
} | } | ||||
@@ -176,7 +176,7 @@ func (c *Client) updatePost(collection, identifier, token string, sp *PostParams | |||||
} | } | ||||
// DeletePost permanently deletes a published post. See | // DeletePost permanently deletes a published post. See | ||||
// https://developer.write.as/docs/api/#delete-a-post. | |||||
// https://developers.write.as/docs/api/#delete-a-post. | |||||
func (c *Client) DeletePost(id, token string) error { | func (c *Client) DeletePost(id, token string) error { | ||||
return c.deletePost("", id, token) | return c.deletePost("", id, token) | ||||
} | } | ||||
@@ -209,7 +209,7 @@ func (c *Client) deletePost(collection, identifier, token string) error { | |||||
} | } | ||||
// ClaimPosts associates anonymous posts with a user / account. | // ClaimPosts associates anonymous posts with a user / account. | ||||
// https://developer.write.as/docs/api/#claim-posts. | |||||
// https://developers.write.as/docs/api/#claim-posts. | |||||
func (c *Client) ClaimPosts(sp *[]OwnedPostParams) (*[]ClaimPostResult, error) { | func (c *Client) ClaimPosts(sp *[]OwnedPostParams) (*[]ClaimPostResult, error) { | ||||
p := &[]ClaimPostResult{} | p := &[]ClaimPostResult{} | ||||
env, err := c.post("/posts/claim", sp, p) | env, err := c.post("/posts/claim", sp, p) | ||||