/// <summary>Get metadata about a mod in the repository.</summary> /// <param name="id">The mod ID in this repository.</param> public async Task <ModInfoModel> GetModInfoAsync(string id) { try { NexusResponseModel response = await this.Client .GetAsync(string.Format(this.ModUrlFormat, id)) .As <NexusResponseModel>(); return(response != null ? new ModInfoModel(response.Name, response.Version, response.Url) : new ModInfoModel("Found no mod with this ID.")); } catch (Exception ex) { return(new ModInfoModel(ex.ToString())); } }
/// <summary>Get metadata about a mod in the repository.</summary> /// <param name="id">The mod ID in this repository.</param> public override async Task <ModInfoModel> GetModInfoAsync(string id) { // validate ID format if (!uint.TryParse(id, out uint _)) { return(new ModInfoModel($"The value '{id}' isn't a valid Nexus mod ID, must be an integer ID.")); } // fetch info try { NexusResponseModel response = await this.Client .GetAsync(string.Format(this.ModUrlFormat, id)) .As <NexusResponseModel>(); return(response != null ? new ModInfoModel(response.Name, this.NormaliseVersion(response.Version), response.Url) : new ModInfoModel("Found no mod with this ID.")); } catch (Exception ex) { return(new ModInfoModel(ex.ToString())); } }