@@ -121,6 +121,11 @@ class OrganizationSecret(_Secret):
121
121
.. attribute:: updated_at
122
122
123
123
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.
124
129
"""
125
130
126
131
class_name = "OrganizationSecret"
@@ -129,7 +134,9 @@ def _update_attributes(self, secret):
129
134
super ()._update_attributes (secret )
130
135
self .visibility = secret ["visibility" ]
131
136
if self .visibility == "selected" :
132
- self ._selected_repos_url = secret ["selected_repositories_url" ]
137
+ self .selected_repositories_url = secret [
138
+ "selected_repositories_url"
139
+ ]
133
140
134
141
def selected_repositories (self , number = - 1 , etag = "" ):
135
142
"""Iterates over all repositories this secret is visible to.
@@ -152,13 +159,13 @@ def selected_repositories(self, number=-1, etag=""):
152
159
153
160
return self ._iter (
154
161
int (number ),
155
- self ._selected_repos_url ,
162
+ self .selected_repositories_url ,
156
163
repos .ShortRepository ,
157
164
etag = etag ,
158
165
list_key = "repositories" ,
159
166
)
160
167
161
- def set_selected_repositories (self , repository_ids : typing .List [int ]):
168
+ def set_selected_repositories (self , repository_ids : typing .Sequence [int ]):
162
169
"""Sets the selected repositories this secret is visible to.
163
170
164
171
:param list[int] repository_ids:
@@ -177,7 +184,7 @@ def set_selected_repositories(self, repository_ids: typing.List[int]):
177
184
data = {"selected_repository_ids" : repository_ids }
178
185
179
186
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
181
188
)
182
189
183
190
def add_selected_repository (self , repository_id : int ):
@@ -199,10 +206,10 @@ def add_selected_repository(self, repository_id: int):
199
206
"cannot add a repository when visibility is not 'selected'"
200
207
)
201
208
202
- url = "/" .join ([self ._selected_repos_url , str (repository_id )])
209
+ url = "/" .join ([self .selected_repositories_url , str (repository_id )])
203
210
return self ._boolean (self ._put (url ), 204 , 409 )
204
211
205
- def delete_selected_repository (self , repository_id : int ):
212
+ def remove_selected_repository (self , repository_id : int ):
206
213
"""Deletes a repository from the list of repositories this secret is
207
214
visible to.
208
215
@@ -222,5 +229,5 @@ def delete_selected_repository(self, repository_id: int):
222
229
"cannot delete a repository when visibility is not 'selected'"
223
230
)
224
231
225
- url = "/" .join ([self ._selected_repos_url , str (repository_id )])
232
+ url = "/" .join ([self .selected_repositories_url , str (repository_id )])
226
233
return self ._boolean (self ._delete (url ), 204 , 409 )
0 commit comments