renamed PiwigoCategory to Category as the package name is duplicated
This commit is contained in:
parent
04b32dcd02
commit
6bde70cef8
@ -11,15 +11,15 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type PiwigoCategory struct {
|
||||
type Category struct {
|
||||
Id int
|
||||
ParentId int
|
||||
Name string
|
||||
Key string
|
||||
}
|
||||
|
||||
func buildLookupMap(categories map[int]*PiwigoCategory) map[string]*PiwigoCategory {
|
||||
categoryLookups := map[string]*PiwigoCategory{}
|
||||
func buildLookupMap(categories map[int]*Category) map[string]*Category {
|
||||
categoryLookups := map[string]*Category{}
|
||||
for _, category := range categories {
|
||||
logrus.Debugf("Loaded existing category %s", category.Key)
|
||||
categoryLookups[category.Key] = category
|
||||
@ -27,15 +27,15 @@ func buildLookupMap(categories map[int]*PiwigoCategory) map[string]*PiwigoCatego
|
||||
return categoryLookups
|
||||
}
|
||||
|
||||
func buildCategoryMap(statusResponse *getCategoryListResponse) map[int]*PiwigoCategory {
|
||||
categories := map[int]*PiwigoCategory{}
|
||||
func buildCategoryMap(statusResponse *getCategoryListResponse) map[int]*Category {
|
||||
categories := map[int]*Category{}
|
||||
for _, category := range statusResponse.Result.Categories {
|
||||
categories[category.ID] = &PiwigoCategory{Id: category.ID, ParentId: category.IDUppercat, Name: category.Name, Key: category.Name}
|
||||
categories[category.ID] = &Category{Id: category.ID, ParentId: category.IDUppercat, Name: category.Name, Key: category.Name}
|
||||
}
|
||||
return categories
|
||||
}
|
||||
|
||||
func buildCategoryKeys(categories map[int]*PiwigoCategory) {
|
||||
func buildCategoryKeys(categories map[int]*Category) {
|
||||
for _, category := range categories {
|
||||
if category.ParentId == 0 {
|
||||
category.Key = category.Name
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
type PiwigoCategoryApi interface {
|
||||
GetAllCategories() (map[string]*PiwigoCategory, error)
|
||||
GetAllCategories() (map[string]*Category, error)
|
||||
CreateCategory(parentId int, name string) (int, error)
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ func (context *PiwigoContext) getStatus() (*getStatusResponse, error) {
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
func (context *PiwigoContext) GetAllCategories() (map[string]*PiwigoCategory, error) {
|
||||
func (context *PiwigoContext) GetAllCategories() (map[string]*Category, error) {
|
||||
formData := url.Values{}
|
||||
formData.Set("method", "pwg.categories.getList")
|
||||
formData.Set("recursive", "true")
|
||||
|
Loading…
Reference in New Issue
Block a user