-
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.
chore: plumb through publish command
- Loading branch information
1 parent
27ccd27
commit 5523ce1
Showing
9 changed files
with
58 additions
and
139 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,31 +1,26 @@ | ||
abstract class AbstractErrorResponseBase { | ||
String _message; | ||
Error? _innerException; | ||
AbstractErrorResponseBase(this._message, this._innerException); | ||
|
||
String get message => _message; | ||
Error? get innerException => _innerException; | ||
enum MomentoErrorCode { | ||
INVALID_ARGUMENT_ERROR, | ||
UNKNOWN_SERVICE_ERROR, | ||
ALREADY_EXISTS_ERROR, | ||
NOT_FOUND_ERROR, | ||
} | ||
|
||
class SdkError implements Error, AbstractErrorResponseBase { | ||
@override | ||
// TODO: implement stackTrace | ||
StackTrace? get stackTrace => _innerException?.stackTrace; | ||
|
||
@override | ||
Error? _innerException; | ||
abstract class AbstractExceptionResponseBase { | ||
final String _message; | ||
final Exception? _innerException; | ||
AbstractExceptionResponseBase(this._message, this._innerException); | ||
|
||
@override | ||
String _message; | ||
|
||
SdkError(this._message, this._innerException); | ||
String get message => _message; | ||
Exception? get innerException => _innerException; | ||
} | ||
|
||
@override | ||
// TODO: implement innerException | ||
Error? get innerException => _innerException; | ||
class SdkException extends AbstractExceptionResponseBase implements Exception { | ||
String _messageWrapper; | ||
SdkException(String message, Exception? innerException, String messageWrapper) : _messageWrapper = messageWrapper, super(message, innerException); | ||
|
||
@override | ||
// TODO: implement message | ||
String get message => _message; | ||
String get messageWrapper => _messageWrapper; | ||
} | ||
|
||
} | ||
class UnknownException extends SdkException { | ||
UnknownException(String message, Exception? innerException) : super(message, innerException, "Unknown error has occurred"); | ||
} |
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,12 @@ | ||
sealed class Value {} | ||
class StringValue implements Value { | ||
String _value; | ||
StringValue(String v) : _value = v; | ||
String get value => _value; | ||
} | ||
|
||
class BinaryValue implements Value { | ||
List<int> _value; | ||
BinaryValue(List<int> v) : _value = v; | ||
List<int> get value => _value; | ||
} |
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 |
---|---|---|
@@ -1,14 +1,5 @@ | ||
import '../../errors/errors.dart'; | ||
|
||
class ErrorResponseBase implements AbstractErrorResponseBase { | ||
String _message; | ||
Error? _innerException; | ||
|
||
@override | ||
Error? get innerException => _innerException; | ||
|
||
@override | ||
String get message => _message; | ||
|
||
ErrorResponseBase(SdkError error) : _message = error.message, _innerException = error.innerException; | ||
class ErrorResponseBase extends AbstractExceptionResponseBase { | ||
ErrorResponseBase(SdkException exception) : super(exception.message, exception.innerException); | ||
} |
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 |
---|---|---|
@@ -1,46 +1,20 @@ | ||
// TODO: Put public facing types in this file. | ||
|
||
import 'dart:typed_data'; | ||
|
||
import '../generated/cachepubsub.pb.dart'; | ||
import 'package:grpc/grpc.dart'; | ||
|
||
sealed class Value {} | ||
class StringValue implements Value { | ||
String _value; | ||
StringValue(String v) : _value = v; | ||
String get value => _value; | ||
} | ||
|
||
class BinaryValue implements Value { | ||
Uint8List _value; | ||
BinaryValue(Uint8List v) : _value = v; | ||
Uint8List get value => _value; | ||
} | ||
import 'package:client_sdk_dart/src/auth/credential_provider.dart'; | ||
import 'internal/pubsub_client.dart'; | ||
import 'messages/Values.dart'; | ||
import 'messages/responses/topics/topic_publish.dart'; | ||
|
||
abstract class ITopicClient { | ||
void publish(String cacheName, String topicName, Value value); | ||
Future<TopicPublishResponse> publish(String cacheName, String topicName, Value value); | ||
} | ||
|
||
class TopicClient implements ITopicClient { | ||
ClientChannel _channel; | ||
|
||
TopicClient() { | ||
_channel = ClientChannel(host) | ||
} | ||
@override | ||
void publish() { | ||
// TODO: implement publish | ||
} | ||
ClientPubsub _pubsubClient; | ||
CredentialProvider _credentialProvider; | ||
|
||
void close() { | ||
TopicClient(this._credentialProvider) : _pubsubClient = ClientPubsub(_credentialProvider); | ||
|
||
@override | ||
Future<TopicPublishResponse> publish(String cacheName, String topicName, Value value) { | ||
return this._pubsubClient.publish(cacheName, topicName, value); | ||
} | ||
} | ||
|
||
/// Checks if you are awesome. Spoiler: you are. | ||
class Awesome { | ||
bool get isAwesome => true; | ||
} | ||
|
||
PubsubApi api = PubsubApi(); |
This file was deleted.
Oops, something went wrong.