|
|
@@ -1,13 +1,13 @@ |
|
|
|
# go-writeas |
|
|
|
|
|
|
|
[![godoc](https://godoc.org/go.code.as/writeas.v1?status.svg)](https://godoc.org/go.code.as/writeas.v1) |
|
|
|
[![godoc](https://godoc.org/go.code.as/writeas.v2?status.svg)](https://godoc.org/go.code.as/writeas.v2) |
|
|
|
|
|
|
|
Official Write.as Go client library. |
|
|
|
|
|
|
|
## Installation |
|
|
|
|
|
|
|
```bash |
|
|
|
go get go.code.as/writeas.v1 |
|
|
|
go get go.code.as/writeas.v2 |
|
|
|
``` |
|
|
|
|
|
|
|
## Documentation |
|
|
@@ -17,7 +17,7 @@ See all functionality and usages in the [API documentation](https://developer.wr |
|
|
|
### Example usage |
|
|
|
|
|
|
|
```go |
|
|
|
import "go.code.as/writeas.v1" |
|
|
|
import "go.code.as/writeas.v2" |
|
|
|
|
|
|
|
func main() { |
|
|
|
// Create the client |
|
|
@@ -37,11 +37,7 @@ func main() { |
|
|
|
token := p.Token |
|
|
|
|
|
|
|
// Update a published post |
|
|
|
p, err = c.UpdatePost(&writeas.PostParams{ |
|
|
|
OwnedPostParams: writeas.OwnedPostParams{ |
|
|
|
ID: p.ID, |
|
|
|
Token: token, |
|
|
|
}, |
|
|
|
p, err = c.UpdatePost(p.ID, token, &writeas.PostParams{ |
|
|
|
Content: "Now it's been updated!", |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
@@ -55,12 +51,7 @@ func main() { |
|
|
|
} |
|
|
|
|
|
|
|
// Delete a post |
|
|
|
err = c.DeletePost(&writeas.PostParams{ |
|
|
|
OwnedPostParams: writeas.OwnedPostParams{ |
|
|
|
ID: p.ID, |
|
|
|
Token: token, |
|
|
|
}, |
|
|
|
}) |
|
|
|
err = c.DeletePost(p.ID, token) |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|