@@ -99,8 +99,8 @@ 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+ if isinstance (id , str ):
103+ id = utils .EncodedId (id )
104104 path = f"{ self .path } /{ id } "
105105 if TYPE_CHECKING :
106106 assert self ._obj_cls is not None
@@ -173,7 +173,7 @@ def refresh(self, **kwargs: Any) -> None:
173173 GitlabGetError: If the server cannot perform the request
174174 """
175175 if self ._id_attr :
176- path = f"{ self .manager .path } /{ self .id } "
176+ path = f"{ self .manager .path } /{ self .encoded_id } "
177177 else :
178178 if TYPE_CHECKING :
179179 assert self .manager .path is not None
@@ -391,7 +391,7 @@ def update(
391391 if id is None :
392392 path = self .path
393393 else :
394- path = f"{ self .path } /{ id } "
394+ path = f"{ self .path } /{ utils . EncodedId ( id ) } "
395395
396396 self ._check_missing_update_attrs (new_data )
397397 files = {}
@@ -444,7 +444,7 @@ def set(self, key: str, value: str, **kwargs: Any) -> base.RESTObject:
444444 Returns:
445445 The created/updated attribute
446446 """
447- path = f"{ self .path } /{ utils ._url_encode (key )} "
447+ path = f"{ self .path } /{ utils .EncodedId (key )} "
448448 data = {"value" : value }
449449 server_data = self .gitlab .http_put (path , post_data = data , ** kwargs )
450450 if TYPE_CHECKING :
@@ -477,9 +477,7 @@ def delete(self, id: Union[str, int], **kwargs: Any) -> None:
477477 if id is None :
478478 path = self .path
479479 else :
480- if not isinstance (id , int ):
481- id = utils ._url_encode (id )
482- path = f"{ self .path } /{ id } "
480+ path = f"{ self .path } /{ utils .EncodedId (id )} "
483481 self .gitlab .http_delete (path , ** kwargs )
484482
485483
@@ -545,7 +543,7 @@ def save(self, **kwargs: Any) -> None:
545543 return
546544
547545 # call the manager
548- obj_id = self .get_id ()
546+ obj_id = self .encoded_id
549547 if TYPE_CHECKING :
550548 assert isinstance (self .manager , UpdateMixin )
551549 server_data = self .manager .update (obj_id , updated_data , ** kwargs )
@@ -575,7 +573,7 @@ def delete(self, **kwargs: Any) -> None:
575573 """
576574 if TYPE_CHECKING :
577575 assert isinstance (self .manager , DeleteMixin )
578- self .manager .delete (self .get_id () , ** kwargs )
576+ self .manager .delete (self .encoded_id , ** kwargs )
579577
580578
581579class UserAgentDetailMixin (_RestObjectBase ):
@@ -598,7 +596,7 @@ def user_agent_detail(self, **kwargs: Any) -> Dict[str, Any]:
598596 GitlabAuthenticationError: If authentication is not correct
599597 GitlabGetError: If the server cannot perform the request
600598 """
601- path = f"{ self .manager .path } /{ self .get_id () } /user_agent_detail"
599+ path = f"{ self .manager .path } /{ self .encoded_id } /user_agent_detail"
602600 result = self .manager .gitlab .http_get (path , ** kwargs )
603601 if TYPE_CHECKING :
604602 assert not isinstance (result , requests .Response )
@@ -631,7 +629,7 @@ def approve(
631629 GitlabUpdateError: If the server fails to perform the request
632630 """
633631
634- path = f"{ self .manager .path } /{ self .id } /approve"
632+ path = f"{ self .manager .path } /{ self .encoded_id } /approve"
635633 data = {"access_level" : access_level }
636634 server_data = self .manager .gitlab .http_put (path , post_data = data , ** kwargs )
637635 if TYPE_CHECKING :
@@ -705,7 +703,7 @@ def subscribe(self, **kwargs: Any) -> None:
705703 GitlabAuthenticationError: If authentication is not correct
706704 GitlabSubscribeError: If the subscription cannot be done
707705 """
708- path = f"{ self .manager .path } /{ self .get_id () } /subscribe"
706+ path = f"{ self .manager .path } /{ self .encoded_id } /subscribe"
709707 server_data = self .manager .gitlab .http_post (path , ** kwargs )
710708 if TYPE_CHECKING :
711709 assert not isinstance (server_data , requests .Response )
@@ -725,7 +723,7 @@ def unsubscribe(self, **kwargs: Any) -> None:
725723 GitlabAuthenticationError: If authentication is not correct
726724 GitlabUnsubscribeError: If the unsubscription cannot be done
727725 """
728- path = f"{ self .manager .path } /{ self .get_id () } /unsubscribe"
726+ path = f"{ self .manager .path } /{ self .encoded_id } /unsubscribe"
729727 server_data = self .manager .gitlab .http_post (path , ** kwargs )
730728 if TYPE_CHECKING :
731729 assert not isinstance (server_data , requests .Response )
@@ -752,7 +750,7 @@ def todo(self, **kwargs: Any) -> None:
752750 GitlabAuthenticationError: If authentication is not correct
753751 GitlabTodoError: If the todo cannot be set
754752 """
755- path = f"{ self .manager .path } /{ self .get_id () } /todo"
753+ path = f"{ self .manager .path } /{ self .encoded_id } /todo"
756754 self .manager .gitlab .http_post (path , ** kwargs )
757755
758756
@@ -781,7 +779,7 @@ def time_stats(self, **kwargs: Any) -> Dict[str, Any]:
781779 if "time_stats" in self .attributes :
782780 return self .attributes ["time_stats" ]
783781
784- path = f"{ self .manager .path } /{ self .get_id () } /time_stats"
782+ path = f"{ self .manager .path } /{ self .encoded_id } /time_stats"
785783 result = self .manager .gitlab .http_get (path , ** kwargs )
786784 if TYPE_CHECKING :
787785 assert not isinstance (result , requests .Response )
@@ -800,7 +798,7 @@ def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
800798 GitlabAuthenticationError: If authentication is not correct
801799 GitlabTimeTrackingError: If the time tracking update cannot be done
802800 """
803- path = f"{ self .manager .path } /{ self .get_id () } /time_estimate"
801+ path = f"{ self .manager .path } /{ self .encoded_id } /time_estimate"
804802 data = {"duration" : duration }
805803 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
806804 if TYPE_CHECKING :
@@ -819,7 +817,7 @@ def reset_time_estimate(self, **kwargs: Any) -> Dict[str, Any]:
819817 GitlabAuthenticationError: If authentication is not correct
820818 GitlabTimeTrackingError: If the time tracking update cannot be done
821819 """
822- path = f"{ self .manager .path } /{ self .get_id () } /reset_time_estimate"
820+ path = f"{ self .manager .path } /{ self .encoded_id } /reset_time_estimate"
823821 result = self .manager .gitlab .http_post (path , ** kwargs )
824822 if TYPE_CHECKING :
825823 assert not isinstance (result , requests .Response )
@@ -838,7 +836,7 @@ def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]:
838836 GitlabAuthenticationError: If authentication is not correct
839837 GitlabTimeTrackingError: If the time tracking update cannot be done
840838 """
841- path = f"{ self .manager .path } /{ self .get_id () } /add_spent_time"
839+ path = f"{ self .manager .path } /{ self .encoded_id } /add_spent_time"
842840 data = {"duration" : duration }
843841 result = self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
844842 if TYPE_CHECKING :
@@ -857,7 +855,7 @@ def reset_spent_time(self, **kwargs: Any) -> Dict[str, Any]:
857855 GitlabAuthenticationError: If authentication is not correct
858856 GitlabTimeTrackingError: If the time tracking update cannot be done
859857 """
860- path = f"{ self .manager .path } /{ self .get_id () } /reset_spent_time"
858+ path = f"{ self .manager .path } /{ self .encoded_id } /reset_spent_time"
861859 result = self .manager .gitlab .http_post (path , ** kwargs )
862860 if TYPE_CHECKING :
863861 assert not isinstance (result , requests .Response )
@@ -893,7 +891,7 @@ def participants(self, **kwargs: Any) -> Dict[str, Any]:
893891 The list of participants
894892 """
895893
896- path = f"{ self .manager .path } /{ self .get_id () } /participants"
894+ path = f"{ self .manager .path } /{ self .encoded_id } /participants"
897895 result = self .manager .gitlab .http_get (path , ** kwargs )
898896 if TYPE_CHECKING :
899897 assert not isinstance (result , requests .Response )
@@ -967,7 +965,7 @@ def promote(self, **kwargs: Any) -> Dict[str, Any]:
967965 The updated object data (*not* a RESTObject)
968966 """
969967
970- path = f"{ self .manager .path } /{ self .id } /promote"
968+ path = f"{ self .manager .path } /{ self .encoded_id } /promote"
971969 http_method = self ._get_update_method ()
972970 result = http_method (path , ** kwargs )
973971 if TYPE_CHECKING :
0 commit comments