Skip to content

Keys changes #182

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

Merged
merged 2 commits into from
Jun 22, 2022
Merged

Keys changes #182

merged 2 commits into from
Jun 22, 2022

Conversation

brunoocasali
Copy link
Member

  • Add a type to handle responses called Result.
  • client.getKeys({KeysQuery? params}); now returns a Result<Key>

- Remove dump_test.dart it is useless now
@brunoocasali brunoocasali added the breaking-change The related changes are breaking for the users label Jun 21, 2022
@brunoocasali brunoocasali requested a review from alallema June 21, 2022 21:25
Copy link
Contributor

@alallema alallema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Still have a couple of questions in this one 😊

Comment on lines +118 to +121
Future<Task> createDump() async {
final response = await http.postMethod('/dumps');

return Task.fromMap(response.data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this one isn't modified in the Dump PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github bug :/ It mess with this branch PR.

Comment on lines +1 to +16
class KeysQuery {
final int? offset;
final int? limit;

KeysQuery({
this.limit,
this.offset,
});

Map<String, dynamic> toQuery() {
return <String, dynamic>{
'offset': this.offset,
'limit': this.limit,
}..removeWhere((key, value) => value == null);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the Dart, you prefer to create a class for each return. I think I prefer this way too!

Base automatically changed from dump-changes to bump-meilisearch-v0.28.0 June 22, 2022 19:26
@brunoocasali brunoocasali merged commit bcb47bb into bump-meilisearch-v0.28.0 Jun 22, 2022
@brunoocasali brunoocasali deleted the keys-changes branch June 22, 2022 19:28
bors bot added a commit that referenced this pull request Jul 11, 2022
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]>
bors bot added a commit that referenced this pull request Jul 11, 2022
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants