github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/model/bitwarden/folder.go (about) 1 package bitwarden 2 3 import ( 4 "github.com/cozy/cozy-stack/pkg/consts" 5 "github.com/cozy/cozy-stack/pkg/couchdb" 6 "github.com/cozy/cozy-stack/pkg/metadata" 7 ) 8 9 // Folder is a space to organize ciphers. Its name is encrypted on client-side. 10 type Folder struct { 11 CouchID string `json:"_id,omitempty"` 12 CouchRev string `json:"_rev,omitempty"` 13 Name string `json:"name"` 14 Metadata *metadata.CozyMetadata `json:"cozyMetadata,omitempty"` 15 } 16 17 // ID returns the folder qualified identifier 18 func (f *Folder) ID() string { return f.CouchID } 19 20 // Rev returns the folder revision 21 func (f *Folder) Rev() string { return f.CouchRev } 22 23 // DocType returns the folder document type 24 func (f *Folder) DocType() string { return consts.BitwardenFolders } 25 26 // Clone implements couchdb.Doc 27 func (f *Folder) Clone() couchdb.Doc { 28 cloned := *f 29 if f.Metadata != nil { 30 cloned.Metadata = f.Metadata.Clone() 31 } 32 return &cloned 33 } 34 35 // SetID changes the folder qualified identifier 36 func (f *Folder) SetID(id string) { f.CouchID = id } 37 38 // SetRev changes the folder revision 39 func (f *Folder) SetRev(rev string) { f.CouchRev = rev } 40 41 var _ couchdb.Doc = &Folder{}