src/Classificationbox.Net/ServiceWrapper.cs
/// <summary>
/// Gets the statistics of the specified model.
/// </summary>
/// <param name="modelId">id of the model to return statistics for</param>
/// <returns></returns>
Gets the statistics of the specified model.
Gets the statistics of the specified model .
public ModelStatistics GetModelStatistics(string modelId)
        {
            using (HttpClient client = new HttpClient())
            {
                var request = new HttpRequestMessage
                {
                    Method = HttpMethod.Get,
                    RequestUri = new Uri(string.Format("{0}/classificationbox/models/{1}/stats", _baseUrl, modelId))
                };
                HttpResponseMessage rsp;
                try
                {
                    rsp = client.SendAsync(request).GetAwaiter().GetResult();
                }
                catch (Exception ex)
                {
                    return new ModelStatistics() { error = ex.Message };
                }
                var rspStr = rsp.Content.ReadAsStringAsync().Result;
                if (rsp.IsSuccessStatusCode)
                {
                    var ms = JsonConvert.DeserializeObject<ModelStatistics>(rspStr);
                    return ms;
                }
                else
                {
                    return new ModelStatistics()
                    {
                        success = false,
                        error = rspStr
                    };
                }
            }
        }
public ModelStatistics GetModelStatistics ( string modelId ) { using ( HttpClient client = new HttpClient ( ) ) { var request = new HttpRequestMessage { Method = HttpMethod . Get , RequestUri = new Uri ( string . Format ( " " , _baseUrl , modelId ) ) } ; HttpResponseMessage rsp ; try { rsp = client . SendAsync ( request ) . GetAwaiter ( ) . GetResult ( ) ; } catch ( Exception ex ) { return new ModelStatistics ( ) { error = ex . Message } ; } var rspStr = rsp . Content . ReadAsStringAsync ( ) . Result ; if ( rsp . IsSuccessStatusCode ) { var ms = JsonConvert . DeserializeObject < ModelStatistics > ( rspStr ) ; return ms ; } else { return new ModelStatistics ( ) { success = false , error = rspStr } ; } } }
Gets the statistics of the specified model.
Gets the statistics of the specified model .
None
modelId
string
id of the model to return statistics for
id of the model to return statistics for