Movatterモバイル変換


[0]ホーム

URL:


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

Commit7ed34ed

Browse files
author
Gauvain Pocentek
committed
Implement archive/unarchive for a projet
The methods are called archive_ and unarchive_ to workaround a conflictwith the deprecated archive method. Method will be renamed when thearchive method is removed.
1 parent565c35e commit7ed34ed

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

‎gitlab/objects.py

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,34 +1886,66 @@ def delete_fork_relation(self):
18861886
r=self.gitlab._raw_delete(url)
18871887
raise_error_from_response(r,GitlabDeleteError)
18881888

1889-
defstar(self):
1889+
defstar(self,**kwargs):
18901890
"""Star a project.
18911891
18921892
Returns:
18931893
Project: the updated Project
18941894
18951895
Raises:
1896+
GitlabCreateError: If the action cannot be done
18961897
GitlabConnectionError: If the server cannot be reached.
18971898
"""
18981899
url="/projects/%s/star"%self.id
1899-
r=self.gitlab._raw_post(url)
1900-
raise_error_from_response(r,GitlabGetError, [201,304])
1900+
r=self.gitlab._raw_post(url,**kwargs)
1901+
raise_error_from_response(r,GitlabCreateError, [201,304])
19011902
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
19021903

1903-
defunstar(self):
1904+
defunstar(self,**kwargs):
19041905
"""Unstar a project.
19051906
19061907
Returns:
19071908
Project: the updated Project
19081909
19091910
Raises:
1911+
GitlabDeleteError: If the action cannot be done
19101912
GitlabConnectionError: If the server cannot be reached.
19111913
"""
19121914
url="/projects/%s/star"%self.id
1913-
r=self.gitlab._raw_delete(url)
1915+
r=self.gitlab._raw_delete(url,**kwargs)
19141916
raise_error_from_response(r,GitlabDeleteError, [200,304])
19151917
returnProject(self.gitlab,r.json())ifr.status_code==200elseself
19161918

1919+
defarchive_(self,**kwargs):
1920+
"""Archive a project.
1921+
1922+
Returns:
1923+
Project: the updated Project
1924+
1925+
Raises:
1926+
GitlabCreateError: If the action cannot be done
1927+
GitlabConnectionError: If the server cannot be reached.
1928+
"""
1929+
url="/projects/%s/archive"%self.id
1930+
r=self.gitlab._raw_post(url,**kwargs)
1931+
raise_error_from_response(r,GitlabCreateError,201)
1932+
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
1933+
1934+
defunarchive_(self,**kwargs):
1935+
"""Unarchive a project.
1936+
1937+
Returns:
1938+
Project: the updated Project
1939+
1940+
Raises:
1941+
GitlabDeleteError: If the action cannot be done
1942+
GitlabConnectionError: If the server cannot be reached.
1943+
"""
1944+
url="/projects/%s/unarchive"%self.id
1945+
r=self.gitlab._raw_delete(url,**kwargs)
1946+
raise_error_from_response(r,GitlabCreateError,201)
1947+
returnProject(self.gitlab,r.json())ifr.status_code==201elseself
1948+
19171949

19181950
classTeamMember(GitlabObject):
19191951
_url='/user_teams/%(team_id)s/members'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp