algolia_lite 0.2.0 copy "algolia_lite: ^0.2.0" to clipboard
algolia_lite: ^0.2.0 copied to clipboard

discontinuedreplaced by: algoliasearch
outdated

Dart API client to interact with Algolia, designed for client apps.

Algolia Dart API Client Lite #

pub package style: lint

Dart API client to interact with Algolia, designed for client apps.

▶️ Getting Started #

🔍 Search & Browse #

Create an instance of SearchClient:

var client = SearchClient(
  applicationID: 'MyApplicationID',
  apiKey: 'MyApiKey',
);

Use your search client instance to make API requests:

Search index
var request = SearchRequest.create(
  indexName: 'MyIndexName',
  params: {'query': 'phone'},
);
var response = await client.search(request);
Search multiple indices
var request = MultiSearchRequest(requests: 
  [
    SearchRequest.create(indexName: 'MyIndexName1', params: params),
    SearchRequest.create(indexName: 'MyIndexName2', params: params),
  ],
);
var response = await client.multiSearch(request);
Search for facet values
var request = FacetSearchRequest(
  indexName: 'MyIndexName',
  facetName: 'categories',
  facetQuery: 'phone',
);
var response = await client.facetsSearch(request);
Get object(s)
var request = ObjectRequest(
  indexName: 'MyIndexName',
  objectID: 'MyObjectID',
  attributes: ['email', 'name'],
);
var objectResponse = await client.object(request);
final response = await client.objects(
    [
      ObjectRequest(indexName: 'MyIndexName1', objectID: 'MyObjectID1'),
      ObjectRequest(indexName: 'MyIndexName1', objectID: 'MyObjectID2'),
    ],
);
Browse index
var request = SearchRequest('MyIndexName');
var stream = client.browse(request);
await for (var response in stream) {
  print(response);
}

💡 Insights #

Create InsightsClient:

final client = InsightsClient(
    applicationID: 'MyApplicationID',
    apiKey: 'MyApiKey',
);
Send events
await client.sendEvents(
    [
        InsightEvent({
        'eventType': 'click',
        'eventName': 'Clicked Search Result',
        'index': 'instant_search',
        'userToken': 'anonymous-xxxxxx-xx-xxx-xxxxxx',
        'queryID': '43b15df305339e827f0ac0bdc5ebcaa7',
        'objectIDs': ['item'],
        'positions': [1],
        }),
    ],
);

📄 License #

Algolia Dart API Client Lite is an open-sourced software licensed under the MIT license. This is an unofficial library, it is not affiliated with nor endorsed by Algolia. Contributions are welcome.

3
likes
150
points
15
downloads

Publisher

verified publisheraallam.com

Weekly Downloads

Dart API client to interact with Algolia, designed for client apps.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, dio, meta

More

Packages that depend on algolia_lite