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

Side by Side Diff: pkg/gcloud/lib/http.dart

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years 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 unified diff | Download patch
« no previous file with comments | « pkg/gcloud/lib/db/metamodel.dart ('k') | pkg/gcloud/lib/service_scope.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Provides access to an authenticated HTTP client which can be used to access
6 /// Google APIs.
7 library gcloud.http;
8
9 import 'package:http/http.dart' as http;
10
11 import 'service_scope.dart' as ss;
12
13 const Symbol _authenticatedClientKey = #_gcloud.http;
14
15 /// Access the [http.Client] object available in the current service scope.
16 ///
17 /// The returned object will be the one which was previously registered with
18 /// [registerAuthClientService] within the current (or a parent) service
19 /// scope.
20 ///
21 /// Accessing this getter outside of a service scope will result in an error.
22 /// See the `package:gcloud/service_scope.dart` library for more information.
23 http.Client get authClientService => ss.lookup(_authenticatedClientKey);
24
25 /// Registers the [http.Client] object within the current service scope.
26 ///
27 /// The provided `client` object will be avilable via the top-level
28 /// `authenticatedHttp` getter.
29 ///
30 /// Calling this function outside of a service scope will result in an error.
31 /// Calling this function more than once inside the same service scope is not
32 /// allowed.
33 void registerAuthClientService(http.Client client, {bool close: true}) {
34 ss.register(_authenticatedClientKey, client);
35 if (close) {
36 ss.registerScopeExitCallback(() => client.close());
37 }
38 }
OLDNEW
« no previous file with comments | « pkg/gcloud/lib/db/metamodel.dart ('k') | pkg/gcloud/lib/service_scope.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698