/
doc.go
66 lines (55 loc) · 1.69 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
Package kintone provides interfaces for kintone REST API.
See https://kintone.dev/en/ for API specs.
import (
"log"
"github.com/kintone-labs/go-kintone"
)
...
app := &kintone.App{
Domain: "example.cybozu.com",
User: "user1",
Password: "password",
AppId: 25,
}
To retrieve 3 records from a kintone app (id=25):
records, err := app.GetRecords(nil, "limit 3")
if err != nil {
log.Fatal(err)
}
// use records
To retrieve 10 latest comments in record (id=3) from a kintone app (id=25)
var offset uint64 = 0
var limit uint64 = 10
comments, err := app.GetRecordComments(3, "desc", offset, limit)
if err != nil {
log.Fatal(err)
}
// use comments
To retrieve oldest 10 comments and skips the first 30 comments in record (id=3) from a kintone app (id=25)
var offset uint64 = 30
var limit uint64 = 10
comments, err := app.GetRecordComments(3, "asc", offset, limit)
if err != nil {
log.Fatal(err)
}
// use comments
To add comments into record (id=3) from a kintone app (id=25)
mentionMemberCybozu := &ObjMention{Code: "cybozu", Type: kintone.ConstCommentMentionTypeUser}
mentionGroupAdmin := &ObjMention{Code: "Administrators", Type: kintone.ConstCommentMentionTypeGroup}
mentionDepartmentAdmin := &ObjMention{Code: "Admin", Type: ConstCommentMentionTypeDepartment}
var cmt Comment
cmt.Text = "Test comment 222"
cmt.Mentions = []*ObjMention{mentionGroupAdmin, mentionMemberCybozu, mentionDepartmentAdmin}
cmtID, err := app.AddRecordComment(3, &cmt)
if err != nil {
log.Fatal(err)
}
// use comments id
To remove comments (id=12) in the record (id=3) from a kintone app (id=25)
err := app.DeleteComment(3, 12)
if err != nil {
log.Fatal(err)
}
*/
package kintone