-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package driver | ||
|
||
// GetAppVersion get app version (win, android, mac, mac_arc, etc...) | ||
func (c *Pan115Client) GetAppVersion() ([]AppVersion, error) { | ||
result := VersionResp{} | ||
req := c.NewRequest(). | ||
SetResult(&result). | ||
ForceContentType("application/json;charset=UTF-8") | ||
|
||
resp, err := req.Get(ApiGetVersion) | ||
|
||
err = CheckErr(err, &result, resp) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return result.Data.GetAppVersions(), nil | ||
} | ||
|
||
type VersionResp struct { | ||
BasicResp | ||
Data Versions `json:"data"` | ||
} | ||
|
||
type Versions map[string]map[string]any | ||
|
||
func (v Versions) GetAppVersions() []AppVersion { | ||
vers := make([]AppVersion, len(v)) | ||
for app, ver := range v { | ||
vers = append(vers, AppVersion{ | ||
AppName: app, | ||
Version: ver["version_code"].(string), | ||
}) | ||
} | ||
return vers | ||
} | ||
|
||
type AppVersion struct { | ||
AppName string | ||
Version string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters