-
Notifications
You must be signed in to change notification settings - Fork 93
Merge pull request #1 from TestUpCommunity/integration_1 #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
namelaowang
wants to merge
11
commits into
TestUpCommunity:integration_1
from
namelaowang:feature_namelaowang
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
264e66f
Merge pull request #1 from TestUpCommunity/integration_1
namelaowang 6c8b8ae
完成gists 13个需求,comment 3个需求
namelaowang c0891e8
orgs的所有接口封装
namelaowang 1bf3f78
增加get_on_organization
namelaowang 4b00d88
完成create_org_and_repo、完成list_orgs
namelaowang 4bee10e
未完成需求
namelaowang 24b0954
delete_repo_from_user_by_name
namelaowang 3df8929
删除createte_orgs关键字
namelaowang e5a3561
5月14日
namelaowang 2586e96
未完成create_repo_and_branch_with_helloword
namelaowang c2b07a7
修改了文件repos
namelaowang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from core.rest_client import RestClient | ||
|
||
|
||
class Comment(RestClient): | ||
|
||
def list_comments_on_a_gist(self, gist_id ,**kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/comments#list-comments-on-a-gist #631 | ||
""" | ||
return self.get('/gists/{}/comments'.format(gist_id), **kwargs) | ||
|
||
def get_a_single_comment(self, gist_id,comment_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/comments#get-a-single-comment #632 | ||
""" | ||
return self.get('/gists/{}/comments/{}'.format(gist_id, comment_id), **kwargs) | ||
|
||
def create_a_comment(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/comments#create-a-comment #633 | ||
""" | ||
return self.post('/gists/{}/comments'.format(gist_id), **kwargs) | ||
|
||
def edit_a_comment(self ,gist_id, comment_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/comments/#edit-a-comment | ||
""" | ||
return self.patch('/gists/{}/comments/{}'.format(gist_id, comment_id), **kwargs) | ||
|
||
def delete_a_comment(self ,gist_id, comment_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/comments/#delete-a-comment | ||
""" | ||
return self.delete('/gists/{}/comments/{}'.format(gist_id, comment_id), **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from core.rest_client import RestClient | ||
from api.gists.comment import Comment | ||
|
||
|
||
class Gists(RestClient): | ||
|
||
def __init__(self, api_root_url, **kwargs): | ||
super(Gists, self).__init__(api_root_url, **kwargs) | ||
self.comment = Comment(self.api_root_url, **kwargs) | ||
|
||
def list_gists_for_a_user(self, username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists/#list-a-users-gists #616 | ||
""" | ||
return self.get('/users/{}/gists'.format(username),**kwargs) | ||
|
||
def list_all_public_gists(self, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#list-all-public-gists #617 | ||
""" | ||
return self.get('/gists/public', **kwargs) | ||
|
||
def list_starred_gists(self, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#list-starred-gists #618 | ||
""" | ||
return self.get('/gists/starred', **kwargs) | ||
|
||
def get_a_single_gist(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#get-a-single-gist #619 | ||
""" | ||
return self.get('/gists/{}'.format(gist_id), **kwargs) | ||
|
||
def get_a_specific_revision_of_a_gist(self,gist_id, sha, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#get-a-specific-revision-of-a-gist #620 | ||
""" | ||
return self.get('/gists/{}/{}'.format(gist_id, sha), **kwargs) | ||
|
||
def create_a_gist(self, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#create-a-gist #621 | ||
""" | ||
return self.post('/gists', **kwargs) | ||
|
||
def list_gist_commits(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#list-gist-commits #623 | ||
""" | ||
return self.get('/gists/{}/commits'.format(gist_id), **kwargs) | ||
|
||
def star_a_gist(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#star-a-gist #624 | ||
""" | ||
return self.put('/gists/{}/star'.format(gist_id), **kwargs) | ||
|
||
def unstar_a_gist(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#unstar-a-gist #625 | ||
""" | ||
return self.delete('/gists/{}/star'.format(gist_id), **kwargs) | ||
|
||
def check_if_a_gist_is_starred(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#check-if-a-gist-is-starred #626 | ||
""" | ||
return self.get('/gists/{}/star'.format(gist_id), **kwargs) | ||
|
||
def fork_a_gist(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#fork-a-gist #627 | ||
""" | ||
return self.post('/gists/{}/forks'.format(gist_id), **kwargs) | ||
|
||
def list_gist_forks(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#list-gist-forks #628 | ||
""" | ||
return self.get('/gists/{}/forks'.format(gist_id), **kwargs) | ||
|
||
def delete_a_gist(self, gist_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/gists#delete-a-gist #629 | ||
""" | ||
return self.delete('/gists/{}'.format(gist_id), **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from core.rest_client import RestClient | ||
|
||
|
||
class Blocking(RestClient): | ||
|
||
def check_whether_a_user_is_blocked_from_an_organization(self, org, username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/blocking/#check-whether-a-user-is-blocked-from-an-organization | ||
""" | ||
return self.get('/orgs/{}/blocks/{}'.format(org, username), **kwargs) | ||
|
||
def block_a_user(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/blocking/#block-a-user | ||
""" | ||
return self.put('/orgs/{}/blocks/{}'.format(org,username), **kwargs) | ||
|
||
def unblock_a_user(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/blocking/#unblock-a-user | ||
""" | ||
return self.delete('/orgs/{}/blocks/{}'.format(org,username), **kwargs) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from core.rest_client import RestClient | ||
|
||
|
||
class Hooks(RestClient): | ||
|
||
def ping_a_hook(self,org,hook_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks#ping-a-hook | ||
""" | ||
return self.post('/orgs/{}/hooks/{}/pings'.format(org, hook_id), **kwargs) | ||
|
||
def delete_a_hook(self,org,hook_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks/#delete-a-hook | ||
""" | ||
return self.delete('/orgs/{}/hooks/{}'.format(org,hook_id), **kwargs) | ||
|
||
def list_hooks(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks/#list-hooks | ||
""" | ||
return self.get('/orgs/{}/hooks'.format(org), **kwargs) | ||
|
||
def edit_a_hook(self,org,hook_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks/#edit-a-hook | ||
""" | ||
return self.patch('/orgs/{}/hooks/{}'.format(org,hook_id),**kwargs) | ||
|
||
def create_a_hook(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks/#create-a-hook | ||
""" | ||
return self.post('/orgs/{}/hooks'.format(org), **kwargs) | ||
|
||
def get_single_hook(self,org,hook_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/hooks/#get-single-hook | ||
""" | ||
return self.get('/orgs/{}/hooks/{}'.format(org,hook_id), **kwargs) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
from core.rest_client import RestClient | ||
|
||
|
||
class Members(RestClient): | ||
|
||
def check_public_membership(self,org, username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#check-public-membership | ||
""" | ||
return self.get('orgs/{}/public_members/{}'.format(org, username) ,**kwargs) | ||
|
||
def members_list(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#members-list | ||
""" | ||
return self.get('/orgs/{}/members'.format(org),**kwargs) | ||
|
||
def check_membership(self,org, members, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#check-membership | ||
""" | ||
return self.get('/orgs/{}/members/{}'.format(org, members) ,**kwargs) | ||
|
||
def remove_a_member(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members#remove-a-member | ||
""" | ||
return self.delete('/orgs/{}/members/{}'.format(org,username), **kwargs) | ||
|
||
def public_members_list(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#public-members-list | ||
""" | ||
return self.get('/orgs/{}/public_members'.format(org), **kwargs) | ||
|
||
def edit_your_organization_membership(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#edit-your-organization-membership | ||
""" | ||
return self.patch('/user/memberships/orgs/{}'.format(org), **kwargs) | ||
|
||
def list_your_organization_memberships(self, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#list-your-organization-memberships | ||
""" | ||
return self.get('/user/memberships/orgs', **kwargs) | ||
|
||
def get_your_organization_membership(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#get-your-organization-membership | ||
""" | ||
return self.get('/user/memberships/orgs/{}'.format(org),**kwargs) | ||
|
||
def list_organization_invitation_teams(self,org,invitation_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#list-organization-invitation-teams | ||
""" | ||
return self.get('/orgs/{}/invitations/{}/teams'.format(org,invitation_id), **kwargs) | ||
|
||
def create_organization_invitation(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#create-organization-invitation | ||
""" | ||
return self.post('/orgs/{}/invitations'.format(org), **kwargs) | ||
|
||
def list_pending_organization_invitations(self,org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations | ||
""" | ||
return self.get('/orgs/{}/invitations'.format(org), **kwargs) | ||
|
||
def add_or_update_organization_membership(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership | ||
""" | ||
return self.put('/orgs/{}/memberships/{}'.format(org,username), **kwargs) | ||
|
||
def remove_organization_membership(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#remove-organization-membership | ||
""" | ||
return self.delete('/orgs/{}/memberships/{}'.format(org,username), **kwargs) | ||
|
||
def get_organization_membership(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#get-organization-membership | ||
""" | ||
return self.delete('/orgs/{}/memberships/{}'.format(org,username), **kwargs) | ||
|
||
def conceal_a_users_membership(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#conceal-a-users-membership | ||
""" | ||
return self.delete('/orgs/{}/public_members/{}'.format(org,username), **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from core.rest_client import RestClient | ||
from api.orgs.blocking import Blocking | ||
from api.orgs.hooks import Hooks | ||
from api.orgs.members import Members | ||
from api.orgs.outside_collaborators import Outside_Collaborators | ||
|
||
class Orgs(RestClient): | ||
|
||
def __init__(self, api_root_url, **kwargs): | ||
super(Orgs, self).__init__(api_root_url, **kwargs) | ||
self.blocking = Blocking(self.api_root_url, **kwargs) | ||
self.hooks = Hooks(self.api_root_url, **kwargs) | ||
self.member = Members(self.api_root_url, **kwargs) | ||
self.outside_collaborators = Outside_Collaborators(self.api_root_url, **kwargs) | ||
|
||
|
||
def remove_a_credential_authorization_for_an_organization(self,org,credential_id, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/#remove-a-credential-authorization-for-an-organization | ||
""" | ||
return self.delete('/orgs/{}/credential-authorizations/{}'.format(org,credential_id),**kwargs) | ||
|
||
def get_an_organization(self, org, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/#get-an-organization | ||
""" | ||
return self.get('/orgs/{}'.format(org), **kwargs) | ||
|
||
def list_your_organizations(self, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/#list-your-organizations | ||
""" | ||
return self.get('/user/orgs' ,**kwargs) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from core.rest_client import RestClient | ||
|
||
|
||
class Outside_Collaborators(RestClient): | ||
|
||
def convert_member_to_outside_collaborator(self, org, username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/outside_collaborators/#convert-member-to-outside-collaborator | ||
""" | ||
return self.put('/orgs/{}/outside_collaborators/{}'.format(org, username), **kwargs) | ||
|
||
def publicize_a_users_membership(self,org,username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/members/#publicize-a-users-membership | ||
""" | ||
return self.put('/orgs/{}/public_members/{}'.format(org,username), **kwargs) | ||
|
||
def remove_outside_collaborator(self,org, username, **kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/outside_collaborators/#remove-outside-collaborator | ||
""" | ||
return self.delete('/orgs/{}/outside_collaborators/{}'.format(org,username), **kwargs) | ||
|
||
def list_outside_collaborators(self ,org,**kwargs): | ||
""" | ||
https://developer.github.com/v3/orgs/outside_collaborators/#list-outside-collaborators | ||
""" | ||
return self.get('/orgs/{}/outside_collaborators'.format(org), **kwargs) | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把这个注释掉干嘛?