-
Notifications
You must be signed in to change notification settings - Fork 18
feat: add support for v30.0 and add missing features from v0.25+ #151
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
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
2491024
chore: bump deps
tharropoulos 11ae8d7
feat(stopwords): add stopwords models and schemas
tharropoulos fdb4842
feat(stopwords): add stopwords api client
tharropoulos 53a14cd
feat(stopwords): expose stopwords support on client
tharropoulos 5f16e1c
test(stopwords): add stopwords integration tests
tharropoulos b9ff0e9
feat(curation): add curation sets models
tharropoulos ded8eed
feat(api): add list-based api call support with caching
tharropoulos 01b9ef6
feat(curation): add curation set api client
tharropoulos b1851a4
feat(curation): integrate curation sets into client
tharropoulos 5858475
test(curation): add integration tests for curation sets
tharropoulos 2e2c908
feat(synonym-sets): add models for synonym sets
tharropoulos 1b3e76f
feat(synonym-sets): add synonym set classes
tharropoulos 320d6e4
feat(synonym-sets): integrate synonym sets into client
tharropoulos b75f899
test(synonym-sets): add integration tests for synonym sets
tharropoulos acb44ef
feat(stemming): add stemming models and schemas
tharropoulos fa729f0
feat(stemming): add stemming api client
tharropoulos 2c4087c
feat(stemming): expose stemming to client
tharropoulos c8fb4cc
feat(api): add post raw method to base api call
tharropoulos 60457cc
test(stemming): add integration tests for stemming
tharropoulos 7136e1d
feat(convo): add conversation models and schemas
tharropoulos f72e4a9
feat(convo): add conversation model api client
tharropoulos ae14d2a
feat(convo): expose conversation models to client
tharropoulos 4bbca93
test(convo): add integration tests for conversation models
tharropoulos 8858c88
test(nl-search): add integration tests for nl search
tharropoulos 35ee30b
feat(nl-search): add nl search model api client
tharropoulos 602fa76
feat(nl-search): register nl search models to client
tharropoulos bb20d79
test(nl-search): add tests for nl-search
tharropoulos e9a76ea
feat(convo): add conversation models
tharropoulos 1e67e66
feat(convo): add conversations api
tharropoulos 5b59f4a
feat(convo): add conversations to client
tharropoulos 4778f2c
feat(analytics): add analytics models
tharropoulos a0c29a9
feat(analytics): add analytics api
tharropoulos 3bb6458
feat(analytics): add analytics to client
tharropoulos c19afe9
test(analytics): add tests for analytics
tharropoulos ce3bf2c
fix(synonyms): add deprecation message to old synonyms
tharropoulos 5450cb0
ci: add typesense v30.0 to ci for integration tests
tharropoulos 02e3286
fix(curation): add missing parameters for curation sets
tharropoulos 55791db
refactor(analytics): add createMany api for analytics rules
tharropoulos 175aff5
chore: lint
tharropoulos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import 'services/api_call.dart'; | ||
| import 'analytics_rules.dart'; | ||
| import 'analytics_rule.dart'; | ||
| import 'analytics_events.dart'; | ||
|
|
||
| class Analytics { | ||
| final ApiCall _apiCall; | ||
| final AnalyticsRules _rules; | ||
| final AnalyticsEvents _events; | ||
| final _individualRules = <String, AnalyticsRule>{}; | ||
|
|
||
| Analytics(ApiCall apiCall) | ||
| : _apiCall = apiCall, | ||
| _rules = AnalyticsRules(apiCall), | ||
| _events = AnalyticsEvents(apiCall); | ||
|
|
||
| AnalyticsRules rules() => _rules; | ||
|
|
||
| AnalyticsRule rule(String name) { | ||
| if (!_individualRules.containsKey(name)) { | ||
| _individualRules[name] = AnalyticsRule(name, _apiCall); | ||
| } | ||
| return _individualRules[name]!; | ||
| } | ||
|
|
||
| AnalyticsEvents events() => _events; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import 'models/models.dart'; | ||
| import 'services/api_call.dart'; | ||
|
|
||
| class AnalyticsEvents { | ||
| final ApiCall _apiCall; | ||
| static const String eventsPath = '/analytics/events'; | ||
| static const String flushPath = '/analytics/flush'; | ||
| static const String statusPath = '/analytics/status'; | ||
|
|
||
| AnalyticsEvents(ApiCall apiCall) : _apiCall = apiCall; | ||
|
|
||
| Future<AnalyticsEventCreateResponse> create( | ||
| AnalyticsEventCreateSchema event) async { | ||
| final response = | ||
| await _apiCall.post(eventsPath, bodyParameters: event.toJson()); | ||
| return AnalyticsEventCreateResponse.fromJson(response); | ||
| } | ||
|
|
||
| Future<AnalyticsEventsRetrieveSchema> retrieve({ | ||
| required String userId, | ||
| required String name, | ||
| required int n, | ||
| }) async { | ||
| final response = await _apiCall.get( | ||
| eventsPath, | ||
| queryParams: { | ||
| 'user_id': userId, | ||
| 'name': name, | ||
| 'n': n.toString(), | ||
| }, | ||
| ); | ||
| return AnalyticsEventsRetrieveSchema.fromJson(response); | ||
| } | ||
|
|
||
| Future<AnalyticsEventCreateResponse> flush() async { | ||
| final response = await _apiCall.post(flushPath, bodyParameters: {}); | ||
| return AnalyticsEventCreateResponse.fromJson(response); | ||
| } | ||
|
|
||
| Future<AnalyticsStatus> status() async { | ||
| final response = await _apiCall.get(statusPath); | ||
| return AnalyticsStatus.fromJson(response); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import 'models/models.dart'; | ||
| import 'services/api_call.dart'; | ||
| import 'analytics_rules.dart'; | ||
|
|
||
| class AnalyticsRule { | ||
| final String _name; | ||
| final ApiCall _apiCall; | ||
|
|
||
| AnalyticsRule(String name, ApiCall apiCall) | ||
| : _name = name, | ||
| _apiCall = apiCall; | ||
|
|
||
| Future<AnalyticsRuleSchema> retrieve() async { | ||
| final response = await _apiCall.get(_endpointPath); | ||
| return AnalyticsRuleSchema.fromJson(response); | ||
| } | ||
|
|
||
| Future<AnalyticsRuleDeleteSchema> delete() async { | ||
| final response = await _apiCall.delete(_endpointPath); | ||
| return AnalyticsRuleDeleteSchema.fromJson(response); | ||
| } | ||
|
|
||
| String get _endpointPath => | ||
| '${AnalyticsRules.resourcepath}/${Uri.encodeComponent(_name)}'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| import 'models/models.dart'; | ||
| import 'services/api_call.dart'; | ||
| import 'analytics_rule.dart'; | ||
|
|
||
| class AnalyticsRules { | ||
| final ApiCall _apiCall; | ||
| static const String resourcepath = '/analytics/rules'; | ||
| final _individualRules = <String, AnalyticsRule>{}; | ||
|
|
||
| AnalyticsRules(ApiCall apiCall) : _apiCall = apiCall; | ||
|
|
||
| /// Creates a single analytics rule. | ||
| Future<AnalyticsRuleSchema> create(AnalyticsRuleCreateSchema rule) async { | ||
| final response = await _apiCall.post( | ||
| resourcepath, | ||
| bodyParameters: rule.toJson(), | ||
| ); | ||
| return AnalyticsRuleSchema.fromJson( | ||
| Map<String, dynamic>.from(response as Map), | ||
| ); | ||
| } | ||
|
|
||
| /// Creates multiple analytics rules. | ||
| Future<List<AnalyticsRuleSchema>> createMany( | ||
| List<AnalyticsRuleCreateSchema> rules) async { | ||
| final body = rules.map((item) => item.toJson()).toList(); | ||
| final encodedBody = json.encode(body); | ||
| final response = await _apiCall.sendList((node) => node.client!.post( | ||
| _apiCall.getRequestUri(node, resourcepath), | ||
| headers: _apiCall.defaultHeaders, | ||
| body: encodedBody, | ||
| )); | ||
| return response.map((item) { | ||
| return AnalyticsRuleSchema.fromJson( | ||
| Map<String, dynamic>.from(item as Map), | ||
| ); | ||
| }).toList(); | ||
| } | ||
|
|
||
| Future<List<AnalyticsRuleSchema>> retrieve({String? ruleTag}) async { | ||
| final query = <String, String>{}; | ||
| if (ruleTag != null) { | ||
| query['rule_tag'] = ruleTag; | ||
| } | ||
| final response = await _apiCall.getList( | ||
| resourcepath, | ||
| queryParams: query.isEmpty ? null : query, | ||
| ); | ||
| return response | ||
| .map((item) => | ||
| AnalyticsRuleSchema.fromJson(Map<String, dynamic>.from(item))) | ||
| .toList(); | ||
| } | ||
|
|
||
| Future<AnalyticsRuleSchema> upsert( | ||
| String ruleName, AnalyticsRuleUpsertSchema update) async { | ||
| final response = await _apiCall.put( | ||
| '$resourcepath/${Uri.encodeComponent(ruleName)}', | ||
| bodyParameters: update.toJson(), | ||
| ); | ||
| return AnalyticsRuleSchema.fromJson(response); | ||
| } | ||
|
|
||
| AnalyticsRule operator [](String ruleName) { | ||
| if (!_individualRules.containsKey(ruleName)) { | ||
| _individualRules[ruleName] = AnalyticsRule(ruleName, _apiCall); | ||
| } | ||
| return _individualRules[ruleName]!; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import 'models/models.dart'; | ||
| import 'services/api_call.dart'; | ||
| import 'conversations.dart'; | ||
|
|
||
| class Conversation { | ||
| final String _id; | ||
| final ApiCall _apiCall; | ||
|
|
||
| Conversation(String id, ApiCall apiCall) | ||
| : _id = id, | ||
| _apiCall = apiCall; | ||
|
|
||
| Future<List<ConversationSchema>> retrieve() async { | ||
| final response = await _apiCall.getList(_endpointPath); | ||
| return response | ||
| .map((item) => | ||
| ConversationSchema.fromJson(Map<String, dynamic>.from(item))) | ||
| .toList(); | ||
| } | ||
|
|
||
| Future<ConversationUpdateSchema> update( | ||
| ConversationUpdateSchema params) async { | ||
| final response = | ||
| await _apiCall.put(_endpointPath, bodyParameters: params.toJson()); | ||
| return ConversationUpdateSchema.fromJson(response); | ||
| } | ||
|
|
||
| Future<ConversationDeleteSchema> delete() async { | ||
| final response = await _apiCall.delete(_endpointPath); | ||
| return ConversationDeleteSchema.fromJson(response); | ||
| } | ||
|
|
||
| String get _endpointPath => | ||
| '${Conversations.resourcepath}/${Uri.encodeComponent(_id)}'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import 'models/models.dart'; | ||
| import 'services/api_call.dart'; | ||
| import 'conversations_models.dart'; | ||
|
|
||
| class ConversationModel { | ||
| final String _id; | ||
| final ApiCall _apiCall; | ||
|
|
||
| ConversationModel(String id, ApiCall apiCall) | ||
| : _id = id, | ||
| _apiCall = apiCall; | ||
|
|
||
| Future<ConversationModelCreateSchema> update( | ||
| ConversationModelCreateSchema params) async { | ||
| final response = | ||
| await _apiCall.put(_endpointPath, bodyParameters: params.toJson()); | ||
| return ConversationModelCreateSchema.fromJson(response); | ||
| } | ||
|
|
||
| Future<ConversationModelSchema> retrieve() async { | ||
| final response = await _apiCall.get(_endpointPath); | ||
| return ConversationModelSchema.fromJson(response); | ||
| } | ||
|
|
||
| Future<ConversationModelDeleteSchema> delete() async { | ||
| final response = await _apiCall.delete(_endpointPath); | ||
| return ConversationModelDeleteSchema.fromJson(response); | ||
| } | ||
|
|
||
| String get _endpointPath => | ||
| '${ConversationsModels.resourcepath}/${Uri.encodeComponent(_id)}'; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.