internal virtual T CallApi <T>(HttpMethod method, string url, BaseParams parameters, FileDescription file, Dictionary <string, string> extraHeaders = null) where T : BaseResult, new() { parameters?.Check(); return(CallAndParse <T>(method, url, (method == HttpMethod.PUT || method == HttpMethod.POST) ? parameters?.ToParamsDictionary() : null, file, extraHeaders)); }
/// <summary> /// Call api asynchronous and return response of specified type asynchronously. /// </summary> /// <param name="method">HTTP method.</param> /// <param name="url">Url for api call.</param> /// <param name="parameters">Parameters for api call.</param> /// <param name="file">File to upload (must be null for non-uploading actions).</param> /// <param name="extraHeaders">Extra headers.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>Return response of specified type.</returns> /// <typeparam name="T">Type of the parsed response.</typeparam> internal virtual Task <T> CallApiAsync <T>( HttpMethod method, string url, BaseParams parameters, FileDescription file, Dictionary <string, string> extraHeaders = null, CancellationToken?cancellationToken = null) where T : BaseResult, new() { parameters?.Check(); var callParams = (method == HttpMethod.PUT || method == HttpMethod.POST) ? parameters?.ToParamsDictionary() : null; return(CallAndParseAsync <T>(method, url, callParams, file, extraHeaders, cancellationToken)); }