mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 18:22:37 +02:00
add status response
This commit is contained in:
parent
3bc595757c
commit
4149f68938
16
session.go
16
session.go
@ -50,6 +50,12 @@ func (c *LoginCommand) Execute(args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StatusResponse struct {
|
||||||
|
User string `json:"username"`
|
||||||
|
Role string `json:"status"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
}
|
||||||
|
|
||||||
func (c *StatusCommand) Execute(args []string) error {
|
func (c *StatusCommand) Execute(args []string) error {
|
||||||
fmt.Println("Status:")
|
fmt.Println("Status:")
|
||||||
|
|
||||||
@ -58,10 +64,14 @@ func (c *StatusCommand) Execute(args []string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp map[string]interface{}
|
resp := &StatusResponse{}
|
||||||
Piwigo.Post("pwg.session.getStatus", &url.Values{}, &resp)
|
|
||||||
piwigo.DumpResponse(resp)
|
|
||||||
|
|
||||||
|
if err := Piwigo.Post("pwg.session.getStatus", &url.Values{}, &resp); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf(" Version: %s\n", resp.Version)
|
||||||
|
fmt.Printf(" User : %s\n", resp.User)
|
||||||
|
fmt.Printf(" Role : %s\n", resp.Role)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user