-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-index.service.js
41 lines (31 loc) · 1021 Bytes
/
api-index.service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(function () {
'use strict';
angular
.module('index')
.factory('index.apiIndex', factory);
factory.$inject = ['$http'];
function factory($http) {
var service = {
query: getUsers,
user: {
getData: getDataUser,
getFollowers: getFollowersUser,
getFollowing: getFollowingUser
}
};
const url = 'https://api.github.com/';
function getUsers(param) {
return $http.get(url + 'search/users?q=' + param);
}
function getDataUser(userLogin) {
return $http.get(url + 'users/' + userLogin);
}
function getFollowersUser(userLogin) {
return $http.get(url + 'users/' + userLogin + '/followers');
}
function getFollowingUser(userLogin) {
return $http.get(url + 'users/' + userLogin + '/following');
}
return service;
}
})();