-
Notifications
You must be signed in to change notification settings - Fork 30
Tasks refactor #180
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
Tasks refactor #180
Conversation
06b6186
to
d183ef3
Compare
- Add ResultTask type to handle response
d183ef3
to
195ef54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So great! I'm going to use it as inspiration for my SDK. I just made a couple of comment
@@ -0,0 +1,22 @@ | |||
import 'package:meilisearch/src/task.dart'; | |||
|
|||
class ResultTask<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the name of ResultTask
to TaskResult
in the golang SDK not sure it's really relevant but for TasksQuery
you put Task at the beginning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.status: const [], | ||
this.type: const []}); | ||
|
||
Map<String, dynamic> toQuery() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the one just above is the constructor what is this one for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of this method is to transform the internal data in a way I can send to the post/get methods as the query string:
final response = await http.getMethod('/tasks', queryParameters: params?.toQuery());
By using this idea, I'll get an object ready to be used, because all the transformations like joined arrays and the removal of null values are already done.
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]>
189: Update version for the next release (v0.6.0) r=brunoocasali a=brunoocasali This version makes this package compatible with Meilisearch v0.28.0 🎉 Check out the changelog of [Meilisearch v0.28.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0) for more information on the changes. ## 💥 Breaking changes - `MeiliSearchClient#getDumpStatus` method was removed. (#173) `@brunoocasali` - `MeiliSearchClient#getIndexes` method now return a object type `Result<MeiliSearchIndex>`. (#183) `@brunoocasali` - `TaskInfo`, `TaskImpl`, `ClientTaskImpl` are now just `Task`. (#185) `@brunoocasali` - The method `getStatus` was removed in the new class. - `MeiliSearchClient#generateTenantToken` now require a `String uid` which is the `uid` of the `Key` instance used to sign the token. (#187) `@brunoocasali` - `MeiliSearchClient#createDump` now responds with `Task`. (#181) `@brunoocasali` - `MeiliSearchClient#getKeys` method now return a object type `Result<Key>`. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#updateKey` now can just update a `description` and/or `name`. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getTasks` method now return a object type `Future<ResultTask>`. (#180) `@brunoocasali` - `MeiliSearchIndex#getTasks` method now return a object type `Future<ResultTask>`. (#180) `@brunoocasali` - `MeiliSearchIndex#search` `facetsDistribution` is now `facets` (#175) `@brunoocasali` - `MeiliSearchIndex#search` `matches` is now `showMatchesPosition` (#175) `@brunoocasali` - `MeiliSearchIndex#getDocuments` method now return a object type `Future<Result>`. - `MeiliSearchIndex#getDocuments` method now accepts a object as a parameter and `offset`, `limit`, `attributesToRetrieve` were not longer accepted. - `nbHits`, `exhaustiveNbHits`, `facetsDistribution`, `exhaustiveFacetsCount` were removed from `SearchResult`. (#175) `@brunoocasali` ## 🚀 Enhancements - `MeiliSearchClient#getIndexes` accepts a object `IndexesQuery` to filter and paginate the results. - `MeiliSearchClient#getKeys` accepts a object `KeysQuery` to filter and paginate the results. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getKey` accepts both a `Key#uid` or `Key#key` value. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getTasks` accepts a object `TasksQuery` to filter and paginate the results. (#185) `@brunoocasali` - `MeiliSearchIndex#getTasks` accepts a object `TasksQuery` to filter and paginate the results. (#185) `@brunoocasali` - `MeiliSearchClient#createKey` can specify a `uid` (optionally) to create a new `Key`. (#186), (#182) `@brunoocasali` - `MeiliSearchIndex#getDocuments` accepts a object `DocumentsQuery` to filter and paginate the results. (#184) `@brunoocasali` - `Key` has now a `name` and `uid` string fields. (#186), (#182) `@brunoocasali` - `estimatedTotalHits`, `facetDistribution` were added to `SearchResult` (#175) `@brunoocasali` - Sending a invalid `uid` or `apiKey` will raise `InvalidApiKeyException`. (#187) `@brunoocasali` - Remove unused generic T in search method (#176) `@ShakyaCsun` ## 💅 Misc - Improve Docker configuration in the package (#164) `@brunoocasali` - Add test for `filter` paramter with spaces (#179) `@ShakyaCsun` - Improve pub spec score points (#171) `@brunoocasali` Thanks again to `@ShakyaCsun,` `@brunoocasali,` `@dependabot` ! 🎉 Co-authored-by: Bruno Casali <[email protected]>
189: Update version for the next release (v0.6.0) r=brunoocasali a=brunoocasali This version makes this package compatible with Meilisearch v0.28.0 🎉 Check out the changelog of [Meilisearch v0.28.0](https://github.com/meilisearch/meilisearch/releases/tag/v0.28.0) for more information on the changes. ## 💥 Breaking changes - `MeiliSearchClient#getDumpStatus` method was removed. (#173) `@brunoocasali` - `MeiliSearchClient#getIndexes` method now return a object type `Result<MeiliSearchIndex>`. (#183) `@brunoocasali` - `TaskInfo`, `TaskImpl`, `ClientTaskImpl` are now just `Task`. (#185) `@brunoocasali` - The method `getStatus` was removed in the new class. - `MeiliSearchClient#generateTenantToken` now require a `String uid` which is the `uid` of the `Key` instance used to sign the token. (#187) `@brunoocasali` - `MeiliSearchClient#createDump` now responds with `Task`. (#181) `@brunoocasali` - `MeiliSearchClient#getKeys` method now return a object type `Result<Key>`. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#updateKey` now can just update a `description` and/or `name`. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getTasks` method now return a object type `Future<ResultTask>`. (#180) `@brunoocasali` - `MeiliSearchIndex#getTasks` method now return a object type `Future<ResultTask>`. (#180) `@brunoocasali` - `MeiliSearchIndex#search` `facetsDistribution` is now `facets` (#175) `@brunoocasali` - `MeiliSearchIndex#search` `matches` is now `showMatchesPosition` (#175) `@brunoocasali` - `MeiliSearchIndex#getDocuments` method now return a object type `Future<Result>`. - `MeiliSearchIndex#getDocuments` method now accepts a object as a parameter and `offset`, `limit`, `attributesToRetrieve` were not longer accepted. - `nbHits`, `exhaustiveNbHits`, `facetsDistribution`, `exhaustiveFacetsCount` were removed from `SearchResult`. (#175) `@brunoocasali` ## 🚀 Enhancements - `MeiliSearchClient#getIndexes` accepts a object `IndexesQuery` to filter and paginate the results. - `MeiliSearchClient#getKeys` accepts a object `KeysQuery` to filter and paginate the results. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getKey` accepts both a `Key#uid` or `Key#key` value. (#186), (#182) `@brunoocasali` - `MeiliSearchClient#getTasks` accepts a object `TasksQuery` to filter and paginate the results. (#185) `@brunoocasali` - `MeiliSearchIndex#getTasks` accepts a object `TasksQuery` to filter and paginate the results. (#185) `@brunoocasali` - `MeiliSearchClient#createKey` can specify a `uid` (optionally) to create a new `Key`. (#186), (#182) `@brunoocasali` - `MeiliSearchIndex#getDocument` accepts a list of fields to reduce the final payload. - `MeiliSearchIndex#getDocuments` accepts a object `DocumentsQuery` to filter and paginate the results. (#184) `@brunoocasali` - `Key` has now a `name` and `uid` string fields. (#186), (#182) `@brunoocasali` - `estimatedTotalHits`, `facetDistribution` were added to `SearchResult` (#175) `@brunoocasali` - Sending a invalid `uid` or `apiKey` will raise `InvalidApiKeyException`. (#187) `@brunoocasali` - Remove unused generic T in search method (#176) `@ShakyaCsun` ## 💅 Misc - Improve Docker configuration in the package (#164) `@brunoocasali` - Add test for `filter` paramter with spaces (#179) `@ShakyaCsun` - Improve pub spec score points (#171) `@brunoocasali` Thanks again to `@ShakyaCsun,` `@brunoocasali,` `@dependabot` ! 🎉 Co-authored-by: Bruno Casali <[email protected]>
TasksQuery
object, which adds the ability to paginate the results using a keyset pagination.limit
,next
,from
attributes handle the pagination.indexUid
is used to filter tasks by index.status
is used to filter tasks by status (succeeded
,failed
and so on...)type
is used to filter tasks by type (dumpCreation
,documentDeletion
,indexCreation
and so on...)MeiliSearchIndex
.getTasks();
now returnsResultTask
.