Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes related to the next Meilisearch release (v0.28.0) #170

Merged
merged 44 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
37357f0
Update README.md
meili-bot Jun 9, 2022
1edef26
Change HTTP verbs from settings paths
brunoocasali Jun 13, 2022
107bc2f
Remove getDumpStatus method
brunoocasali Jun 13, 2022
dfbdc49
Replace uid field by taskUid
brunoocasali Jun 13, 2022
469baaf
Apply changes in the search requests/responses (#175)
brunoocasali Jun 20, 2022
505a246
Add a way to paginate tasks
brunoocasali Jun 21, 2022
4bcd108
Transform dump in a Task kind of process
brunoocasali Jun 21, 2022
195ef54
Implement the new task response for client.getTasks
brunoocasali Jun 21, 2022
34f4d01
Transform dump in a Task kind of process
brunoocasali Jun 21, 2022
c6561c3
Apply changes to the Keys resources
brunoocasali Jun 21, 2022
425825b
Add a type wrapper to the Indexes resources
brunoocasali Jun 21, 2022
01c6de0
Add a type wrapper to the documents resources
brunoocasali Jun 21, 2022
a49919c
Remove ClientTaskImpl and TaskImpl
brunoocasali Jun 21, 2022
57ed0ad
Use getTask instead of getStatus
brunoocasali Jun 21, 2022
f1728e6
Merge all about tasks impl into the TaskInfo definition
brunoocasali Jun 21, 2022
690e9d3
Move all from TaskInfo to just Task
brunoocasali Jun 21, 2022
1531038
Add ability to specify uid in the keys creation
brunoocasali Jun 21, 2022
8704a6f
Merge pull request #180 from meilisearch/tasks-refactor
brunoocasali Jun 22, 2022
be61183
Merge pull request #181 from meilisearch/dump-changes
brunoocasali Jun 22, 2022
bcb47bb
Merge pull request #182 from meilisearch/keys-changes
brunoocasali Jun 22, 2022
82f6a04
Merge pull request #183 from meilisearch/indexes-changes
brunoocasali Jun 22, 2022
99c6a78
Merge pull request #184 from meilisearch/documents-changes
brunoocasali Jun 22, 2022
9657085
Merge pull request #185 from meilisearch/simplify-tasks
brunoocasali Jun 22, 2022
6a79a12
Merge pull request #186 from meilisearch/fix-missing-things
brunoocasali Jun 22, 2022
2a3928c
Add uid to client.generateTenantToken
brunoocasali Jun 22, 2022
dfc9351
Add dump creation test
brunoocasali Jun 22, 2022
6468637
Merge pull request #187 from meilisearch/tenant-token-with-uid
brunoocasali Jun 22, 2022
b301403
Merge pull request #188 from meilisearch/dump-creation-test
brunoocasali Jun 22, 2022
dba093e
Fix formatting issues
brunoocasali Jun 22, 2022
1ab0a55
Fix issue in the pre-release test
brunoocasali Jun 22, 2022
bbd2976
Move uid to the first argument in the generateToken method signature
brunoocasali Jul 4, 2022
c34d523
Update .code-samples.meilisearch.yaml
meili-bot Jul 4, 2022
ca7700b
Update code-samples to v0.28
brunoocasali Jul 4, 2022
3616ae4
Add a way to pass fields to getDocument
brunoocasali Jul 4, 2022
fe8673b
Merge pull request #192 from meilisearch/add-fields-to-get-docs
brunoocasali Jul 5, 2022
2401ca3
Add new code-samples content
brunoocasali Jul 4, 2022
b228c13
Merge pull request #191 from meilisearch/meili-bot/code-samples-v0-28
brunoocasali Jul 5, 2022
7358297
Merge pull request #190 from meilisearch/fix-uid-order
brunoocasali Jul 5, 2022
9cd4f19
Move from ResultTask to TasksResults
brunoocasali Jul 7, 2022
9d5cc18
Use Key#uid instead of Key#key in code-samples
brunoocasali Jul 7, 2022
928456e
Merge pull request #193 from meilisearch/tasks-results
brunoocasali Jul 7, 2022
cda7e60
Merge pull request #194 from meilisearch/samples-fix
brunoocasali Jul 7, 2022
00c4f9f
Update .code-samples.meilisearch.yaml
brunoocasali Jul 7, 2022
b6f47c9
Use await client.index('movies').getTasks();
brunoocasali Jul 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 32 additions & 22 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,34 @@
# the documentation on build
# You can read more on https://github.com/meilisearch/documentation/tree/master/.vuepress/code-samples
---
get_all_tasks_filtering_1: |-
await client.index('movies').getTasks();
get_all_tasks_filtering_2: |-
await client.getTasks(TasksQuery(status: ['succeeded', 'failed'], type: ['documentAdditionOrUpdate']);
get_all_tasks_paginating_1: |-
await client.getTasks(TasksQuery(limit: 2, from: 10);
get_all_tasks_paginating_2: |-
await client.getTasks(TasksQuery(limit: 2, from: 8);
get_pagination_settings_1: |-
update_pagination_settings_1: |-
reset_pagination_settings_1: |-
get_faceting_settings_1: |-
update_faceting_settings_1: |-
reset_faceting_settings_1: |-
settings_guide_faceting_1: |-
settings_guide_pagination_1: |-
get_one_index_1: |-
await client.getIndex('movies');
list_all_indexes_1: |-
await client.getIndexes();
await client.getIndexes(IndexesQuery(limit: 3));
create_an_index_1: |-
await client.createIndex('movies', primaryKey: 'id');
update_an_index_1: |-
await client.index('movies').update(primaryKey: 'id');
delete_an_index_1: |-
await client.index('movies').delete();
get_one_document_1: |-
await client.index('movies').getDocument(25684);
await client.index('movies').getDocument(25684, fields: ['id', 'title', 'poster', 'release_date']);
get_documents_1: |-
await client.index('movies').getDocuments(limit: 2);
add_or_replace_documents_1: |-
Expand Down Expand Up @@ -45,10 +61,6 @@ delete_documents_1: |-
await client.index('movies').deleteDocuments([23488, 153738, 437035, 363869]);
search_post_1: |-
await client.index('movies').search('American ninja');
get_task_by_index_1: |-
await client.index('movies').getTask(1);
get_all_tasks_by_index_1: |-
await client.index('movies').getTasks();
get_task_1: |-
await client.getTask(1);
get_all_tasks_1: |-
Expand Down Expand Up @@ -197,8 +209,8 @@ search_parameter_guide_highlight_1: |-
await client
.index('movies')
.search('winter feast', attributesToHighlight: ['overview']);
search_parameter_guide_matches_1: |-
await client.index('movies').search('winter feast', matches: true);
search_parameter_guide_show_matches_position_1: |-
await client.index('movies').search('winter feast', showMatchesPosition: true);
settings_guide_synonyms_1: |-
await client.index('tops').updateSettings(IndexSettings(synonyms: {
'sweater': ['jumper'],
Expand Down Expand Up @@ -301,7 +313,7 @@ getting_started_update_searchable_attributes: |-
getting_started_update_stop_words: |-
await client.index('movies').updateStopWords(['the']);
getting_started_check_task_status: |-
await client.index('movies').getTask(0);
await client.getTask(0);
getting_started_synonyms: |-
await client.index('movies').updateSynonyms({
winnie: ['piglet'],
Expand Down Expand Up @@ -344,17 +356,15 @@ faceted_search_filter_1: |-
['genres = Horror', 'genres = Mystery'],
'director = "Jordan Peele"'
]);
faceted_search_facets_distribution_1: |-
await client.index('movies').search('Batman', facetsDistribution: ['genres']);
faceted_search_facets_1: |-
await client.index('movies').search('Batman', facets: ['genres']);
faceted_search_walkthrough_filter_1: |-
await client.index('movies').search('thriller', filter: [
['genres = Horror', 'genres = Mystery'],
'director = "Jordan Peele"'
]);
post_dump_1: |-
await client.createDump();
get_dump_status_1: |-
await client.getDumpStatus('20201101-110357260');
phrase_search_1: |-
await client.index('movies').search('"african american" horror');
sorting_guide_update_sortable_attributes_1: |-
Expand Down Expand Up @@ -403,9 +413,9 @@ authorization_header_1: |-
var client = MeiliSearchClient('http://127.0.0.1:7700', 'masterKey');
await client.getKeys();
get_one_key_1: |-
await client.getKey('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4');
await client.getKey('6062abda-a5aa-4414-ac91-ecd7944c0f8d');
get_all_keys_1: |-
await client.getKeys();
await client.getKeys(KeysQuery(limit: 3));
create_a_key_1: |-
await client.createKey(
description: 'Add documents: Products API key',
Expand All @@ -415,20 +425,18 @@ create_a_key_1: |-
);
update_a_key_1: |-
await client.updateKey(
'd0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4',
'6062abda-a5aa-4414-ac91-ecd7944c0f8d',
description: 'Manage documents: Products/Reviews API key',
actions: ['documents.add', 'documents.delete'],
indexes: ['products', 'reviews'],
expiresAt: DateTime(2042, 04, 02),
name: 'Products/Reviews API key'
);
delete_a_key_1: |-
await client.deleteKey('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4');
await client.deleteKey('6062abda-a5aa-4414-ac91-ecd7944c0f8d');
security_guide_search_key_1: |-
var client = MeiliSearchClient('http://127.0.0.1:7700', 'apiKey');
await client.index('patient_medical_records').search();
security_guide_update_key_1: |-
var client = MeiliSearchClient('http://127.0.0.1:7700', 'masterKey');
await client.updateKey('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4', indexes: ['doctors']);
await client.updateKey('74c9c733-3368-4738-bbe5-1d18a5fecb37', description: 'Default Search API Key');
security_guide_create_key_1: |-
var client = MeiliSearchClient('http://127.0.0.1:7700', 'masterKey');
await client.createKey(
Expand All @@ -442,8 +450,9 @@ security_guide_list_keys_1: |-
await client.getKeys();
security_guide_delete_key_1: |-
var client = MeiliSearchClient('http://127.0.0.1:7700', 'masterKey');
await client.deleteKey('d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4');
await client.deleteKey('ac5cd97d-5a4b-4226-a868-2d0eb6d197ab');
tenant_token_guide_generate_sdk_1: |-
final uid = '85c3c2f9-bdd6-41f1-abd8-11fcf80e0f76';
final apiKey = 'B5KdX2MY2jV6EXfUs6scSfmC...';
final expiresAt = DateTime.utc(2025, 12, 20);
final searchRules = {
Expand All @@ -454,6 +463,7 @@ tenant_token_guide_generate_sdk_1: |-

final token = client.generateTenantToken(
searchRules,
uid,
apiKey: apiKey, // optional
expiresAt: expiresAt // optional
);
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
- name: Run integration tests
run: docker run --net="host" -v $PWD:/package -w /package dart:${{ matrix.version }} /bin/sh -c 'pub get && pub run test'
run: docker run --net="host" -v $PWD:/package -w /package dart:${{ matrix.version }} /bin/sh -c 'dart pub get && dart run test'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ await index.search('wonder', filter: ['id > 1 AND genres = Action']);
],
"offset": 0,
"limit": 20,
"nbHits": 1,
"estimatedTotalHits": 1,
"processingTimeMs": 0,
"query": "wonder"
}
```

## 🤖 Compatibility with Meilisearch

This package only guarantees the compatibility with the [version v0.27.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.27.0).
This package only guarantees the compatibility with the [version v0.28.0 of Meilisearch](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0).

## 💡 Learn More

Expand Down
36 changes: 17 additions & 19 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import 'package:meilisearch/src/key.dart';
import 'package:meilisearch/src/query_parameters/indexes_query.dart';
import 'package:meilisearch/src/query_parameters/keys_query.dart';
import 'package:meilisearch/src/query_parameters/tasks_query.dart';
import 'package:meilisearch/src/result.dart';
import 'package:meilisearch/src/tasks_results.dart';
import 'package:meilisearch/src/task.dart';
import 'package:meilisearch/src/task_info.dart';

import 'http_request.dart';
import 'index.dart';
Expand All @@ -23,14 +27,14 @@ abstract class MeiliSearchClient {
/// Timeout in milliseconds for opening a url.
int? get connectTimeout;

String generateTenantToken(dynamic searchRules,
String generateTenantToken(String uid, dynamic searchRules,
{String? apiKey, DateTime? expiresAt});

/// Create an index object by given [uid].
MeiliSearchIndex index(String uid);

/// Return list of all existing indexes.
Future<List<MeiliSearchIndex>> getIndexes();
Future<Result<MeiliSearchIndex>> getIndexes({IndexesQuery? params});

/// Find index by matching [uid]. Throws error if index is not exists.
Future<MeiliSearchIndex> getIndex(String uid);
Expand All @@ -41,13 +45,13 @@ abstract class MeiliSearchClient {

/// Create a new index by given [uid] and optional [primaryKey] parameter.
/// Throws an error if index is already exists.
Future<TaskInfo> createIndex(String uid, {String primaryKey});
Future<Task> createIndex(String uid, {String primaryKey});

/// Delete the index by matching [uid].
Future<TaskInfo> deleteIndex(String uid);
Future<Task> deleteIndex(String uid);

/// Update the primary Key of the index by matching [uid].
Future<TaskInfo> updateIndex(String uid, String primaryKey);
Future<Task> updateIndex(String uid, String primaryKey);

/// Return health of the Meilisearch server.
/// Throws an error if containing details if Meilisearch can't process your request.
Expand All @@ -58,30 +62,24 @@ abstract class MeiliSearchClient {
Future<bool> isHealthy();

/// Trigger a dump creation process.
Future<Map<String, String>> createDump();

/// Get the status of a dump creation process.
Future<Map<String, String>> getDumpStatus(String uid);
Future<Task> createDump();

/// Get the public and private keys.
Future<List<Key>> getKeys();
Future<Result<Key>> getKeys({KeysQuery? params});

/// Get a specific key by key.
Future<Key> getKey(String key);
/// Get a specific key by key or uid.
Future<Key> getKey(String keyOrUid);

/// Create a new key.
Future<Key> createKey(
{DateTime? expiresAt,
String? description,
String? uid,
required List<String> indexes,
required List<String> actions});

/// Update a key.
Future<Key> updateKey(String key,
{DateTime? expiresAt,
String? description,
List<String>? indexes,
List<String>? actions});
Future<Key> updateKey(String key, {String? description, String? name});

/// Delete a key
Future<bool> deleteKey(String key);
Expand All @@ -93,7 +91,7 @@ abstract class MeiliSearchClient {
Future<AllStats> getStats();

/// Get a list of tasks from the client.
Future<List<Task>> getTasks();
Future<TasksResults> getTasks({TasksQuery? params});

/// Get a task from an index specified by uid with the specified uid.
Future<Task> getTask(int uid);
Expand Down
Loading