mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
avoid having package name in local struct
This commit is contained in:
parent
d1dc0e72f6
commit
f8b76a3725
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/celogeek/piwigo-cli/internal/debug"
|
"github.com/celogeek/piwigo-cli/internal/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PiwigoResult struct {
|
type PostResult struct {
|
||||||
Stat string `json:"stat"`
|
Stat string `json:"stat"`
|
||||||
Err int `json:"err"`
|
Err int `json:"err"`
|
||||||
ErrMessage string `json:"message"`
|
ErrMessage string `json:"message"`
|
||||||
@ -46,7 +46,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
|
|||||||
encodedForm = form.Encode()
|
encodedForm = form.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
Result := PiwigoResult{
|
result := PostResult{
|
||||||
Result: resp,
|
Result: resp,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(raw.Bytes(), &Result)
|
err = json.Unmarshal(raw.Bytes(), &result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = r.Body.Close()
|
_ = r.Body.Close()
|
||||||
continue
|
continue
|
||||||
@ -112,8 +112,8 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
|
|||||||
fmt.Println(debug.Dump(RawResult))
|
fmt.Println(debug.Dump(RawResult))
|
||||||
}
|
}
|
||||||
|
|
||||||
if Result.Stat != "ok" {
|
if result.Stat != "ok" {
|
||||||
return fmt.Errorf("[Error %d] %s", Result.Err, Result.ErrMessage)
|
return fmt.Errorf("[Error %d] %s", result.Err, result.ErrMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user