https://github.com/hayashiki/docbase-go
DocBase API Client, written in Go.
https://github.com/hayashiki/docbase-go
docbase go
Last synced: 2 months ago
JSON representation
DocBase API Client, written in Go.
- Host: GitHub
- URL: https://github.com/hayashiki/docbase-go
- Owner: hayashiki
- License: mit
- Created: 2020-07-21T12:35:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-12-10T12:50:18.000Z (over 4 years ago)
- Last Synced: 2023-07-27T22:11:51.157Z (over 2 years ago)
- Topics: docbase, go
- Language: Go
- Homepage:
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://codecov.io/gh/hayashiki/docbase-go)

# docbase-go
Unofficial DocBase API client library, written in Go.
# Installation
```
go get github.com/hayashiki/docbase-go
```
# Example
Get all your team posts
```
package main
import (
"fmt"
"github.com/hayashiki/docbase-go"
)
func main() {
client = docbase.NewClient(nil, "your_team", "your_token")
opts := &docbase.PostListOptions{
PerPage: 5,
Page: 1,
Q: "query something",
}
posts, resp, err := client.Posts.List(opts)
if err != nil {
return
}
fmt.Printf("resp: %+v, posts: %+v", posts)
}
```
# API
## Posts
``` go
// Get the information about the post list
posts, resp, err := client.Posts.List(&docbase.PostListOptions{})
// Get the information about the post detail
post, resp, err := client.Posts.Get(1234567)
// Create a new post
post, resp, err := client.Posts.Create(&docbase.PostRequest{})
// Update the information about the post
post, resp, err := client.Posts.Update(1234567, &docbase.PostRequest{})
// Archive the post
resp, err := client.Posts.Archive(1234567)
// Unarchive the post
resp, err := client.Posts.Unarchive(1234567)
```
## Groups
``` go
// Get the information about the group list
groups, resp, err := client.Groups.List(&docbase.GroupListOptions{})
// Get the information about the group detail
group, resp, err := client.Groups.Get(12345)
// Add the user to the group
resp, err := client.GroupUsers.Create(12345, &docbase.GroupUserCreateRequest{})
// Remove the user to the group
resp, err := client.GroupUsers.Delete(12345, &docbase.GroupUserCreateRequest{})
```
## Tags
``` go
// Get the information about the tag list
tags, resp, err := client.Tags.List()
```
## Users
``` go
// Get the information about the tag list
users, resp, err := client.Users.List(&docbase.UserListOptions{})
```
## Attachments
``` go
// Download an attachment
file, resp, err := client.Attachments.Download("8babf378-1234-5678-b62b-5a2a6c536b2b.png")
// Upload an attachment, select multiple files path
files, resp, err := client.Attachments.Upload([]string{"./testdata/test-image.jpg"})
```
# Note
[Here is the original full API.](https://help.docbase.io/posts/45703)