import requests
from  plusauth_rest_py.base import  baseUrl
from plusauth_rest_py.bearer_token import bearerToken

base_url=baseUrl()

class ConnectionService():

    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 Connections.

            Documentation: https://docs.plusauth.com/api/core/connections/listConnections?lang=python

        """
        headers = bearerToken(token)
        payload = {'page': page, 'itemsPerPage': itemsPerPage, 'sortBy': sortBy, 'sortDesc': sortDesc}
        res = requests.get(base_url +"federated" , params = payload , headers = headers )
        res_j =res.json()
        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 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 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

    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

e5eb8281de374719eef24378040ee886f6e85226
<mask token>


class ConnectionService:
    <mask token>

    def create(self, token, name, type, settings=''):
        """
            Args: 

            token:str -> You must have the access token.

            name:str -> Name 

            type:str -> Type 

            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 get(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            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 update(self, token, id, created_at='', updated_at='', tenant_id='',
        name='', type=''):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 

            created_at -> Created at 

            updated_at -> Updated at 

            tenant_id -> Tenant ID  

            name -> Name 

            type -> Type 


            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
    <mask token>

<mask token>


class ConnectionService:

    def getAll(self, token, page='', itemsPerPage='', sortBy='', sortDesc=''):
        """
            Args: 

            token:str -> You must have the access token.

            page -> The number of records you wish to skip before selecting records 

            itemsPerPage -> Limit the number of results returned 

            sortBy -> Properties that should be ordered by 

            sortDesc -> Descending or ascending or nothing 


            Returns: List Connections.

            Documentation: https://docs.plusauth.com/api/core/connections/listConnections?lang=python

        """
        headers = bearerToken(token)
        payload = {'page': page, 'itemsPerPage': itemsPerPage, 'sortBy':
            sortBy, 'sortDesc': sortDesc}
        res = requests.get(base_url + 'federated', params=payload, headers=
            headers)
        res_j = res.json()
        return res_j

    def create(self, token, name, type, settings=''):
        """
            Args: 

            token:str -> You must have the access token.

            name:str -> Name 

            type:str -> Type 

            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 get(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            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 update(self, token, id, created_at='', updated_at='', tenant_id='',
        name='', type=''):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 

            created_at -> Created at 

            updated_at -> Updated at 

            tenant_id -> Tenant ID  

            name -> Name 

            type -> Type 


            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
    <mask token>

<mask token>
base_url = baseUrl()


class ConnectionService:

    def getAll(self, token, page='', itemsPerPage='', sortBy='', sortDesc=''):
        """
            Args: 

            token:str -> You must have the access token.

            page -> The number of records you wish to skip before selecting records 

            itemsPerPage -> Limit the number of results returned 

            sortBy -> Properties that should be ordered by 

            sortDesc -> Descending or ascending or nothing 


            Returns: List Connections.

            Documentation: https://docs.plusauth.com/api/core/connections/listConnections?lang=python

        """
        headers = bearerToken(token)
        payload = {'page': page, 'itemsPerPage': itemsPerPage, 'sortBy':
            sortBy, 'sortDesc': sortDesc}
        res = requests.get(base_url + 'federated', params=payload, headers=
            headers)
        res_j = res.json()
        return res_j

    def create(self, token, name, type, settings=''):
        """
            Args: 

            token:str -> You must have the access token.

            name:str -> Name 

            type:str -> Type 

            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 get(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            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 update(self, token, id, created_at='', updated_at='', tenant_id='',
        name='', type=''):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 

            created_at -> Created at 

            updated_at -> Updated at 

            tenant_id -> Tenant ID  

            name -> Name 

            type -> Type 


            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

    def delete(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 


            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

import requests
from plusauth_rest_py.base import baseUrl
from plusauth_rest_py.bearer_token import bearerToken
base_url = baseUrl()


class ConnectionService:

    def getAll(self, token, page='', itemsPerPage='', sortBy='', sortDesc=''):
        """
            Args: 

            token:str -> You must have the access token.

            page -> The number of records you wish to skip before selecting records 

            itemsPerPage -> Limit the number of results returned 

            sortBy -> Properties that should be ordered by 

            sortDesc -> Descending or ascending or nothing 


            Returns: List Connections.

            Documentation: https://docs.plusauth.com/api/core/connections/listConnections?lang=python

        """
        headers = bearerToken(token)
        payload = {'page': page, 'itemsPerPage': itemsPerPage, 'sortBy':
            sortBy, 'sortDesc': sortDesc}
        res = requests.get(base_url + 'federated', params=payload, headers=
            headers)
        res_j = res.json()
        return res_j

    def create(self, token, name, type, settings=''):
        """
            Args: 

            token:str -> You must have the access token.

            name:str -> Name 

            type:str -> Type 

            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 get(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            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 update(self, token, id, created_at='', updated_at='', tenant_id='',
        name='', type=''):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 

            created_at -> Created at 

            updated_at -> Updated at 

            tenant_id -> Tenant ID  

            name -> Name 

            type -> Type 


            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

    def delete(self, token, id):
        """
            Args: 

            token:str -> You must have the access token.

            id:str -> Connection ID 


            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

import requests
from  plusauth_rest_py.base import  baseUrl
from plusauth_rest_py.bearer_token import bearerToken

base_url=baseUrl()

class ConnectionService():

    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 Connections.

            Documentation: https://docs.plusauth.com/api/core/connections/listConnections?lang=python

        """
        headers = bearerToken(token)
        payload = {'page': page, 'itemsPerPage': itemsPerPage, 'sortBy': sortBy, 'sortDesc': sortDesc}
        res = requests.get(base_url +"federated" , params = payload , headers = headers )
        res_j =res.json()
        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 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 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

    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
