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

Unified Diff: samples/dartiverse_search/lib/github_search_engine.dart

Issue 752303004: Delete dartiverse-search from the repo and update dart:io documentation to point (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/dartiverse_search/bin/server.dart ('k') | samples/dartiverse_search/lib/search_engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/dartiverse_search/lib/github_search_engine.dart
diff --git a/samples/dartiverse_search/lib/github_search_engine.dart b/samples/dartiverse_search/lib/github_search_engine.dart
deleted file mode 100644
index 8c09d5654fe8a78291bceaed524e0f24966c1137..0000000000000000000000000000000000000000
--- a/samples/dartiverse_search/lib/github_search_engine.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-part of search_engine;
-
-
-class GithubSearchEngine implements SearchEngine {
- String get name => 'Github';
-
- Stream<SearchResult> search(String input) {
- var query = {
- 'q': 'language:dart $input'
- };
- var searchUri = new Uri.https(
- 'api.github.com',
- '/search/repositories',
- query);
- var controller = new StreamController();
- http_client.get(searchUri)
- .then((http_client.Response response) {
- if (response.statusCode != HttpStatus.OK) {
- throw "Bad status code: ${response.statusCode}, "
- "message: ${response.reasonPhrase}";
- }
- var json = JSON.decode(response.body);
- json.putIfAbsent('items', () => []);
- json['items']
- .expand((item) {
- if (item['description'] == null ||
- item['description'].isEmpty) {
- // Skip results without a description.
- return [];
- }
- return [item];
- })
- .take(3)
- .forEach((item) {
- controller.add(new SearchResult(
- item['description'], item['html_url']));
- });
- })
- .catchError(controller.addError)
- .whenComplete(controller.close);
- return controller.stream;
- }
-}
« no previous file with comments | « samples/dartiverse_search/bin/server.dart ('k') | samples/dartiverse_search/lib/search_engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698