feat: add teambition driver
This commit is contained in:
@ -149,7 +149,7 @@ func (m *Monitor) Complete() error {
|
||||
return errors.Wrapf(err, "failed to open file %s", file.Path)
|
||||
}
|
||||
stream := &model.FileStream{
|
||||
Obj: model.Object{
|
||||
Obj: &model.Object{
|
||||
Name: path.Base(file.Path),
|
||||
Size: size,
|
||||
Modified: time.Now(),
|
||||
|
@ -31,7 +31,7 @@ type RootFolderPath struct {
|
||||
RootFolder string `json:"root_folder" required:"true" help:"Root folder path"`
|
||||
}
|
||||
|
||||
type RootFolderId struct {
|
||||
type RootFolderID struct {
|
||||
RootFolder string `json:"root_folder" required:"true" help:"Root folder id"`
|
||||
}
|
||||
|
||||
@ -39,6 +39,6 @@ func (r RootFolderPath) GetRootFolderPath() string {
|
||||
return r.RootFolder
|
||||
}
|
||||
|
||||
func (r RootFolderId) GetRootFolderId() string {
|
||||
func (r RootFolderID) GetRootFolderId() string {
|
||||
return r.RootFolder
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func get(ctx context.Context, path string) (model.Obj, error) {
|
||||
if err != nil {
|
||||
// if there are no storage prefix with path, maybe root folder
|
||||
if path == "/" {
|
||||
return model.Object{
|
||||
return &model.Object{
|
||||
Name: "root",
|
||||
Size: 0,
|
||||
Modified: time.Time{},
|
||||
|
@ -10,23 +10,23 @@ type Object struct {
|
||||
IsFolder bool
|
||||
}
|
||||
|
||||
func (o Object) GetName() string {
|
||||
func (o *Object) GetName() string {
|
||||
return o.Name
|
||||
}
|
||||
|
||||
func (o Object) GetSize() int64 {
|
||||
func (o *Object) GetSize() int64 {
|
||||
return o.Size
|
||||
}
|
||||
|
||||
func (o Object) ModTime() time.Time {
|
||||
func (o *Object) ModTime() time.Time {
|
||||
return o.Modified
|
||||
}
|
||||
|
||||
func (o Object) IsDir() bool {
|
||||
func (o *Object) IsDir() bool {
|
||||
return o.IsFolder
|
||||
}
|
||||
|
||||
func (o Object) GetID() string {
|
||||
func (o *Object) GetID() string {
|
||||
return o.ID
|
||||
}
|
||||
|
||||
@ -38,11 +38,30 @@ type Thumbnail struct {
|
||||
Thumbnail string
|
||||
}
|
||||
|
||||
type Url struct {
|
||||
Url string
|
||||
}
|
||||
|
||||
func (w Url) URL() string {
|
||||
return w.Url
|
||||
}
|
||||
|
||||
func (t Thumbnail) Thumb() string {
|
||||
return t.Thumbnail
|
||||
}
|
||||
|
||||
type ObjectThumbnail struct {
|
||||
type ObjThumb struct {
|
||||
Object
|
||||
Thumbnail
|
||||
}
|
||||
|
||||
type ObjectURL struct {
|
||||
Object
|
||||
Url
|
||||
}
|
||||
|
||||
type ObjThumbURL struct {
|
||||
Object
|
||||
Thumbnail
|
||||
Url
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ func Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, er
|
||||
}
|
||||
// is root folder
|
||||
if r, ok := storage.GetAddition().(driver.IRootFolderId); ok && utils.PathEqual(path, "/") {
|
||||
return model.Object{
|
||||
return &model.Object{
|
||||
ID: r.GetRootFolderId(),
|
||||
Name: "root",
|
||||
Size: 0,
|
||||
@ -93,7 +93,7 @@ func Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, er
|
||||
}, nil
|
||||
}
|
||||
if r, ok := storage.GetAddition().(driver.IRootFolderPath); ok && isRoot(path, r.GetRootFolderPath()) {
|
||||
return model.Object{
|
||||
return &model.Object{
|
||||
ID: r.GetRootFolderPath(),
|
||||
Name: "root",
|
||||
Size: 0,
|
||||
|
@ -286,7 +286,7 @@ func GetStorageVirtualFilesByPath(prefix string) []model.Obj {
|
||||
if _, ok := set[name]; ok {
|
||||
continue
|
||||
}
|
||||
files = append(files, model.Object{
|
||||
files = append(files, &model.Object{
|
||||
Name: name,
|
||||
Size: 0,
|
||||
Modified: v.GetStorage().Modified,
|
||||
|
Reference in New Issue
Block a user