Skip to content

Commit 75758bf

Browse files
chore(objects): use self.encoded_id where applicable
Updated a few remaining usages of `self.id` to use `self.encoded_id` as for the most part we shouldn't be using `self.id` There are now only a few (4 lines of code) remaining uses of `self.id`, most of which seem that they should stay that way.
1 parent 34110dd commit 75758bf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gitlab/v4/objects/todos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def mark_as_done(self, **kwargs: Any) -> Dict[str, Any]:
2727
Returns:
2828
A dict with the result
2929
"""
30-
path = f"{self.manager.path}/{self.id}/mark_as_done"
30+
path = f"{self.manager.path}/{self.encoded_id}/mark_as_done"
3131
server_data = self.manager.gitlab.http_post(path, **kwargs)
3232
if TYPE_CHECKING:
3333
assert isinstance(server_data, dict)

gitlab/v4/objects/users.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def block(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
179179
Returns:
180180
Whether the user status has been changed
181181
"""
182-
path = f"/users/{self.id}/block"
182+
path = f"/users/{self.encoded_id}/block"
183183
server_data = self.manager.gitlab.http_post(path, **kwargs)
184184
if server_data is True:
185185
self._attrs["state"] = "blocked"
@@ -200,7 +200,7 @@ def follow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
200200
Returns:
201201
The new object data (*not* a RESTObject)
202202
"""
203-
path = f"/users/{self.id}/follow"
203+
path = f"/users/{self.encoded_id}/follow"
204204
return self.manager.gitlab.http_post(path, **kwargs)
205205

206206
@cli.register_custom_action("User")
@@ -218,7 +218,7 @@ def unfollow(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
218218
Returns:
219219
The new object data (*not* a RESTObject)
220220
"""
221-
path = f"/users/{self.id}/unfollow"
221+
path = f"/users/{self.encoded_id}/unfollow"
222222
return self.manager.gitlab.http_post(path, **kwargs)
223223

224224
@cli.register_custom_action("User")
@@ -236,7 +236,7 @@ def unblock(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
236236
Returns:
237237
Whether the user status has been changed
238238
"""
239-
path = f"/users/{self.id}/unblock"
239+
path = f"/users/{self.encoded_id}/unblock"
240240
server_data = self.manager.gitlab.http_post(path, **kwargs)
241241
if server_data is True:
242242
self._attrs["state"] = "active"
@@ -257,7 +257,7 @@ def deactivate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
257257
Returns:
258258
Whether the user status has been changed
259259
"""
260-
path = f"/users/{self.id}/deactivate"
260+
path = f"/users/{self.encoded_id}/deactivate"
261261
server_data = self.manager.gitlab.http_post(path, **kwargs)
262262
if server_data:
263263
self._attrs["state"] = "deactivated"
@@ -278,7 +278,7 @@ def activate(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
278278
Returns:
279279
Whether the user status has been changed
280280
"""
281-
path = f"/users/{self.id}/activate"
281+
path = f"/users/{self.encoded_id}/activate"
282282
server_data = self.manager.gitlab.http_post(path, **kwargs)
283283
if server_data:
284284
self._attrs["state"] = "active"

0 commit comments

Comments
 (0)