Browse Source

Add README and LICENSE

Matt Baer 3 years ago
parent
commit
cc0a705d00
2 changed files with 88 additions and 0 deletions
  1. 21
    0
      LICENSE
  2. 67
    0
      README.md

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
1
+The MIT License (MIT)
2
+
3
+Copyright (c) 2016 Write.as
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 67
- 0
README.md View File

@@ -0,0 +1,67 @@
1
+# go-writeas
2
+
3
+Official Write.as Go client library.
4
+
5
+## Installation
6
+
7
+```bash
8
+go get github.com/writeas/go-writeas
9
+```
10
+
11
+## Documentation
12
+
13
+See all functionality and usages in the [API documentation](https://writeas.github.io/docs/).
14
+
15
+### Example usage
16
+
17
+```go
18
+import "github.com/writeas/go-writeas"
19
+
20
+func main() {
21
+	// Create the client
22
+	c := writeas.NewClient()
23
+
24
+	// Publish a post
25
+	p, err := c.CreatePost(&PostParams{
26
+		Title:   "Title!",
27
+		Content: "This is a post.",
28
+		Font:    "sans",
29
+	})
30
+	if err != nil {
31
+		// Perhaps show err.Error()
32
+	}
33
+
34
+	// Update a published post
35
+	p, err := c.UpdatePost(&PostParams{
36
+		ID:      "3psnxyhqxy3hq",
37
+		Token:   "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
38
+		Content: "Now it's been updated!",
39
+	})
40
+	if err != nil {
41
+		// handle
42
+	}
43
+
44
+	// Get a published post
45
+	p, err := c.GetPost("3psnxyhqxy3hq")
46
+	if err != nil {
47
+		// handle
48
+	}
49
+
50
+	// Delete a post
51
+	err := c.DeletePost(&PostParams{
52
+		ID:    "3psnxyhqxy3hq",
53
+		Token: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
54
+	})
55
+}
56
+```
57
+
58
+## Contributing
59
+
60
+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:
61
+
62
+* Run `go fmt` on all updated .go files.
63
+* Document all structs and funcs.
64
+
65
+## License
66
+
67
+MIT