vendor: updated github.com/koofr/go-koofrclient for set mtime support.

This commit is contained in:
jaKa 2019-07-15 14:57:02 +02:00 committed by Nick Craig-Wood
parent 9af0a704af
commit 3df9dbf887
5 changed files with 53 additions and 39 deletions

2
go.mod
View File

@ -24,7 +24,7 @@ require (
github.com/jzelinskie/whirlpool v0.0.0-20170603002051-c19460b8caa6
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/koofr/go-httpclient v0.0.0-20180104120329-03786175608a
github.com/koofr/go-koofrclient v0.0.0-20190131164641-7f327592caff
github.com/koofr/go-koofrclient v0.0.0-20190715104037-2c5813f3c29c
github.com/kr/fs v0.1.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.4

2
go.sum
View File

@ -108,6 +108,8 @@ github.com/koofr/go-httpclient v0.0.0-20180104120329-03786175608a h1:W+gnfphB7Wp
github.com/koofr/go-httpclient v0.0.0-20180104120329-03786175608a/go.mod h1:3xszwh+rNrYk1r9SStc4iJ326gne1OaBcrdB1ACsbzI=
github.com/koofr/go-koofrclient v0.0.0-20190131164641-7f327592caff h1:GlfzG8bgyoJYz+5sMvGpYnHrg4veNVNnDGuE9hTEMHk=
github.com/koofr/go-koofrclient v0.0.0-20190131164641-7f327592caff/go.mod h1:MRAz4Gsxd+OzrZ0owwrUHc0zLESL+1Y5syqK/sJxK2A=
github.com/koofr/go-koofrclient v0.0.0-20190715104037-2c5813f3c29c h1:MaVra5jrE7MxT4k0v0JD2Gh6h94BFu2DgDYq+zMGBW0=
github.com/koofr/go-koofrclient v0.0.0-20190715104037-2c5813f3c29c/go.mod h1:MRAz4Gsxd+OzrZ0owwrUHc0zLESL+1Y5syqK/sJxK2A=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=

View File

@ -102,6 +102,7 @@ type FolderCreate struct {
type FileCopy struct {
ToMountId string `json:"toMountId"`
TPath string `json:"toPath"`
Modified *int64 `json:"modified,omitempty"`
}
type FileMove struct {
@ -118,20 +119,25 @@ type FileUpload struct {
Name string `json:"name"`
}
type PutFilter struct {
Modified *int64
Size *int64
Hash *string
IgnoreNonExisting bool
NoRename bool
ForceOverwrite bool
type PutOptions struct {
OverwriteIfModified *int64
OverwriteIfSize *int64
OverwriteIfHash *string
OverwriteIgnoreNonExisting bool
NoRename bool
ForceOverwrite bool
SetModified *int64
}
type DeleteFilter struct {
Modified *int64
Size *int64
Hash *string
IfEmpty bool
type CopyOptions struct {
SetModified *int64
}
type DeleteOptions struct {
RemoveIfModified *int64
RemoveIfSize *int64
RemoveIfHash *string
RemoveIfEmpty bool
}
type FileInfo struct {

View File

@ -83,25 +83,25 @@ func (c *KoofrClient) FilesDelete(mountId string, path string) (err error) {
return c.filesDelete(mountId, path, nil)
}
func (c *KoofrClient) FilesDeleteIf(mountId string, path string, deleteFilter *DeleteFilter) (err error) {
return c.filesDelete(mountId, path, deleteFilter)
func (c *KoofrClient) FilesDeleteWithOptions(mountId string, path string, deleteOptions *DeleteOptions) (err error) {
return c.filesDelete(mountId, path, deleteOptions)
}
func (c *KoofrClient) filesDelete(mountId string, path string, deleteFilter *DeleteFilter) (err error) {
func (c *KoofrClient) filesDelete(mountId string, path string, deleteOptions *DeleteOptions) (err error) {
params := url.Values{}
params.Set("path", path)
if deleteFilter != nil {
if deleteFilter.Size != nil {
params.Set("removeIfSize", fmt.Sprintf("%d", *deleteFilter.Size))
if deleteOptions != nil {
if deleteOptions.RemoveIfSize != nil {
params.Set("removeIfSize", fmt.Sprintf("%d", *deleteOptions.RemoveIfSize))
}
if deleteFilter.Modified != nil {
params.Set("removeIfModified", fmt.Sprintf("%d", *deleteFilter.Modified))
if deleteOptions.RemoveIfModified != nil {
params.Set("removeIfModified", fmt.Sprintf("%d", *deleteOptions.RemoveIfModified))
}
if deleteFilter.Hash != nil {
params.Set("removeIfHash", fmt.Sprintf("%s", *deleteFilter.Hash))
if deleteOptions.RemoveIfHash != nil {
params.Set("removeIfHash", fmt.Sprintf("%s", *deleteOptions.RemoveIfHash))
}
if deleteFilter.IfEmpty {
if deleteOptions.RemoveIfEmpty {
params.Set("removeIfEmpty", "")
}
}
@ -152,8 +152,8 @@ func (c *KoofrClient) FilesNewFolder(mountId string, path string, name string) (
return
}
func (c *KoofrClient) FilesCopy(mountId string, path string, toMountId string, toPath string) (err error) {
reqData := FileCopy{toMountId, toPath}
func (c *KoofrClient) FilesCopy(mountId string, path string, toMountId string, toPath string, options CopyOptions) (err error) {
reqData := FileCopy{toMountId, toPath, options.SetModified}
params := url.Values{}
params.Set("path", path)
@ -230,35 +230,41 @@ func (c *KoofrClient) FilesGet(mountId string, path string) (reader io.ReadClose
}
func (c *KoofrClient) FilesPut(mountId string, path string, name string, reader io.Reader) (newName string, err error) {
info, err := c.FilesPutOptions(mountId, path, name, reader, nil)
info, err := c.FilesPutWithOptions(mountId, path, name, reader, nil)
return info.Name, err
}
func (c *KoofrClient) FilesPutOptions(mountId string, path string, name string, reader io.Reader, putFilter *PutFilter) (fileInfo *FileInfo, err error) {
func (c *KoofrClient) FilesPutWithOptions(mountId string, path string, name string, reader io.Reader, putOptions *PutOptions) (fileInfo *FileInfo, err error) {
params := url.Values{}
params.Set("path", path)
params.Set("filename", name)
params.Set("info", "true")
if putFilter != nil {
if putFilter.Size != nil {
params.Set("overwriteIfSize", fmt.Sprintf("%d", *putFilter.Size))
if putOptions != nil {
if putOptions.OverwriteIfSize != nil {
params.Set("overwriteIfSize", fmt.Sprintf("%d", *putOptions.OverwriteIfSize))
}
if putFilter.Modified != nil {
params.Set("overwriteIfModified", fmt.Sprintf("%d", *putFilter.Modified))
if putOptions.OverwriteIfModified != nil {
params.Set("overwriteIfModified", fmt.Sprintf("%d", *putOptions.OverwriteIfModified))
}
if putFilter.Hash != nil {
params.Set("overwriteIfHash", fmt.Sprintf("%s", *putFilter.Hash))
if putOptions.OverwriteIfHash != nil {
params.Set("overwriteIfHash", fmt.Sprintf("%s", *putOptions.OverwriteIfHash))
}
if putFilter.IgnoreNonExisting {
if putOptions.OverwriteIfHash != nil {
params.Set("overwriteIfHash", fmt.Sprintf("%s", *putOptions.OverwriteIfHash))
}
if putOptions.OverwriteIgnoreNonExisting {
params.Set("overwriteIgnoreNonexisting", "")
}
if putFilter.NoRename {
if putOptions.NoRename {
params.Set("autorename", "false")
}
if putFilter.ForceOverwrite {
if putOptions.ForceOverwrite {
params.Set("overwrite", "true")
}
if putOptions.SetModified != nil {
params.Set("modified", fmt.Sprintf("%d", *putOptions.SetModified))
}
}
request := httpclient.RequestData{

2
vendor/modules.txt vendored
View File

@ -111,7 +111,7 @@ github.com/jzelinskie/whirlpool
github.com/kardianos/osext
# github.com/koofr/go-httpclient v0.0.0-20180104120329-03786175608a
github.com/koofr/go-httpclient
# github.com/koofr/go-koofrclient v0.0.0-20190131164641-7f327592caff
# github.com/koofr/go-koofrclient v0.0.0-20190715104037-2c5813f3c29c
github.com/koofr/go-koofrclient
# github.com/kr/fs v0.1.0
github.com/kr/fs