@@ -121,6 +121,11 @@ class OrganizationSecret(_Secret):
121121 .. attribute:: updated_at
122122
123123 The timestamp of when the secret was last updated
124+
125+ .. attribute:: visibility
126+
127+ Specifies which type of organization repositories have access to
128+ the secret. Can be one of all, private, selected.
124129 """
125130
126131 class_name = "OrganizationSecret"
@@ -129,7 +134,9 @@ def _update_attributes(self, secret):
129134 super ()._update_attributes (secret )
130135 self .visibility = secret ["visibility" ]
131136 if self .visibility == "selected" :
132- self ._selected_repos_url = secret ["selected_repositories_url" ]
137+ self .selected_repositories_url = secret [
138+ "selected_repositories_url"
139+ ]
133140
134141 def selected_repositories (self , number = - 1 , etag = "" ):
135142 """Iterates over all repositories this secret is visible to.
@@ -152,13 +159,13 @@ def selected_repositories(self, number=-1, etag=""):
152159
153160 return self ._iter (
154161 int (number ),
155- self ._selected_repos_url ,
162+ self .selected_repositories_url ,
156163 repos .ShortRepository ,
157164 etag = etag ,
158165 list_key = "repositories" ,
159166 )
160167
161- def set_selected_repositories (self , repository_ids : typing .List [int ]):
168+ def set_selected_repositories (self , repository_ids : typing .Sequence [int ]):
162169 """Sets the selected repositories this secret is visible to.
163170
164171 :param list[int] repository_ids:
@@ -177,7 +184,7 @@ def set_selected_repositories(self, repository_ids: typing.List[int]):
177184 data = {"selected_repository_ids" : repository_ids }
178185
179186 return self ._boolean (
180- self ._put (self ._selected_repos_url , json = data ), 204 , 404
187+ self ._put (self .selected_repositories_url , json = data ), 204 , 404
181188 )
182189
183190 def add_selected_repository (self , repository_id : int ):
@@ -199,10 +206,10 @@ def add_selected_repository(self, repository_id: int):
199206 "cannot add a repository when visibility is not 'selected'"
200207 )
201208
202- url = "/" .join ([self ._selected_repos_url , str (repository_id )])
209+ url = "/" .join ([self .selected_repositories_url , str (repository_id )])
203210 return self ._boolean (self ._put (url ), 204 , 409 )
204211
205- def delete_selected_repository (self , repository_id : int ):
212+ def remove_selected_repository (self , repository_id : int ):
206213 """Deletes a repository from the list of repositories this secret is
207214 visible to.
208215
@@ -222,5 +229,5 @@ def delete_selected_repository(self, repository_id: int):
222229 "cannot delete a repository when visibility is not 'selected'"
223230 )
224231
225- url = "/" .join ([self ._selected_repos_url , str (repository_id )])
232+ url = "/" .join ([self .selected_repositories_url , str (repository_id )])
226233 return self ._boolean (self ._delete (url ), 204 , 409 )
0 commit comments