Chilas.Algolia.Analytics/AnalyticsClient.cs
/// <summary>
/// Get Analytics features for Rate Limits
/// Consult Algolia Analytics documentation for options
/// </summary>
/// <param name="options"></param>
/// <param name="searchType"></param>
/// <returns></returns>
Get Analytics features for Rate Limits
Consult Algolia Analytics documentation for options
Get Analytics features for Rate Limits Consult Algolia Analytics documentation for options
public async Task<JObject> GetAnalyticsForRateLimits(AnalyticsOptions options, AnalyticRateLimitType searchType)
        {
            var requestUrl = $"{AnalyticsApiUrl}/ratelimits/{Indices}/{GetSearchResource(searchType)}";
            if (!string.IsNullOrWhiteSpace(options.RequestString))
                requestUrl += options.RequestString;
            var httpRequest = await _httpClient.GetAsync(requestUrl);
            var httpResponse = string.Empty;
            if (httpRequest.IsSuccessStatusCode)
            {
                httpResponse = await httpRequest.Content.ReadAsStringAsync();
            }
            else
            {
                switch (httpRequest.StatusCode)
                {
                    case HttpStatusCode.Forbidden:
                        throw new AlgoliaException("Invalid Incredentials.");
                    case HttpStatusCode.InternalServerError:
                        throw new AlgoliaException("An Internal server error occurred.");
                }
            }
            var result = JObject.Parse(httpResponse);
            return result;
        }
public async Task < JObject > GetAnalyticsForRateLimits ( AnalyticsOptions options , AnalyticRateLimitType searchType ) { var requestUrl = $" { AnalyticsApiUrl } /ratelimits/ { Indices } / { GetSearchResource ( searchType ) } " ; if ( ! string . IsNullOrWhiteSpace ( options . RequestString ) ) requestUrl += options . RequestString ; var httpRequest = await _httpClient . GetAsync ( requestUrl ) ; var httpResponse = string . Empty ; if ( httpRequest . IsSuccessStatusCode ) { httpResponse = await httpRequest . Content . ReadAsStringAsync ( ) ; } else { switch ( httpRequest . StatusCode ) { case HttpStatusCode . Forbidden : throw new AlgoliaException ( " " ) ; case HttpStatusCode . InternalServerError : throw new AlgoliaException ( " " ) ; } } var result = JObject . Parse ( httpResponse ) ; return result ; }
Get Analytics features for Rate Limits
Consult Algolia Analytics documentation for options
Get Analytics features for Rate Limits Consult Algolia Analytics documentation for options
None
options
AnalyticsOptions
None
searchType
AnalyticRateLimitType
None