@@ -99,8 +99,7 @@ def get(
9999 GitlabAuthenticationError: If authentication is not correct
100100 GitlabGetError: If the server cannot perform the request
101101 """
102- if not isinstance (id ,int ):
103- id = utils ._url_encode (id )
102+ id = utils ._url_encode (id )
104103path = f"{ self .path } /{ id } "
105104if TYPE_CHECKING :
106105assert self ._obj_cls is not None
@@ -173,7 +172,7 @@ def refresh(self, **kwargs: Any) -> None:
173172 GitlabGetError: If the server cannot perform the request
174173 """
175174if self ._id_attr :
176- path = f"{ self .manager .path } /{ self .id } "
175+ path = f"{ self .manager .path } /{ self .encoded_id } "
177176else :
178177if TYPE_CHECKING :
179178assert self .manager .path is not None
@@ -391,7 +390,7 @@ def update(
391390if id is None :
392391path = self .path
393392else :
394- path = f"{ self .path } /{ id } "
393+ path = f"{ self .path } /{ utils . _url_encode ( id ) } "
395394
396395self ._check_missing_update_attrs (new_data )
397396files = {}
@@ -477,9 +476,7 @@ def delete(self, id: Union[str, int], **kwargs: Any) -> None:
477476if id is None :
478477path = self .path
479478else :
480- if not isinstance (id ,int ):
481- id = utils ._url_encode (id )
482- path = f"{ self .path } /{ id } "
479+ path = f"{ self .path } /{ utils ._url_encode (id )} "
483480self .gitlab .http_delete (path ,** kwargs )
484481
485482
@@ -545,6 +542,7 @@ def save(self, **kwargs: Any) -> None:
545542return
546543
547544# call the manager
545+ # Don't use `self.encoded_id` here as `self.manager.update()` will encode it.
548546obj_id = self .get_id ()
549547if TYPE_CHECKING :
550548assert isinstance (self .manager ,UpdateMixin )
@@ -575,6 +573,7 @@ def delete(self, **kwargs: Any) -> None:
575573 """
576574if TYPE_CHECKING :
577575assert isinstance (self .manager ,DeleteMixin )
576+ # Don't use `self.encoded_id` here as `self.manager.delete()` will encode it.
578577self .manager .delete (self .get_id (),** kwargs )
579578
580579
@@ -598,7 +597,7 @@ def user_agent_detail(self, **kwargs: Any) -> Dict[str, Any]:
598597 GitlabAuthenticationError: If authentication is not correct
599598 GitlabGetError: If the server cannot perform the request
600599 """
601- path = f"{ self .manager .path } /{ self .get_id () } /user_agent_detail"
600+ path = f"{ self .manager .path } /{ self .encoded_id } /user_agent_detail"
602601result = self .manager .gitlab .http_get (path ,** kwargs )
603602if TYPE_CHECKING :
604603assert not isinstance (result ,requests .Response )
@@ -631,7 +630,7 @@ def approve(
631630 GitlabUpdateError: If the server fails to perform the request
632631 """
633632
634- path = f"{ self .manager .path } /{ self .id } /approve"
633+ path = f"{ self .manager .path } /{ self .encoded_id } /approve"
635634data = {"access_level" :access_level }
636635server_data = self .manager .gitlab .http_put (path ,post_data = data ,** kwargs )
637636if TYPE_CHECKING :
@@ -705,7 +704,7 @@ def subscribe(self, **kwargs: Any) -> None:
705704 GitlabAuthenticationError: If authentication is not correct
706705 GitlabSubscribeError: If the subscription cannot be done
707706 """
708- path = f"{ self .manager .path } /{ self .get_id () } /subscribe"
707+ path = f"{ self .manager .path } /{ self .encoded_id } /subscribe"
709708server_data = self .manager .gitlab .http_post (path ,** kwargs )
710709if TYPE_CHECKING :
711710assert not isinstance (server_data ,requests .Response )
@@ -725,7 +724,7 @@ def unsubscribe(self, **kwargs: Any) -> None:
725724 GitlabAuthenticationError: If authentication is not correct
726725 GitlabUnsubscribeError: If the unsubscription cannot be done
727726 """
728- path = f"{ self .manager .path } /{ self .get_id () } /unsubscribe"
727+ path = f"{ self .manager .path } /{ self .encoded_id } /unsubscribe"
729728server_data = self .manager .gitlab .http_post (path ,** kwargs )
730729if TYPE_CHECKING :
731730assert not isinstance (server_data ,requests .Response )
@@ -752,7 +751,7 @@ def todo(self, **kwargs: Any) -> None:
752751 GitlabAuthenticationError: If authentication is not correct
753752 GitlabTodoError: If the todo cannot be set
754753 """
755- path = f"{ self .manager .path } /{ self .get_id () } /todo"
754+ path = f"{ self .manager .path } /{ self .encoded_id } /todo"
756755self .manager .gitlab .http_post (path ,** kwargs )
757756
758757
@@ -781,7 +780,7 @@ def time_stats(self, **kwargs: Any) -> Dict[str, Any]:
781780if "time_stats" in self .attributes :
782781return self .attributes ["time_stats" ]
783782
784- path = f"{ self .manager .path } /{ self .get_id () } /time_stats"
783+ path = f"{ self .manager .path } /{ self .encoded_id } /time_stats"
785784result = self .manager .gitlab .http_get (path ,** kwargs )
786785if TYPE_CHECKING :
787786assert not isinstance (result ,requests .Response )
@@ -800,7 +799,7 @@ def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
800799 GitlabAuthenticationError: If authentication is not correct
801800 GitlabTimeTrackingError: If the time tracking update cannot be done
802801 """
803- path = f"{ self .manager .path } /{ self .get_id () } /time_estimate"
802+ path = f"{ self .manager .path } /{ self .encoded_id } /time_estimate"
804803data = {"duration" :duration }
805804result = self .manager .gitlab .http_post (path ,post_data = data ,** kwargs )
806805if TYPE_CHECKING :
@@ -819,7 +818,7 @@ def reset_time_estimate(self, **kwargs: Any) -> Dict[str, Any]:
819818 GitlabAuthenticationError: If authentication is not correct
820819 GitlabTimeTrackingError: If the time tracking update cannot be done
821820 """
822- path = f"{ self .manager .path } /{ self .get_id () } /reset_time_estimate"
821+ path = f"{ self .manager .path } /{ self .encoded_id } /reset_time_estimate"
823822result = self .manager .gitlab .http_post (path ,** kwargs )
824823if TYPE_CHECKING :
825824assert not isinstance (result ,requests .Response )
@@ -838,7 +837,7 @@ def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
838837 GitlabAuthenticationError: If authentication is not correct
839838 GitlabTimeTrackingError: If the time tracking update cannot be done
840839 """
841- path = f"{ self .manager .path } /{ self .get_id () } /add_spent_time"
840+ path = f"{ self .manager .path } /{ self .encoded_id } /add_spent_time"
842841data = {"duration" :duration }
843842result = self .manager .gitlab .http_post (path ,post_data = data ,** kwargs )
844843if TYPE_CHECKING :
@@ -857,7 +856,7 @@ def reset_spent_time(self, **kwargs: Any) -> Dict[str, Any]:
857856 GitlabAuthenticationError: If authentication is not correct
858857 GitlabTimeTrackingError: If the time tracking update cannot be done
859858 """
860- path = f"{ self .manager .path } /{ self .get_id () } /reset_spent_time"
859+ path = f"{ self .manager .path } /{ self .encoded_id } /reset_spent_time"
861860result = self .manager .gitlab .http_post (path ,** kwargs )
862861if TYPE_CHECKING :
863862assert not isinstance (result ,requests .Response )
@@ -893,7 +892,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
893892 The list of participants
894893 """
895894
896- path = f"{ self .manager .path } /{ self .get_id () } /participants"
895+ path = f"{ self .manager .path } /{ self .encoded_id } /participants"
897896result = self .manager .gitlab .http_get (path ,** kwargs )
898897if TYPE_CHECKING :
899898assert not isinstance (result ,requests .Response )
@@ -967,7 +966,7 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
967966 The updated object data (*not* a RESTObject)
968967 """
969968
970- path = f"{ self .manager .path } /{ self .id } /promote"
969+ path = f"{ self .manager .path } /{ self .encoded_id } /promote"
971970http_method = self ._get_update_method ()
972971result = http_method (path ,** kwargs )
973972if TYPE_CHECKING :