summaryrefslogtreecommitdiffstats
path: root/lib/folder
diff options
context:
space:
mode:
Diffstat (limited to 'lib/folder')
-rw-r--r--lib/folder/folder-interface.go7
-rw-r--r--lib/folder/folder-pathmap.go9
-rw-r--r--lib/folder/folder-st-disable.go5
3 files changed, 21 insertions, 0 deletions
diff --git a/lib/folder/folder-interface.go b/lib/folder/folder-interface.go
index 9eb6829..3208869 100644
--- a/lib/folder/folder-interface.go
+++ b/lib/folder/folder-interface.go
@@ -30,6 +30,7 @@ type IFOLDER interface {
ConvPathCli2Svr(s string) string // Convert path from Client to Server
ConvPathSvr2Cli(s string) string // Convert path from Server to Client
Remove() error // Remove a folder
+ Update(cfg FolderConfig) (*FolderConfig, error) // Update a new folder
RegisterEventChange(cb *EventCB, data *EventCBData) error // Request events registration (sent through WS)
UnRegisterEventChange() error // Un-register events
Sync() error // Force folder files synchronization
@@ -45,6 +46,7 @@ type FolderConfig struct {
Status string `json:"status"`
IsInSync bool `json:"isInSync"`
DefaultSdk string `json:"defaultSdk"`
+ ClientData string `json:"clientData"` // free form field that can used by client
// Not exported fields from REST API point of view
RootPath string `json:"-"`
@@ -58,6 +60,11 @@ type FolderConfig struct {
DataCloudSync CloudSyncConfig `json:"dataCloudSync,omitempty"`
}
+// FolderConfigUpdatableFields List fields that can be updated using Update function
+var FolderConfigUpdatableFields = []string{
+ "Label", "DefaultSdk", "ClientData",
+}
+
// PathMapConfig Path mapping specific data
type PathMapConfig struct {
ServerPath string `json:"serverPath"`
diff --git a/lib/folder/folder-pathmap.go b/lib/folder/folder-pathmap.go
index e200164..c5691a3 100644
--- a/lib/folder/folder-pathmap.go
+++ b/lib/folder/folder-pathmap.go
@@ -145,6 +145,15 @@ func (f *PathMap) Remove() error {
return nil
}
+// Update update some fields of a folder
+func (f *PathMap) Update(cfg FolderConfig) (*FolderConfig, error) {
+ if f.config.ID != cfg.ID {
+ return nil, fmt.Errorf("Invalid id")
+ }
+ f.config = cfg
+ return &f.config, nil
+}
+
// RegisterEventChange requests registration for folder change event
func (f *PathMap) RegisterEventChange(cb *EventCB, data *EventCBData) error {
return nil
diff --git a/lib/folder/folder-st-disable.go b/lib/folder/folder-st-disable.go
index 7b53ca8..e936494 100644
--- a/lib/folder/folder-st-disable.go
+++ b/lib/folder/folder-st-disable.go
@@ -65,6 +65,11 @@ func (f *STFolderDisable) Remove() error {
return nil
}
+// Update update some fields of a folder
+func (f *STFolderDisable) Update(cfg FolderConfig) (*FolderConfig, error) {
+ return nil, nil
+}
+
// RegisterEventChange requests registration for folder change event
func (f *STFolderDisable) RegisterEventChange(cb *EventCB, data *EventCBData) error {
return nil