23
23
24
24
import nodestream_github .types as types
25
25
from nodestream_github .logging import get_plugin_logger
26
- from nodestream_github .types . enums import CollaboratorAffiliation
26
+ from nodestream_github .types import enums
27
27
28
28
DEFAULT_REQUEST_RATE_LIMIT_PER_MINUTE = int (13000 / 60 )
29
29
DEFAULT_MAX_RETRIES = 20
@@ -261,7 +261,10 @@ async def _get_item(
261
261
return {}
262
262
263
263
async def fetch_repos_for_org (
264
- self , org_login : str , repo_type : str | None = None
264
+ self ,
265
+ * ,
266
+ org_login : str ,
267
+ repo_type : enums .OrgRepoType | None = None ,
265
268
) -> AsyncGenerator [types .GithubRepo ]:
266
269
"""Fetches repositories for the specified organization.
267
270
@@ -287,7 +290,10 @@ async def fetch_repos_for_org(
287
290
_fetch_problem (f"repos for org { org_login } " , e )
288
291
289
292
async def fetch_members_for_org (
290
- self , org_login : str , role : str | None = None
293
+ self ,
294
+ * ,
295
+ org_login : str ,
296
+ role : enums .OrgMemberRole | None = None ,
291
297
) -> AsyncGenerator [types .GithubUser ]:
292
298
"""Fetch all users who are members of an organization.
293
299
@@ -339,8 +345,9 @@ async def fetch_full_org(self, org_login: str) -> types.GithubOrg | None:
339
345
340
346
async def fetch_repos_for_user (
341
347
self ,
348
+ * ,
342
349
user_login : str ,
343
- repo_type : str | None = None ,
350
+ repo_type : enums . UserRepoType | None = None ,
344
351
) -> AsyncGenerator [types .GithubRepo ]:
345
352
"""Fetches repositories for a user.
346
353
@@ -361,7 +368,10 @@ async def fetch_repos_for_user(
361
368
_fetch_problem (f"repos for user { user_login } " , e )
362
369
363
370
async def fetch_languages_for_repo (
364
- self , owner_login : str , repo_name : str
371
+ self ,
372
+ * ,
373
+ owner_login : str ,
374
+ repo_name : str ,
365
375
) -> AsyncGenerator [str ]:
366
376
"""Fetch languages for the specified repository.
367
377
@@ -380,7 +390,10 @@ async def fetch_languages_for_repo(
380
390
_fetch_problem (f"languages for repo { owner_login } /{ repo_name } " , e )
381
391
382
392
async def fetch_webhooks_for_repo (
383
- self , owner_login : str , repo_name : str
393
+ self ,
394
+ * ,
395
+ owner_login : str ,
396
+ repo_name : str ,
384
397
) -> AsyncGenerator [types .Webhook ]:
385
398
"""Try to get types.webhook data for this repo.
386
399
@@ -402,7 +415,7 @@ async def fetch_collaborators_for_repo(
402
415
* ,
403
416
owner_login : str ,
404
417
repo_name : str ,
405
- affiliation : CollaboratorAffiliation ,
418
+ affiliation : enums . CollaboratorAffiliation ,
406
419
) -> AsyncGenerator [types .GithubUser ]:
407
420
"""Try to get collaborator data for this repo.
408
421
@@ -469,7 +482,9 @@ async def fetch_all_users(self) -> AsyncGenerator[types.GithubUser]:
469
482
_fetch_problem ("all users" , e )
470
483
471
484
async def fetch_teams_for_org (
472
- self , org_login : str
485
+ self ,
486
+ * ,
487
+ org_login : str ,
473
488
) -> AsyncGenerator [types .GithubTeamSummary ]:
474
489
"""Fetch all teams in an organization visible to the authenticated user.
475
490
@@ -487,7 +502,7 @@ async def fetch_teams_for_org(
487
502
except httpx .HTTPError as e :
488
503
_fetch_problem (f"teams for org { org_login } " , e )
489
504
490
- async def fetch_team (self , org_login : str , slug : str ) -> types .GithubTeam | None :
505
+ async def fetch_team (self , * , org_login : str , slug : str ) -> types .GithubTeam | None :
491
506
"""Fetches a single team for an org by the team slug.
492
507
493
508
https://docs.github.com/en/[email protected] /rest/teams/teams?apiVersion=2022-11-28#get-a-team-by-name
@@ -498,7 +513,10 @@ async def fetch_team(self, org_login: str, slug: str) -> types.GithubTeam | None
498
513
_fetch_problem (f"full team info for { org_login } /{ slug } " , e )
499
514
500
515
async def fetch_members_for_team (
501
- self , team_id : int , role : str | None = None
516
+ self ,
517
+ * ,
518
+ team_id : int ,
519
+ role : enums .TeamMemberRole | None = None ,
502
520
) -> AsyncGenerator [types .GithubUser ]:
503
521
"""Fetch all users that have a given role for a specified team.
504
522
@@ -523,7 +541,10 @@ async def fetch_members_for_team(
523
541
_fetch_problem (f"members for team { team_id } " , e )
524
542
525
543
async def fetch_repos_for_team (
526
- self , org_login : str , slug : str
544
+ self ,
545
+ * ,
546
+ org_login : str ,
547
+ slug : str ,
527
548
) -> AsyncGenerator [types .GithubRepo ]:
528
549
"""Fetch all repos for a specified team visible to the authenticated user.
529
550
0 commit comments