Repository navigation
Expand file tree
/
Copy pathorganizations.py
More file actions
40 lines (31 loc) · 1.82 KB
/
Copy pathorganizations.py
File metadata and controls
40 lines (31 loc) · 1.82 KB
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
30
31
32
33
34
35
36
37
38
39
40
class Organizations(object):
def __init__(self, client):
self._client = client
def get_organization(self, organization_id, **kwargs):
url = "organizations/{}".format(organization_id)
return self._client._get(self._client.BASE_URL + url, **kwargs)
def get_all_organizations(self, params=None, **kwargs):
url = "organizations"
return self._client._get(self._client.BASE_URL + url, params=params, **kwargs)
def create_organization(self, data, **kwargs):
url = "organizations"
return self._client._post(self._client.BASE_URL + url, json=data, **kwargs)
def update_organization(self, organization_id, data, **kwargs):
url = "organizations/{}".format(organization_id)
return self._client._put(self._client.BASE_URL + url, json=data, **kwargs)
def delete_organization(self, organization_id, **kwargs):
url = "organizations/{}".format(organization_id)
return self._client._delete(self._client.BASE_URL + url, **kwargs)
def get_organization_fields(self, params=None, **kwargs):
url = "organizationFields"
return self._client._get(self._client.BASE_URL + url, params=params, **kwargs)
def search_organizations(self, params=None, **kwargs):
url = "organizations/search"
return self._client._get(self._client.BASE_URL + url, params=params, **kwargs)
def get_organization_persons(self, organization_id, params=None, **kwargs):
url = "organizations/{}/persons".format(organization_id)
return self._client._get(self._client.BASE_URL + url, params=params, **kwargs)
def add_follower_to_organization(self, org_id, user_id, **kwargs):
url = "organizations/{}/followers".format(org_id)
data = {"user_id": user_id}
return self._post(self.BASE_URL+url, json=data, **kwargs)