Commit d563b454 authored by Jo Sama's avatar Jo Sama 😱
Browse files

Add method for listing permission groups

parent 7ad56e70
......@@ -5,8 +5,8 @@ import uuid
from typing import Optional, List, Iterator
from urllib.parse import urljoin, urlparse
from .models import (Branch, BranchReference, Operator, OperatorGroup, Person,
Department, DepartmentRef, BudgetHolder, BudgetHolderRef)
from .models import (Branch, BranchReference, Operator, OperatorGroup, PermissionGroup,
Person, Department, DepartmentRef, BudgetHolder, BudgetHolderRef)
logger = logging.getLogger(__name__)
......@@ -24,6 +24,9 @@ class Endpoints:
def list_operatorgroups(self):
return self._prepend_base_url('operatorgroups')
def list_permissiongroups(self):
return self._prepend_base_url('permissiongroups')
def get_branch(self, branch_id):
return urljoin(self._prepend_base_url('branches/id/'), branch_id)
......@@ -242,6 +245,11 @@ class TopDeskClient:
for x in self.depaginate(url):
yield OperatorGroup.from_dict(x)
def list_permissiongroups(self):
url = self.urls.list_permissiongroups()
for x in self.depaginate(url):
yield PermissionGroup.from_dict(x)
def get_person(self, identity):
if isinstance(identity, Person):
url = self.urls.get_person(identity.id)
......
......@@ -201,6 +201,11 @@ class OperatorGroup(BaseModel):
}
class PermissionGroup(BaseModel):
id: str
name: str
class ExternalLink(BaseModel):
id: str
type: str
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment