Algolia.Analytics
1.0.0
dotnet add package Algolia.Analytics --version 1.0.0
NuGet\Install-Package Algolia.Analytics -Version 1.0.0
<PackageReference Include="Algolia.Analytics" Version="1.0.0" />
paket add Algolia.Analytics --version 1.0.0
#r "nuget: Algolia.Analytics, 1.0.0"
// Install Algolia.Analytics as a Cake Addin #addin nuget:?package=Algolia.Analytics&version=1.0.0 // Install Algolia.Analytics as a Cake Tool #tool nuget:?package=Algolia.Analytics&version=1.0.0
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(<AppSecrets> 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<string> 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(<string> Index);
or InitAnalytics(<IEnumerable<string>> 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.
- AnalyticRateLimitType.TopIps`
See Algolia Analytics API Documentation for more information.
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);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.4 is compatible. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.4
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 10.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,740 | 10/24/2017 |
initial release