-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathintegration.py
More file actions
29 lines (22 loc) · 899 Bytes
/
integration.py
File metadata and controls
29 lines (22 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from typing import List
from mhq.store.models import UserIdentityProvider, Integration
from mhq.store.repos.core import CoreRepoService
CODE_INTEGRATION_BUCKET = [
UserIdentityProvider.GITHUB.value,
UserIdentityProvider.GITLAB.value,
UserIdentityProvider.BITBUCKET.value
]
class CodeIntegrationService:
def __init__(self, core_repo_service: CoreRepoService):
self.core_repo_service = core_repo_service
def get_org_providers(self, org_id: str) -> List[str]:
integrations: List[Integration] = (
self.core_repo_service.get_org_integrations_for_names(
org_id, CODE_INTEGRATION_BUCKET
)
)
if not integrations:
return []
return [integration.name for integration in integrations]
def get_code_integration_service():
return CodeIntegrationService(core_repo_service=CoreRepoService())