Algolia.Analytics 1.0.0

Algolia Analytics Client

Algolia Analytics Client for .NET

Install-Package Algolia.Analytics -Version 1.0.0
dotnet add package Algolia.Analytics --version 1.0.0
<PackageReference Include="Algolia.Analytics" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Algolia.Analytics --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Algolia Analytics Client for .NET

built .NET Standard 1.4
PS: Please check the dotnet standard support before use._

Quickstart

Get popular search for a fixed date period

const string apiKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string appId = "XXXXXXXXX";

// Create a new client object using the app secrets typically stored away in a safer place than mine :P
var analyticsClient = new AnalyticsClient(new AppSecrets()
{
    ApplicationId = appId,
    ApplicationKey = apiKey
});

// Initialise the new client with the the name of the search index.
analyticsClient.InitAnalytics("JollofIndex");

// Specify the filter options for the request
var options = new AnalyticsOptions()
    .StartAt(DateTime.Today.AddDays(-1))
    .SetCountry("NG")
    .SetSize(10)
    .EndAt(DateTime.Now);

// Pass in the options
// ...and the analytics data you want
var popularSearches = await analyticsClient.GetAnalyticsForSearch(options,
    AnalyticsClient.AnalyticSearchType.Popular);

Usage

The Algolia Analytics API Documentation basically provides two kinds of endpoints. One for Searches and another for Rate Limits. So it makes sense to separate these in their individual calling methods as well.

AnalyticsClient - All new request starts with this. You'd typically have to create a new AnalyticsClient object and pass in your AppSecrets like this var client = new AnalyticsClient(&lt;AppSecrets&gt; secrets); You can henceforth use the client for all your operations.

AppSecrets - This has two properties ApplicationId and ApplicationKey and they are exactly as their name suggests. Please visit your Algolia Dashboard to get both of these.

AnalyticsOptions - Gives you the ability to set filters for your request. These options were created to match the parameters of the REST API provided by Algolia. Methods include:

  • SetSize(int size)
  • StartAt(DateTime startTime)
  • EndAt(DateTime EndTime)
  • SetTags(IEnumerable&lt;string&gt; tags)
  • SetCountry(string country)
  • SetRefinements(bool refiments)
    See Algolia Analytics API Documentation for more information.

InitAnalytics - Used to set the index or indices that would be queried.
InitAnalytics(&lt;string&gt; Index); or InitAnalytics(&lt;IEnumerable&lt;string&gt;&gt; Indices);

Getting Analytics for Search

AnalyticsSearchType - Specifies what the type of analytics for search should be. These resource endpoints were created to match the different queries of the REST API provided by Algolia.

  • AnalyticsSearchType.Popular
  • AnalyticsSearchType.NoResults
  • AnalyticsSearchType.Countries
  • AnalyticsSearchType.Hits
  • AnalyticsSearchType.HitsWithTypo
  • AnalyticsSearchType.TopIps
  • AnalyticsSearchType.Referers
    See Algolia Analytics API Documentation for more information.

GetAnalyticsForSearch - GetAnalyticsForSearch([<AnalyticsOptions> options], <AnalyticsSearchType> searchType) - Asynchronous method. Takes an optional AnalyticsOptions object and an AnalyticsSearchType enum.

var popularSearches = await GetAnalyticsSearch(AnalyticsClient.AnalyticSearchType.Popular);
/// OR 
var options = new AnalyticsOptions();
options.SetCountry("NG")
    .SetRefinements(true);
var popularSearches = await GetAnalyticsSearch(options, AnalyticsClient.AnalyticSearchType.Popular);

Getting Analytics for RateLimit

RateLimitSearchType - Specifies what the type of analytics for ratelimits should be. These resource endpoints were created to match the different queries of the REST API provided by Algolia.

GetAnalyticsForRateLimits - GetAnalyticsForRateLimits([<AnalyticsOptions> options], <AnalyticRateLimitType> rateLimitTypes) - Asynchronous method. Takes an optional AnalyticsOptions object and an AnalyticRateLimitType enum.

var rateLimits = await AnalyticRateLimitType(AnalyticsClient.AnalyticSearchType.Popular);
// OR 
var options = new AnalyticsOptions();
options.SetCountry("NG")
    .SetRefinements(true);
var rateLimits = await AnalyticRateLimitType(options, AnalyticsClient.AnalyticRateLimitType.TopIps);

Algolia Analytics Client for .NET

built .NET Standard 1.4
PS: Please check the dotnet standard support before use._

Quickstart

Get popular search for a fixed date period

const string apiKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string appId = "XXXXXXXXX";

// Create a new client object using the app secrets typically stored away in a safer place than mine :P
var analyticsClient = new AnalyticsClient(new AppSecrets()
{
    ApplicationId = appId,
    ApplicationKey = apiKey
});

// Initialise the new client with the the name of the search index.
analyticsClient.InitAnalytics("JollofIndex");

// Specify the filter options for the request
var options = new AnalyticsOptions()
    .StartAt(DateTime.Today.AddDays(-1))
    .SetCountry("NG")
    .SetSize(10)
    .EndAt(DateTime.Now);

// Pass in the options
// ...and the analytics data you want
var popularSearches = await analyticsClient.GetAnalyticsForSearch(options,
    AnalyticsClient.AnalyticSearchType.Popular);

Usage

The Algolia Analytics API Documentation basically provides two kinds of endpoints. One for Searches and another for Rate Limits. So it makes sense to separate these in their individual calling methods as well.

AnalyticsClient - All new request starts with this. You'd typically have to create a new AnalyticsClient object and pass in your AppSecrets like this var client = new AnalyticsClient(&lt;AppSecrets&gt; secrets); You can henceforth use the client for all your operations.

AppSecrets - This has two properties ApplicationId and ApplicationKey and they are exactly as their name suggests. Please visit your Algolia Dashboard to get both of these.

AnalyticsOptions - Gives you the ability to set filters for your request. These options were created to match the parameters of the REST API provided by Algolia. Methods include:

  • SetSize(int size)
  • StartAt(DateTime startTime)
  • EndAt(DateTime EndTime)
  • SetTags(IEnumerable&lt;string&gt; tags)
  • SetCountry(string country)
  • SetRefinements(bool refiments)
    See Algolia Analytics API Documentation for more information.

InitAnalytics - Used to set the index or indices that would be queried.
InitAnalytics(&lt;string&gt; Index); or InitAnalytics(&lt;IEnumerable&lt;string&gt;&gt; Indices);

Getting Analytics for Search

AnalyticsSearchType - Specifies what the type of analytics for search should be. These resource endpoints were created to match the different queries of the REST API provided by Algolia.

  • AnalyticsSearchType.Popular
  • AnalyticsSearchType.NoResults
  • AnalyticsSearchType.Countries
  • AnalyticsSearchType.Hits
  • AnalyticsSearchType.HitsWithTypo
  • AnalyticsSearchType.TopIps
  • AnalyticsSearchType.Referers
    See Algolia Analytics API Documentation for more information.

GetAnalyticsForSearch - GetAnalyticsForSearch([<AnalyticsOptions> options], <AnalyticsSearchType> searchType) - Asynchronous method. Takes an optional AnalyticsOptions object and an AnalyticsSearchType enum.

var popularSearches = await GetAnalyticsSearch(AnalyticsClient.AnalyticSearchType.Popular);
/// OR 
var options = new AnalyticsOptions();
options.SetCountry("NG")
    .SetRefinements(true);
var popularSearches = await GetAnalyticsSearch(options, AnalyticsClient.AnalyticSearchType.Popular);

Getting Analytics for RateLimit

RateLimitSearchType - Specifies what the type of analytics for ratelimits should be. These resource endpoints were created to match the different queries of the REST API provided by Algolia.

GetAnalyticsForRateLimits - GetAnalyticsForRateLimits([<AnalyticsOptions> options], <AnalyticRateLimitType> rateLimitTypes) - Asynchronous method. Takes an optional AnalyticsOptions object and an AnalyticRateLimitType enum.

var rateLimits = await AnalyticRateLimitType(AnalyticsClient.AnalyticSearchType.Popular);
// OR 
var options = new AnalyticsOptions();
options.SetCountry("NG")
    .SetRefinements(true);
var rateLimits = await AnalyticRateLimitType(options, AnalyticsClient.AnalyticRateLimitType.TopIps);

Release Notes

initial release

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 312 10/24/2017