-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add scalar delete * chore: add docstrings to scalar set and get response classes * add validators and export more things and dart format * add validators to control plane operations * fix: add missing grpc error to sdk exception function * fix: make sure to delete test caches * chore: add tests for scalar get, set, delete * fix imports and dart format * remove unnecessary examples folder bc it was renamed
- Loading branch information
Showing
13 changed files
with
362 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,13 @@ | ||
import 'package:momento/src/errors/errors.dart'; | ||
|
||
void _validateString(String str, String errorMessage) { | ||
if (str.trim().isEmpty) { | ||
throw InvalidArgumentException(errorMessage, null, null); | ||
} | ||
} | ||
|
||
void validateCacheName(String cacheName) => | ||
_validateString(cacheName, "Invalid cache name"); | ||
|
||
void validateTopicName(String topicName) => | ||
_validateString(topicName, "Invalid topic name"); |
27 changes: 27 additions & 0 deletions
27
lib/src/messages/responses/cache/data/scalar/delete_response.dart
This file contains 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 'package:momento/src/messages/responses/responses_base.dart'; | ||
|
||
/// Sealed class for a delete cache item request. | ||
/// | ||
/// Pattern matching can be used to operate on the appropriate subtype. | ||
/// ```dart | ||
/// switch (response) { | ||
/// case DeleteSuccess(): | ||
/// // handle success | ||
/// case DeleteError(): | ||
/// // handle error | ||
/// } | ||
/// ``` | ||
sealed class DeleteResponse {} | ||
|
||
/// Indicates a successful delete cache item request. | ||
class DeleteSuccess implements DeleteResponse {} | ||
|
||
/// Indicates that an error occurred during the delete cache item request. | ||
/// | ||
/// The response object includes the following fields you can use to determine how you want to handle the error: | ||
/// - `errorCode`: a unique Momento error code indicating the type of error that occurred | ||
/// - `message`: a human-readable description of the error | ||
/// - `innerException`: the original error that caused the failure; can be re-thrown | ||
class DeleteError extends ErrorResponseBase implements DeleteResponse { | ||
DeleteError(super.exception); | ||
} |
Oops, something went wrong.