def getAll(self, token, page='', itemsPerPage='', sortBy='', sortDesc=''): """ Args: \n token:str -> You must have the access token.\n page -> The number of records you wish to skip before selecting records \n itemsPerPage -> Limit the number of results returned \n sortBy -> Properties that should be ordered by \n sortDesc -> Descending or ascending or nothing \n Returns: List all Clients Documentation: https://docs.plusauth.com/api/core/clients/listClients?lang=python """ headers = bearerToken(token) payload = { 'page': page, 'itemsPerPage': itemsPerPage, 'sortBy': sortBy, 'sortDesc': sortDesc } res = requests.get(base_url + "clients", params=payload, headers=headers) res_j = res.json() return res_j
def create(self, token, client_name, update_at='', created_at='', client_id='', client_metadata=''): """ Args: \n token:str -> You must have the access token.\n client_name:str -> Client name. \n update_at -> Update at \n created_at -> Created at \n client_id -> Client ID \n client_metadata:object -> Client metadata \n Returns: Create new Clients. Documentation: https://docs.plusauth.com/api/core/clients/createClient?lang=python """ headers = bearerToken(token) headers['content-type'] = 'application/json' payload = { 'client_name': client_name, 'update_at': update_at, 'created_at': created_at, 'client_id': client_id, 'client_metadata': client_metadata } res = requests.post(base_url + "clients", data=payload, headers=headers) res_j = res.json() return res_j
def delete(self, token, id): """ Args: \n token:str -> You must have the access token.\n id:str -> Connection ID \n Returns: Delete Connection. Documentation: https://docs.plusauth.com/api/core/connections/deleteConnection?lang=python """ headers = bearerToken(token) self.id = id res = requests.delete(base_url + "federated/{}".format(self.id), headers=headers) return res
def delete(self, token, id): """ Args: \n token:str -> You must have the access token.\n id -> Client id Returns: Delete Client. Documentation: https://docs.plusauth.com/api/core/apis/deleteClient?lang=python """ headers = bearerToken(token) self.id = id res = requests.delete(base_url + "clients/{}".format(self.id), headers=headers) return res.text
def get(self, token, id): """ Args: \n token:str -> You must have the access token.\n id:str -> Client id Returns: Retrieve Client Documentation: https://docs.plusauth.com/api/core/clients/getClient?lang=python """ headers = bearerToken(token) self.id = id res = requests.get(base_url + "clients/{}".format(self.id), headers=headers) res_j = res.json() return res_j
def get(self, token, id): """ Args: \n token:str -> You must have the access token.\n id:str -> Connection ID Returns: Retrieve Connection. Documentation: https://docs.plusauth.com/api/core/connections/getConnection """ headers = bearerToken(token) self.id = id res = requests.get(base_url + "federated/{}".format(self.id), headers=headers) res_j = res.json() return res_j
def updateMultiple(self, token, *hooks): """ Args: \n hooks -> Array of Hooks Returns: Update hooks. Documentation: https://docs.plusauth.com/api/core/hooks/updateHooks?lang=python """ headers = bearerToken(token) headers['content-type'] = 'application/json' hooks_array = list(hooks) payload = {'hooks': hooks_array} res = requests.patch(base_url + "hooks", data=payload, headers=headers) res_j = res.json() return res_j
def update(self, token, id, updated_at='', created_at='', client_name='', client_id='', client_metadata='', system='', audience=''): """ Args: \n token:str -> You must have the access token.\n id:str -> Client id \n client_name -> Client name. \n update_at -> Update at \n created_at -> Created at \n client_id -> Client ID \n client_metadata:object -> Client metadata \n system -> system \n audience -> audience \n Returns: Update CLIENT Documentation: https://docs.plusauth.com/api/core/clients/updateClient """ headers = bearerToken(token) headers['content-type'] = 'application/json' self.id = id payload = { 'client_name': client_name, 'update_at': updated_at, 'created_at': created_at, 'client_id': client_id, 'client_metadata': client_metadata, 'system': system, 'audience': audience } res = requests.patch(base_url + "clients/{}".format(self.id), data=payload, headers=headers) res_j = res.json() return res_j
def addPackages(self, token, id, npm=''): """ Args: \n token:str -> You must have the access token.\n id:str -> Hook id \n npm -> Npm packages array \n Returns: Delete packages from hook. Documentation: https://docs.plusauth.com/api/core/hooks/addHookPackages """ headers = bearerToken(token) headers['content-type'] = 'application/json' self.id = id payload = {'npm': npm} res = requests.post(base_url + "hooks/{}/packages".format(self.id), data=payload, headers=headers) return res.text
def test(self, token, name, type, enabled=True, description='', order='', content='', packages=''): """ Args: \n token:str -> You must have the access token.\n name -> str \n type -> str \n enabled -> Boolean \n description -> str \n order -> number \n content -> str \n packages -> array<object> \n Returns: Test a hook by executing it . Documentation: https://docs.plusauth.com/api/core/hooks/testHook?lang=python """ headers = bearerToken(token) headers['content-type'] = 'application/json' payload = { 'name': name, 'type': type, 'enabled': enabled, 'description': description, 'order': order, 'content': content, 'packages': packages } res = requests.post(base_url + "hook-test", data=payload, headers=headers) res_j = res return res_j
def create(self, token, name, type, settings=''): """ Args: \n token:str -> You must have the access token.\n name:str -> Name \n type:str -> Type \n settings -> Settings |n Returns: Create new Connection. Documentation: https://docs.plusauth.com/api/core/connections/createConnection """ headers = bearerToken(token) headers['content-type'] = 'application/json' payload = {'name': name, 'type': type, 'settings': settings} res = requests.post(base_url + "federated", data=payload, headers=headers) res_j = res.json() return res_j
def update(self, token, id, hook_object=''): """ Args: \n token:str -> You must have the access token.\n id:str -> Hook id \n hook_object -> Hook object\n Returns: Update Hook Documentation: https://docs.plusauth.com/api/core/hooks/updateHook?lang=python """ headers = bearerToken(token) headers['content-type'] = 'application/json' self.id = id payload = {'hook_object': hook_object} res = requests.patch(base_url + "hooks/{}".format(self.id), data=payload, headers=headers) res_j = res.json() return res_j
def update(self, token, id, created_at='', updated_at='', tenant_id='', name='', type=''): """ Args: \n token:str -> You must have the access token.\n id:str -> Connection ID \n created_at -> Created at \n updated_at -> Updated at \n tenant_id -> Tenant ID \n name -> Name \n type -> Type \n Returns: Update Connection. Documentation: https://docs.plusauth.com/api/core/connections/updateConnection """ headers = bearerToken(token) headers['content-type'] = 'application/json' self.id = id payload = { 'created_at': created_at, 'update_at': updated_at, 'tenant_id': tenant_id, 'name': name, 'type': type } res = requests.patch(base_url + "federated/{}".format(self.id), data=payload, headers=headers) res_j = res.json() return res_j