Beispiel #1
0
    def get_single_SMS(self, sms_id):
        """
        Get a specific sms
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SMS_ID_URL % sms_id)

        return connection.get_request()
Beispiel #2
0
    def get_email(self, email_id):
        """
        Get a specific email
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.EMAILS_ID_URL % email_id)

        return connection.get_request()
Beispiel #3
0
    def get_signature(self, signature_id):
        """
        Get a concrete Signature
        @return Signature data
        """
        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_ID_URL % signature_id)

        return connection.get_request()
Beispiel #4
0
    def get_brandings(self):
        """
        Get all account brandings
        @return List of brandings
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.BRANDINGS_URL)

        return connection.get_request()
Beispiel #5
0
    def get_user(self, user_id):
        """
           Get a single user
        """
        url = self.TEAM_USERS_ID_URL % user_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #6
0
    def delete_contact(self, contact_id):
        """
        Delete single contact
        """
        url = self.CONTACTS_ID_URL % contact_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #7
0
    def get_group(self, group_id):
        """
        Get a single group
        """
        url = self.TEAM_GROUPS_ID_URL % group_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #8
0
    def delete_subscription(self, subscription_id):
        """
        Delete single subscription
        """
        url = self.SUBSCRIPTIONS_ID_URL % subscription_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #9
0
    def get_groups(self, limit=100, offset=0):
        """
        Get all groups from your current team
        """
        url = self.TEAM_GROUPS_URL + "?limit=%s&offset=%s" % (limit, offset)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #10
0
    def cancel_signature(self, signature_id):
        """
        Cancel a concrete Signature
        @signature_id: Id of signature
        @return Signature data
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SIGNS_CANCEL_URL % signature_id)

        return connection.patch_request()
Beispiel #11
0
    def send_signature_reminder(self, signature_id):
        """
        Send a reminder email
        @signature_id: Id of signature
        @document_id: Id of document
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.SIGNS_SEND_REMINDER_URL % signature_id)

        return connection.post_request()
Beispiel #12
0
    def download_SMS_audit_trail(self, sms_id, certificate_id):
        connection = Connection(self.token)

        connection.set_url(self.production, self.SMS_AUDIT_TRAIL % (sms_id, certificate_id))

        response, headers = connection.file_request()

        if headers['content-type'] == 'application/json':
            return response

        return response
Beispiel #13
0
    def get_branding(self, branding_id):
        """
        Get a concrete branding
        @branding_id: Id of the branding to fetch
        @return Branding
        """
        connection = Connection(self.token)

        connection.set_url(self.production, self.BRANDINGS_ID_URL % branding_id)

        return connection.get_request()
Beispiel #14
0
    def get_templates(self, limit=100, offset=0):
        """
        Get all account templates
        """
        url = self.TEMPLATES_URL + "?limit=%s&offset=%s" % (limit, offset)

        connection = Connection(self.token)

        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #15
0
    def delete_group(self, group_id):
        """
        Remove a group from your team
        :param group_id: Id of group
        """

        url = self.TEAM_GROUPS_ID_URL % group_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #16
0
    def remove_manager_from_group(self, group_id, user_id):
        """
        Add a user to a group as a member
        :param group_id:
        :param user_id:
        """
        url = self.TEAM_MANAGERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #17
0
    def remove_seat(self, seat_id):
        """
        Remove a seat from your team
        :param seat_id: Id of user
        """

        url = self.TEAM_SEATS_ID_URL % seat_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #18
0
    def remove_user(self, user_id):
        """
        Remove a user from your team
        :param user_id: Id of user
        """

        url = self.TEAM_USERS_ID_URL % user_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
Beispiel #19
0
    def add_member_to_group(self, group_id, user_id):
        """
        Add a user to a group as a member
        :param group_id:
        :param user_id:
        """
        url = self.TEAM_MEMBERS_URL % (group_id, user_id)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.post_request()
Beispiel #20
0
    def update_branding(self, branding_id, params):
        """
        Update a existing branding
        @branding_id: Id of the branding to update
        @params: Same params as method create_branding, see above
        @return: A dict with updated branding data
        """
        connection = Connection(self.token)

        connection.add_header('Content-Type', 'application/json')
        connection.set_url(self.production, self.BRANDINGS_ID_URL % branding_id)
        connection.add_params(params)

        return connection.patch_request()
Beispiel #21
0
    def download_audit_trail(self, signature_id, document_id):
        """
        Get the audit trail of concrete document
        @signature_id: Id of signature
        @document_id: Id of document
        """
        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_DOCUMENTS_AUDIT_URL % (signature_id, document_id))

        response, headers = connection.file_request()

        if headers['content-type'] == 'application/json':
            return response

        return response
Beispiel #22
0
    def count_signatures(self, conditions={}):
        """
        Count all signatures
        """
        url = self.SIGNS_COUNT_URL + '?'

        for key, value in conditions.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #23
0
    def get_signatures(self, limit=100, offset=0, conditions={}):
        """
        Get all signatures
        """
        url = self.SIGNS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in conditions.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #24
0
    def get_contacts(self, limit=100, offset=0, params={}):
        """
        Get all account contacts
        """
        url = self.CONTACTS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #25
0
    def create_contact(self, email, name):
        """
        Create a new contact
        :param email: user email
        :param name: user name
        """
        params = {'email': email, 'name': name}

        url = self.CONTACTS_URL

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_header('Content-Type', 'application/json')
        connection.add_params(params, json_format=True)

        return connection.post_request()
Beispiel #26
0
    def invite_user(self, email, role):
        """
        Send an invitation to email with a link to join your team
        :param email: Email to add to your team
        :param role: Can be admin or member
        """
        parameters = {
            'email': email,
            'role': role
        }

        connection = Connection(self.token)
        connection.set_url(self.production, self.TEAM_USERS_URL)
        connection.add_params(parameters)

        return connection.post_request()
Beispiel #27
0
    def count_subscriptions(self, params={}):
        """
        Count all subscriptions
        """
        url = self.SUBSCRIPTIONS_COUNT_URL + '?'

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #28
0
    def get_subscriptions(self, limit=100, offset=0, params={}):
        """
        Get all subscriptions
        """
        url = self.SUBSCRIPTIONS_URL + "?limit=%s&offset=%s" % (limit, offset)

        for key, value in params.items():
            if key is 'ids':
                value = ",".join(value)

            url += '&%s=%s' % (key, value)

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.get_request()
Beispiel #29
0
    def create_group(self, name):
        """
        Create group
        :param name: Group name
        """
        parameters = {
            'name': name
        }

        url = self.TEAM_GROUPS_URL

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_params(parameters)

        return connection.post_request()
Beispiel #30
0
    def change_user_role(self, user_id, role):
        """
        Change role of current user
        :param user_id: Id of user
        :param role: Can be admin or member
        """
        parameters = {
            'role': role
        }

        url = self.TEAM_USERS_ID_URL % user_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)
        connection.add_params(parameters)

        return connection.patch_request()