This repository was archived by the owner on Sep 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.go
More file actions
89 lines (77 loc) · 2.49 KB
/
actions.go
File metadata and controls
89 lines (77 loc) · 2.49 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Package actions provides definitions of actions and their data
package actions
import (
"encoding/json"
)
// Action represents an operation on a Dnote resource
type Action struct {
UUID string `json:"uuid"`
Schema int `json:"schema"`
Type string `json:"type"`
Data json.RawMessage `json:"data"`
Timestamp int64 `json:"timestamp"`
}
var (
// ActionAddNote identifies a type of action for adding a note
ActionAddNote = "add_note"
// ActionRemoveNote identifies a type of action for removing a note
ActionRemoveNote = "remove_note"
// ActionEditNote identifies a type of action for editing a note
ActionEditNote = "edit_note"
// ActionAddBook identifies a type of action for adding a book
ActionAddBook = "add_book"
// ActionRemoveBook identifies a type of action for removing a book
ActionRemoveBook = "remove_book"
)
// AddNoteDataV1 is a data for adding a note (v1)
type AddNoteDataV1 struct {
NoteUUID string `json:"note_uuid"`
BookName string `json:"book_name"`
Content string `json:"content"`
}
// AddNoteDataV2 is a data for adding a note (v2)
type AddNoteDataV2 struct {
NoteUUID string `json:"note_uuid"`
BookName string `json:"book_name"`
Content string `json:"content"`
Public bool `json:"public"`
}
// EditNoteDataV1 is a data for editing a note (v1)
type EditNoteDataV1 struct {
NoteUUID string `json:"note_uuid"`
FromBook string `json:"from_book"`
ToBook string `json:"to_book"`
Content string `json:"content"`
}
// EditNoteDataV2 is a data for editing a note (v2)
type EditNoteDataV2 struct {
NoteUUID string `json:"note_uuid"`
FromBook string `json:"from_book"`
ToBook *string `json:"to_book"`
Content *string `json:"content"`
Public *bool `json:"public"`
}
// EditNoteDataV3 is a data for editing a note (v2)
type EditNoteDataV3 struct {
NoteUUID string `json:"note_uuid"`
BookName *string `json:"book_name"`
Content *string `json:"content"`
Public *bool `json:"public"`
}
// RemoveNoteDataV1 is a data for removing a note (v1)
type RemoveNoteDataV1 struct {
NoteUUID string `json:"note_uuid"`
BookName string `json:"book_name"`
}
// RemoveNoteDataV2 is a data for removing a note (v2)
type RemoveNoteDataV2 struct {
NoteUUID string `json:"note_uuid"`
}
// AddBookDataV1 is a data for adding a book (v1)
type AddBookDataV1 struct {
BookName string `json:"book_name"`
}
// RemoveBookDataV1 is a data for removing a book (v1)
type RemoveBookDataV1 struct {
BookName string `json:"book_name"`
}