-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from ably/refactor-classes-into-files
Refactor large files into 1 file per class
- Loading branch information
Showing
114 changed files
with
2,247 additions
and
2,148 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
File renamed without changes.
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
export 'src/generated/platformconstants.dart'; | ||
export 'src/impl/paginated_result.dart'; | ||
export 'src/impl/realtime/channels.dart'; | ||
export 'src/impl/realtime/connection.dart'; | ||
export 'src/impl/realtime/realtime.dart'; | ||
export 'src/impl/rest/channels.dart'; | ||
export 'src/impl/rest/rest.dart'; | ||
export 'src/info.dart'; | ||
export 'src/spec/spec.dart'; | ||
library ably_flutter; | ||
|
||
export 'src/authentication/authentication.dart'; | ||
export 'src/common/common.dart'; | ||
export 'src/error/error.dart'; | ||
export 'src/logging/logging.dart'; | ||
export 'src/message/message.dart'; | ||
export 'src/platform/platform.dart'; | ||
export 'src/push_notifications/push_notifications.dart'; | ||
export 'src/realtime/realtime.dart'; | ||
export 'src/rest/rest.dart'; | ||
export 'src/stats/stats.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,8 @@ | ||
export 'src/auth.dart'; | ||
export 'src/auth_options.dart'; | ||
export 'src/cipher_params.dart'; | ||
export 'src/client_options.dart'; | ||
export 'src/http_auth_type.dart'; | ||
export 'src/token_details.dart'; | ||
export 'src/token_params.dart'; | ||
export 'src/token_request.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
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,93 @@ | ||
import '../authentication.dart'; | ||
|
||
/// A class providing configurable authentication options used when | ||
/// authenticating or issuing tokens explicitly. | ||
/// | ||
/// These options are used when invoking Auth#authorize, Auth#requestToken, | ||
/// Auth#createTokenRequest and Auth#authorize. | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO1 | ||
abstract class AuthOptions { | ||
/// initializes an instance without any defaults | ||
AuthOptions(); | ||
|
||
/// Convenience constructor, to create an AuthOptions based | ||
/// on the key string obtained from the application dashboard. | ||
/// param [key]: the full key string as obtained from the dashboard | ||
AuthOptions.fromKey(String key) { | ||
if (key.contains(':')) { | ||
this.key = key; | ||
} else { | ||
tokenDetails = TokenDetails(key); | ||
} | ||
} | ||
|
||
/// A function which is called when a new token is required. | ||
/// | ||
/// The role of the callback is to either generate a signed [TokenRequest] | ||
/// which may then be submitted automatically by the library to | ||
/// the Ably REST API requestToken; or to provide a valid token | ||
/// as a [TokenDetails] object. | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2b | ||
AuthCallback? authCallback; | ||
|
||
/// A URL that the library may use to obtain | ||
/// a token String (in plain text format), | ||
/// or a signed [TokenRequest] or [TokenDetails] (in JSON format). | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2c | ||
String? authUrl; | ||
|
||
/// HTTP Method used when a request is made using authURL | ||
/// | ||
/// defaults to 'GET', supports 'GET' and 'POST' | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2d | ||
String? authMethod; | ||
|
||
/// Full Ably key string, as obtained from dashboard, | ||
/// used when signing token requests locally | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2a | ||
String? key; | ||
|
||
/// An authentication token issued for this application | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2i | ||
TokenDetails? tokenDetails; | ||
|
||
/// Headers to be included in any request made to the [authUrl] | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2e | ||
Map<String, String>? authHeaders; | ||
|
||
/// Additional params to be included in any request made to the [authUrl] | ||
/// | ||
/// As query params in the case of GET | ||
/// and as form-encoded in the body in the case of POST | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2f | ||
Map<String, String>? authParams; | ||
|
||
/// If true, the library will when issuing a token request query | ||
/// the Ably system for the current time instead of relying on a | ||
/// locally-available time of day. | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#AO2g | ||
bool? queryTime; | ||
|
||
/// Token Auth is used if useTokenAuth is set to true | ||
/// | ||
/// or if useTokenAuth is unspecified and any one of | ||
/// [authUrl], [authCallback], token, or [TokenDetails] is provided | ||
/// https://docs.ably.com/client-lib-development-guide/features/#RSA4 | ||
bool? useTokenAuth; | ||
|
||
// TODO(tiholic) missing token attribute here | ||
// see: https://docs.ably.com/client-lib-development-guide/features/#AO2h | ||
} | ||
|
||
/// Function-type alias implemented by a function that provides either tokens, | ||
/// or signed token requests, in response to a request with given token params. | ||
/// | ||
/// Java: io.ably.lib.rest.Auth.TokenCallback.getTokenRequest(TokenParams) | ||
/// returns either a [String] token or [TokenDetails] or [TokenRequest] | ||
typedef AuthCallback = Future<Object> Function(TokenParams params); |
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,26 @@ | ||
/// params to configure encryption for a channel | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#TZ1 | ||
abstract class CipherParams { | ||
/// Specifies the algorithm to use for encryption | ||
/// | ||
/// Default is AES. Currently only AES is supported. | ||
/// https://docs.ably.com/client-lib-development-guide/features/#TZ2a | ||
String? algorithm; | ||
|
||
/// private key used to encrypt and decrypt payloads | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#TZ2d | ||
dynamic key; | ||
|
||
/// the length in bits of the key | ||
/// | ||
/// https://docs.ably.com/client-lib-development-guide/features/#TZ2b | ||
int? keyLength; | ||
|
||
/// Specify cipher mode | ||
/// | ||
/// Default is CBC. Currently only CBC is supported | ||
/// https://docs.ably.com/client-lib-development-guide/features/#TZ2c | ||
String? mode; | ||
} |
105 changes: 3 additions & 102 deletions
105
lib/src/spec/rest/options.dart → ...rc/authentication/src/client_options.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
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,11 @@ | ||
/// Java: io.ably.lib.http.HttpAuth.Type | ||
enum HttpAuthType { | ||
/// indicates basic authentication | ||
basic, | ||
|
||
/// digest authentication | ||
digest, | ||
|
||
/// Token auth | ||
xAblyToken, | ||
} |
Oops, something went wrong.