Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9b2545e

Browse files
Make github request class
1 parent 7c8aa39 commit 9b2545e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎lib/Requests/GithubRequest.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import 'package:http/http.dart' as http;
2+
3+
class Github {
4+
final String userName;
5+
final String url = 'https://api.github.com/';
6+
static String client_id = 'Your_github_client_id';
7+
static String client_secret = 'Your_github_client_secret';
8+
9+
final String query = "?client_id=${client_id}&client_secret=${client_secret}";
10+
11+
Github(this.userName);
12+
13+
Future<http.Response> fetchUser() {
14+
return http.get(url + 'users/' + userName + query);
15+
}
16+
17+
Future<http.Response> fetchFollowing() {
18+
return http.get(url + 'users/' + userName + '/following' + query);
19+
}
20+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /