Refactor Api-Client
Add Exceptionhandler, AlertService JSON-Converter AppSettings via DI Reformat Code
This commit is contained in:
@@ -10,19 +10,23 @@ internal class TokenData {
|
||||
public string Operator_id { get; set; }
|
||||
|
||||
public TokenData(string ak) {
|
||||
if (string.IsNullOrEmpty(ak)) {
|
||||
throw new ArgumentException("API key cannot be null or empty", nameof(ak));
|
||||
}
|
||||
string dat = Encoding.UTF8.GetString(Convert.FromBase64String(ak));
|
||||
|
||||
string[] parts = dat.Split('|');
|
||||
if (parts.Length < 3) {
|
||||
throw new FormatException("API key format is invalid");
|
||||
}
|
||||
if (string.IsNullOrEmpty(ak)) {
|
||||
throw new ArgumentException("API key cannot be null or empty", nameof(ak));
|
||||
}
|
||||
|
||||
Token = dat.Split('|')[1]; ;
|
||||
Url = dat.Split('|')[2]; ;
|
||||
Operator_id = dat.Split('|')[0]; ;
|
||||
string dat = Encoding.UTF8.GetString(Convert.FromBase64String(ak));
|
||||
|
||||
string[] parts = dat.Split('|');
|
||||
if (parts.Length < 3) {
|
||||
throw new FormatException("API key format is invalid");
|
||||
}
|
||||
|
||||
Token = dat.Split('|')[1];
|
||||
;
|
||||
Url = dat.Split('|')[2];
|
||||
;
|
||||
Operator_id = dat.Split('|')[0];
|
||||
;
|
||||
ApiKey = ak;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user