-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathsync.go
More file actions
31 lines (26 loc) · 696 Bytes
/
sync.go
File metadata and controls
31 lines (26 loc) · 696 Bytes
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
package ankiconnect
import "github.com/privatesquare/bkst-go-utils/utils/errors"
const (
ActionSync = "sync"
)
type (
// SyncManager describes the interface that can be used to perform sync operations on Anki.
SyncManager interface {
Trigger() *errors.RestErr
}
// syncManager implements SyncManager
syncManager struct {
Client *Client
}
)
// Trigger syncs local Anki data to Anki web.
// The method returns an error if:
// - the api request to ankiconnect fails.
// - the api returns a http error.
func (sm *syncManager) Trigger() *errors.RestErr {
_, restErr := post[string, ParamsDefault](sm.Client, ActionSync, nil)
if restErr != nil {
return restErr
}
return nil
}