// todo: Move this to Vndb.Helper.cs /// <summary> /// Method for processing the Get Methods /// </summary> /// <param name="method">Which API method to use</param> /// <param name="filter">The IFilter for the request</param> /// <param name="flags">The flags for the request</param> /// <param name="options">The IRequestOptions for the request</param> /// <typeparam name="T">The type of response expected</typeparam> /// <returns>The results from Vndb</returns> protected async Task <T> GetInternalAsync <T>(String method, IFilter filter, VndbFlags flags, IRequestOptions options = null) where T : class { // Need a way to communicate to the end user that these null values are not from the API? if (this.CheckFlags && !VndbUtils.ValidateFlagsByMethod(method, flags, out var invalidFlags)) { this._invalidFlags?.Invoke(method, flags, invalidFlags); this.LastError = new LibraryError("CheckFlags is enabled and VndbSharp detected invalid flags"); return(null); } if (!filter.IsFilterValid()) { this.LastError = new LibraryError($"A filter was not considered valid. The filter is of the type {filter.GetType().Name}"); return(null); } var requestData = this.FormatRequest($"{method} {flags.AsString(method)} ({filter})", options, false); return(await this.SendGetRequestInternalAsync <T>(requestData).ConfigureAwait(false)); }