@@ -16,9 +16,94 @@ def __init__(self, admin_api_key, *args, **kwargs):
16
16
super (CloudAdminOrgs , self ).__init__ (url = ADMIN_URL , * args , ** kwargs )
17
17
18
18
def get_organizations (self ):
19
+ """
20
+ Returns a list of your organizations (based on your API key).
21
+ :return:
22
+ """
19
23
url = self .resource_url ("orgs" )
20
24
return self .get (url )
21
25
26
+ def get_organization (self , org_id ):
27
+ """
28
+ Returns information about a single organization by ID
29
+ :param org_id:
30
+ :return:
31
+ """
32
+ url = self .resource_url (f"orgs/{ org_id } " )
33
+ return self .get (url )
34
+
35
+ def get_managed_accounts_in_organization (self , org_id , cursor = None ):
36
+ """
37
+ Returns a list of accounts managed by the organization
38
+ :param org_id:
39
+ :param cursor:
40
+ :return:
41
+ """
42
+ url = self .resource_url (f"orgs/{ org_id } /users" )
43
+ params = {}
44
+ if cursor :
45
+ params ["cursor" ] = cursor
46
+ return self .get (url , params = params )
47
+
48
+ def search_users_in_organization (
49
+ self ,
50
+ org_id ,
51
+ account_ids = None ,
52
+ account_types = None ,
53
+ account_statuses = None ,
54
+ name_or_nicknames = None ,
55
+ email_usernames = None ,
56
+ email_domains = None ,
57
+ is_suspended = None ,
58
+ cursor = None ,
59
+ limit = 10000 ,
60
+ expand = None ,
61
+ ):
62
+ """
63
+ Returns a list of accounts in the organization that match the search criteria.
64
+ The API is available for customers using the new user management experience only.
65
+ How the new user management experience works
66
+ Returns a list of users within an organization,
67
+ offering search functionality through multiple parameters for more precise results.
68
+ :param org_id:
69
+ :param account_ids: Unique ID of the users account. The format is [a-zA-Z0-9_|-:]{1,128}
70
+ :param account_types: The type of account Valid values: atlassian, customer, app
71
+ :param account_statuses: The lifecycle status of the account
72
+ :param name_or_nicknames:
73
+ :param email_usernames:
74
+ :param email_domains:
75
+ :param is_suspended: Suspended users with no access. This is independent of the user account status
76
+ :param cursor: Starting point marker for page result retrieval
77
+ :param limit: The number of items to return. Default = max = 10000
78
+ :param expand: Valid values: NAME, EMAIL, EMAIL_VERIFIED, PRODUCT_LAST_ACCESS, GROUPS
79
+ :return:
80
+ """
81
+
82
+ url = self .resource_url (f"orgs/{ org_id } /users/search" )
83
+ params = {}
84
+ if cursor :
85
+ params ["cursor" ] = cursor
86
+ if limit :
87
+ params ["limit" ] = limit
88
+ if account_ids :
89
+ params ["accountIds" ] = account_ids
90
+ if account_types :
91
+ params ["accountTypes" ] = account_types
92
+ if account_statuses :
93
+ params ["accountStatuses" ] = account_statuses
94
+ if name_or_nicknames :
95
+ params ["nameOrNicknames" ] = name_or_nicknames
96
+ if email_usernames :
97
+ params ["emailUsernames" ] = email_usernames
98
+ if email_domains :
99
+ params ["emailDomains" ] = email_domains
100
+ if is_suspended :
101
+ params ["isSuspended" ] = is_suspended
102
+ if expand :
103
+ params ["expand" ] = expand
104
+
105
+ return self .get (url , params = params )
106
+
22
107
23
108
class CloudAdminUsers (AtlassianRestAPI ):
24
109
def __init__ (self , admin_api_key , * args , ** kwargs ):
0 commit comments