Add warp account methods
This commit is contained in:
24
config/warp_account.go
Normal file
24
config/warp_account.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package config
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type WarpAccount struct {
|
||||
AccountID string `json:"account-id"`
|
||||
AccessToken string `json:"access-token"`
|
||||
}
|
||||
|
||||
func GenerateWarpAccount(licenseKey string, accountId string, accessToken string) (string, error) {
|
||||
data, _, _, err := GenerateWarpInfo(licenseKey, accountId, accessToken)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
warpAccount := WarpAccount{
|
||||
AccountID: data.AccountID,
|
||||
AccessToken: data.AccessToken,
|
||||
}
|
||||
accountJson, err := json.Marshal(warpAccount)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(accountJson), nil
|
||||
}
|
||||
Reference in New Issue
Block a user