|
1 | | -from github2.core import BaseData, GithubCommand |
| 1 | +from github2.core import BaseData, GithubCommand, Attribute, DateAttribute |
2 | 2 |
|
3 | 3 |
|
4 | 4 | class User(BaseData): |
5 | | - attributes = ("id", "login", "name", "company", "location", |
6 | | - "email", "blog", "following_count", "followers_count", |
7 | | - "public_gist_count", "public_repo_count", |
8 | | - "total_private_repo_count", "collaborators", |
9 | | - "disk_usage", "owned_private_repo_count", |
10 | | - "private_gist_count", "plan") |
| 5 | + id = Attribute("The user id") |
| 6 | + login = Attribute("The login username") |
| 7 | + name = Attribute("The users full name") |
| 8 | + company = Attribute("Name of the company the user is associated with") |
| 9 | + location = Attribute("Location of the user") |
| 10 | + email = Attribute("The users e-mail address") |
| 11 | + blog = Attribute("The users blog") |
| 12 | + following_count = Attribute("Number of other users the user is following") |
| 13 | + followers_count = Attribute("Number of users following this user") |
| 14 | + public_gist_count = Attribute( |
| 15 | + "Number of active public gists owned by the user") |
| 16 | + public_repo_count = Attribute( |
| 17 | + "Number of active repositories owned by the user") |
| 18 | + total_private_repo_count = Attribute("Number of private repositories") |
| 19 | + collaborators = Attribute("Number of collaborators") |
| 20 | + disk_usage = Attribute("Currently used disk space") |
| 21 | + owned_private_repo_count = Attribute("Number of privately owned repos") |
| 22 | + private_gist_count = Attribute( |
| 23 | + "Number of private gists owned by the user") |
| 24 | + plan = Attribute("Current active github plan") |
11 | 25 |
|
12 | 26 | def is_authenticated(self): |
13 | 27 | return self.plan is not None |
14 | 28 |
|
| 29 | + def __repr__(self): |
| 30 | + return "<User: %s>" % (self.login) |
| 31 | + |
15 | 32 |
|
16 | 33 | class Users(GithubCommand): |
17 | 34 | domain = "user" |
18 | 35 |
|
19 | 36 | def search(self, query): |
20 | | - return self.make_request("search", query, filter="users") |
| 37 | + return self.get_values("search", query, filter="users", datatype=User) |
21 | 38 |
|
22 | 39 | def show(self, username): |
23 | 40 | return self.get_value("show", username, filter="user", datatype=User) |
|
0 commit comments