diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py new file mode 100644 index 00000000..e126c313 --- /dev/null +++ b/github/AuthenticatedUser.py @@ -0,0 +1,39 @@ +from GithubObject import * + +from Authorization import Authorization +from UserKey import UserKey +from Event import Event + +AuthenticatedUser = GithubObject( + "AuthenticatedUser", + BaseUrl( lambda obj: "/user" ), + Identity( lambda obj: obj.login ), + InternalSimpleAttributes( + "login", "id", "avatar_url", "gravatar_id", "url", "name", "company", + "blog", "location", "email", "hireable", "bio", "public_repos", + "public_gists", "followers", "following", "html_url", "created_at", + "type", "total_private_repos", "owned_private_repos", "private_gists", + "disk_usage", "collaborators", "plan", + ), + Editable( [], [ "name", "email", "blog", "company", "location", "hireable", "bio" ] ), + ExternalListOfSimpleTypes( "emails", "email", "string", + ListGetable( [], [] ), + SeveralElementsAddable(), + SeveralElementsRemovable() + ), + ExternalListOfObjects( "authorizations", "authorization", Authorization, + ListGetable( [], [] ), + ElementGetable( [ "id" ], [] ), + ElementCreatable( [], [ "scopes", "note", "note_url" ] ), + url = "/authorizations", + ), + ExternalListOfObjects( "keys", "key", UserKey, + ListGetable( [], [] ), + ElementGetable( [ "id" ], [] ), + ElementCreatable( [ "title", "key" ], [] ), + ), + ExternalListOfObjects( "events", "event", Event, + ListGetable( [], [] ), + url = "/events" + ), +) diff --git a/github/Authorization.py b/github/Authorization.py new file mode 100644 index 00000000..7b83f334 --- /dev/null +++ b/github/Authorization.py @@ -0,0 +1,12 @@ +from GithubObject import * + +Authorization = GithubObject( + "Authorization", + BaseUrl( lambda obj: "/authorizations/" + str( obj.id ) ), + InternalSimpleAttributes( + "id", "url", "scopes", "token", "app", "note", "note_url", "updated_at", + "created_at", + ), + Editable( [], [ "scopes", "add_scopes", "remove_scopes", "note", "note_url" ] ), + Deletable(), +) diff --git a/github/GithubObjects.py b/github/GithubObjects.py index dca59b9d..8e40d10f 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -4,61 +4,9 @@ from GithubObject import * from Event import Event from Hook import Hook - -Authorization = GithubObject( - "Authorization", - BaseUrl( lambda obj: "/authorizations/" + str( obj.id ) ), - InternalSimpleAttributes( - "id", "url", "scopes", "token", "app", "note", "note_url", "updated_at", - "created_at", - ), - Editable( [], [ "scopes", "add_scopes", "remove_scopes", "note", "note_url" ] ), - Deletable(), -) - -UserKey = GithubObject( - "UserKey", - BaseUrl( lambda obj: "/user/keys/" + str( obj.id ) ), - InternalSimpleAttributes( - "url", "id", "title", "key", - ), - Editable( [], [ "title", "key" ] ), - Deletable(), -) - -AuthenticatedUser = GithubObject( - "AuthenticatedUser", - BaseUrl( lambda obj: "/user" ), - Identity( lambda obj: obj.login ), - InternalSimpleAttributes( - "login", "id", "avatar_url", "gravatar_id", "url", "name", "company", - "blog", "location", "email", "hireable", "bio", "public_repos", - "public_gists", "followers", "following", "html_url", "created_at", - "type", "total_private_repos", "owned_private_repos", "private_gists", - "disk_usage", "collaborators", "plan", - ), - Editable( [], [ "name", "email", "blog", "company", "location", "hireable", "bio" ] ), - ExternalListOfSimpleTypes( "emails", "email", "string", - ListGetable( [], [] ), - SeveralElementsAddable(), - SeveralElementsRemovable() - ), - ExternalListOfObjects( "authorizations", "authorization", Authorization, - ListGetable( [], [] ), - ElementGetable( [ "id" ], [] ), - ElementCreatable( [], [ "scopes", "note", "note_url" ] ), - url = "/authorizations", - ), - ExternalListOfObjects( "keys", "key", UserKey, - ListGetable( [], [] ), - ElementGetable( [ "id" ], [] ), - ElementCreatable( [ "title", "key" ], [] ), - ), - ExternalListOfObjects( "events", "event", Event, - ListGetable( [], [] ), - url = "/events" - ), -) +from Authorization import Authorization +from UserKey import UserKey +from AuthenticatedUser import AuthenticatedUser NamedUser = GithubObject( "NamedUser", diff --git a/github/UserKey.py b/github/UserKey.py new file mode 100644 index 00000000..6be23ea7 --- /dev/null +++ b/github/UserKey.py @@ -0,0 +1,11 @@ +from GithubObject import * + +UserKey = GithubObject( + "UserKey", + BaseUrl( lambda obj: "/user/keys/" + str( obj.id ) ), + InternalSimpleAttributes( + "url", "id", "title", "key", + ), + Editable( [], [ "title", "key" ] ), + Deletable(), +)