Skip to content

Commit

Permalink
Merge #170
Browse files Browse the repository at this point in the history
170: Changes related to the next Meilisearch release (v0.28.0) r=brunoocasali a=meili-bot

Related to this issue: meilisearch/integration-guides#205

This PR:
- gathers the changes related to the next Meilisearch release (v0.28.0) so that this package is ready when the official release is out.
- should pass the tests against the [latest pre-release of Meilisearch](https://github.com/meilisearch/meilisearch/releases).
- might eventually contain test failures until the Meilisearch v0.28.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.28.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._

Remaining:

- [x] Fix code-samples
- [x] Changes related to the keys management
- [x] Changes related to the HTTP verbs
- [x] Changes related to the tasks resources
- [x] Changes related to the search
- [x] Changes related to the indexes resources
- [x] Changes related to the documents resources
- [x] Changes related to the dumps resources
- [x] #180 (comment)
- [x] #181 (comment)

Co-authored-by: meili-bot <[email protected]>
Co-authored-by: Bruno Casali <[email protected]>
  • Loading branch information
3 people authored Jul 11, 2022
2 parents 978bd9f + b6f47c9 commit e3eda5b
Show file tree
Hide file tree
Showing 28 changed files with 422 additions and 370 deletions.
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

0 comments on commit e3eda5b

Please sign in to comment.