Skip to content

Commit ac9c5b8

Browse files
vaibhavatlanAryamanz29
authored andcommitted
Fixing the get_all() method of user and group
1 parent 14a3fbe commit ac9c5b8

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

pyatlan/client/group.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def get_all(
142142
offset: int = 0,
143143
sort: Optional[str] = "name",
144144
columns: Optional[List[str]] = None,
145-
) -> List[AtlanGroup]:
145+
) -> GroupResponse:
146146
"""
147147
Retrieve all groups defined in Atlan.
148148
@@ -152,9 +152,10 @@ def get_all(
152152
:param columns: provides columns projection support for groups endpoint
153153
:returns: a list of all the groups in Atlan
154154
"""
155-
if response := self.get(offset=offset, limit=limit, sort=sort, columns=columns):
156-
return response.records # type: ignore
157-
return None # type: ignore
155+
response: GroupResponse = self.get(
156+
offset=offset, limit=limit, sort=sort, columns=columns
157+
)
158+
return response # type: ignore
158159

159160
@validate_arguments
160161
def get_by_name(

pyatlan/client/user.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def get_all(
201201
limit: int = 20,
202202
offset: int = 0,
203203
sort: Optional[str] = "username",
204-
) -> List[AtlanUser]:
204+
) -> UserResponse:
205205
"""
206206
Retrieve all users defined in Atlan.
207207
@@ -210,9 +210,8 @@ def get_all(
210210
:param sort: property by which to sort the results, by default : `username`
211211
:returns: a list of all the users in Atlan
212212
"""
213-
if response := self.get(offset=offset, limit=limit, sort=sort):
214-
return response.records # type: ignore
215-
return None # type: ignore
213+
response: UserResponse = self.get(offset=offset, limit=limit, sort=sort)
214+
return response
216215

217216
@validate_arguments
218217
def get_by_email(

testing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pyatlan.client.atlan import AtlanClient
2+
3+
client = AtlanClient()
4+
users = client.group.get_all(limit=2)
5+
6+
for user in users:
7+
print(user)

0 commit comments

Comments
 (0)