mirror of
https://github.com/writeas/go-writeas.git
synced 2025-07-27 12:40:31 +00:00
Reflect breaking v2 changes in examples and tests
This commit is contained in:
parent
b7c23e245e
commit
b88b7e4e51
19
README.md
19
README.md
@ -1,13 +1,13 @@
|
||||
# go-writeas
|
||||
|
||||
[](https://godoc.org/go.code.as/writeas.v1)
|
||||
[](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)
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -23,9 +23,7 @@ func TestCreatePost(t *testing.T) {
|
||||
token := p.Token
|
||||
|
||||
// Update post
|
||||
p, err = wac.UpdatePost(&PostParams{
|
||||
ID: p.ID,
|
||||
Token: token,
|
||||
p, err = wac.UpdatePost(p.ID, token, &PostParams{
|
||||
Content: "Now it's been updated!",
|
||||
})
|
||||
if err != nil {
|
||||
@ -35,10 +33,7 @@ func TestCreatePost(t *testing.T) {
|
||||
t.Logf("Post updated: %+v", p)
|
||||
|
||||
// Delete post
|
||||
err = wac.DeletePost(&PostParams{
|
||||
ID: p.ID,
|
||||
Token: token,
|
||||
})
|
||||
err = wac.DeletePost(p.ID, token)
|
||||
if err != nil {
|
||||
t.Errorf("Post delete failed: %v", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user