Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: lib/src/client.dart

Issue 1311323002: Modernize the style. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/client.dart
diff --git a/lib/src/client.dart b/lib/src/client.dart
index 60495a0ab540805036b28de0fd5a7a6d01bc7647..371eed3093c659e2059b2212e6559d05d277bdc5 100644
--- a/lib/src/client.dart
+++ b/lib/src/client.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library oauth2_client;
+library oauth2.client;
import 'dart:async';
@@ -15,8 +15,10 @@ import 'utils.dart';
// TODO(nweiz): Add an onCredentialsRefreshed event once we have some event
// infrastructure.
-/// An OAuth2 client. This acts as a drop-in replacement for an [http.Client],
-/// while sending OAuth2 authorization credentials along with each request.
+/// An OAuth2 client.
+///
+/// This acts as a drop-in replacement for an [http.Client], while sending
+/// OAuth2 authorization credentials along with each request.
///
/// The client also automatically refreshes its credentials if possible. When it
/// makes a request, if its credentials are expired, it will first refresh them.
@@ -34,18 +36,22 @@ import 'utils.dart';
/// authorize. At the time of writing, the only authorization method this
/// library supports is [AuthorizationCodeGrant].
class Client extends http.BaseClient {
- /// The client identifier for this client. The authorization server will issue
- /// each client a separate client identifier and secret, which allows the
- /// server to tell which client is accessing it. Some servers may also have an
- /// anonymous identifier/secret pair that any client may use.
+ /// The client identifier for this client.
+ ///
+ /// The authorization server will issue each client a separate client
+ /// identifier and secret, which allows the server to tell which client is
+ /// accessing it. Some servers may also have an anonymous identifier/secret
+ /// pair that any client may use.
///
/// This is usually global to the program using this library.
final String identifier;
- /// The client secret for this client. The authorization server will issue
- /// each client a separate client identifier and secret, which allows the
- /// server to tell which client is accessing it. Some servers may also have an
- /// anonymous identifier/secret pair that any client may use.
+ /// The client secret for this client.
+ ///
+ /// The authorization server will issue each client a separate client
+ /// identifier and secret, which allows the server to tell which client is
+ /// accessing it. Some servers may also have an anonymous identifier/secret
+ /// pair that any client may use.
///
/// This is usually global to the program using this library.
///
@@ -56,16 +62,19 @@ class Client extends http.BaseClient {
final String secret;
/// The credentials this client uses to prove to the resource server that it's
- /// authorized. This may change from request to request as the credentials
- /// expire and the client refreshes them automatically.
+ /// authorized.
+ ///
+ /// This may change from request to request as the credentials expire and the
+ /// client refreshes them automatically.
Credentials get credentials => _credentials;
Credentials _credentials;
/// The underlying HTTP client.
http.Client _httpClient;
- /// Creates a new client from a pre-existing set of credentials. When
- /// authorizing a client for the first time, you should use
+ /// Creates a new client from a pre-existing set of credentials.
+ ///
+ /// When authorizing a client for the first time, you should use
/// [AuthorizationCodeGrant] instead of constructing a [Client] directly.
///
/// [httpClient] is the underlying client that this forwards requests to after
@@ -77,9 +86,10 @@ class Client extends http.BaseClient {
{http.Client httpClient})
: _httpClient = httpClient == null ? new http.Client() : httpClient;
- /// Sends an HTTP request with OAuth2 authorization credentials attached. This
- /// will also automatically refresh this client's [Credentials] before sending
- /// the request if necessary.
+ /// Sends an HTTP request with OAuth2 authorization credentials attached.
+ ///
+ /// This will also automatically refresh this client's [Credentials] before
+ /// sending the request if necessary.
Future<http.StreamedResponse> send(http.BaseRequest request) async {
if (credentials.isExpired) {
if (!credentials.canRefresh) throw new ExpirationException(credentials);
@@ -96,7 +106,7 @@ class Client extends http.BaseClient {
try {
authenticate = new AuthenticateHeader.parse(
response.headers['www-authenticate']);
- } on FormatException catch (e) {
+ } on FormatException catch (_) {
return response;
}

Powered by Google App Engine
This is Rietveld 408576698