private async static Task <GetExpiredCCResponse> GetCCInternal(GetAddesssApi api, string path, AdminKey adminKey, long id) { if (api == null) { throw new ArgumentNullException(nameof(api)); } if (path == null) { throw new ArgumentNullException(nameof(path)); } if (adminKey == null) { throw new ArgumentNullException(nameof(adminKey)); } api.SetAuthorizationKey(adminKey); var response = await api.Get(path); var body = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { var cC = ExpiredCC.Deserialize(body); return(new GetExpiredCCResponse.Success((int)response.StatusCode, response.ReasonPhrase, body, cC)); } return(new GetExpiredCCResponse.Failed((int)response.StatusCode, response.ReasonPhrase, body)); }
public async static Task <ListExpiredCCResponse> List(GetAddesssApi api, string path, AdminKey adminKey) { if (api == null) { throw new ArgumentNullException(nameof(api)); } if (path == null) { throw new ArgumentNullException(nameof(path)); } api.SetAuthorizationKey(adminKey); var response = await api.Get(path); var body = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { var list = ExpiredCC.DeserializeToList(body); return(new ListExpiredCCResponse.Success((int)response.StatusCode, response.ReasonPhrase, body, list)); } return(new ListExpiredCCResponse.Failed((int)response.StatusCode, response.ReasonPhrase, body)); }
internal Success(int statusCode, string reasonPhase, string raw, ExpiredCC expiredCC) : base(statusCode, reasonPhase, raw, true) { ExpiredCC = expiredCC; this.SuccessfulResult = this; }