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
        """
        parser = Parser(self.TOUCH_BRANDING_PARAMS, [])
        parser.validate_data(params)

        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()
    def create_signature(self, files, recipients, params):
        """
        Create a new Signature request.
        @files
            Files to send
                ex: ['/documents/internet_contract.pdf', ... ]
        @recipients
            A dictionary with the email and fullname of the person you want to sign.
            If you wanna send only to one person:
               - [{"email": "*****@*****.**", "fullname": "John"}]
            For multiple recipients, yo need to submit a list of dicts:
               - [{"email": "*****@*****.**", "fullname": "John"}, {"email":"*****@*****.**", "fullname": "Bob"}]
            You can attach a phone number to each recipient, and then, the user will receive a security code in his smartphone.
               - [{"email": "*****@*****.**", "fullname": "John", "phone": "XXXX"}]
        @params: An array of params
            - subject: Subject of the email (optional)
            - body: Body of the email (optional)
            - in_person_sign: If you want to do an in person sign (system will not send an email to the user, but return the
                         sign url instead) (optional)
            - sequential: If you want to do a sequential sign (for multiple recipients, the sign goes in sequential way)
                          (optional)
            - mandatory_photo: A list of booleans that tell if photo capture will be asked to finish the signature process. (optional)
            The index of array references the document number, so first value will apply to first document.
            - mandatory_voice: A list of booleans that tell if audio recording will be asked to finish the signature process. (optional)
            The index of array references the document number, so first value will apply to first document.
            - mandatory_pages: A list of list of pages the signer must sign (optional)
            The index of array references the document number, so first value will apply to first document.
                ex: [[1, 2, 5], [1]]
            - branding_id: The id of the branding you want to use. If no branding_id, system use the account default
                           branding. (optional)
        """
        params['files'] = files
        params['recipients'] = recipients

        parser = Parser(self.CREATE_SIGN_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)
        connection.set_url(self.production, self.SIGNS_URL)
        connection.add_params(params)
        connection.add_files(files)

        return connection.post_request()
    def create_branding(self, params):
        """
        Create a new branding
        @params: An array of params (all params are optional)
            - primary: If set, this new branding will be the default one.
            - corporate_layout_color: Default color for all application widgets (hex code)
            - corporate_text_color: Default text color for all application widgets (hex code)
            - application_texts: A dict with the new text values
                - sign_button: Text for sign button
                - send_button: Text for send button
                - decline_button: Text for decline button:
                - decline_modal_title: Title for decline modal (when you click decline button)
                - decline_modal_body: Body for decline modal (when you click decline button)
                - photo: Photo message text, which tells the user that a photo is needed in the current process
                - multi_pages: Header of the document, which tells the user the number of pages to sign
                ex: { 'photo': 'Hey! Take a photo of yourself to validate the process!'}
            - subject_tag: This tag appears at the subject of all your messages
                ex: [ your_tag ] Pending document
            - reminders: A list with reminder times (in seconds). Every reminder time, a email will be sent, if the
                        signer didn't sign the document
                ex: [ 3600 ] (At 30 minutes of sending the email))
            - expire_time: The signature time (in seconds). When the expire time is over, the document cannot be signed.
                           Set 0 if you want a signature without expire time.
            - callback_url: A url to redirect the user, when the process is over.
            - events_url: A url to send system event notifications
            - signature_pos_x: Default position x of signature
            - signature_pos_y: Default position y of signature
            - terms_and_conditions_label: The terms text that appears when you need to check the button to accept.
            - terms_and_conditions_body: Custom text that appears below signature conditions

        @return: A dict with branding data
        """
        parser = Parser(self.TOUCH_BRANDING_PARAMS, [])
        parser.validate_data(params)

        connection = Connection(self.token)

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

        return connection.post_request()
    def create_email(self, files, recipients, subject, body, params):
        """
        Create a new certified email

        @files
             Files to send
                ex: ['/documents/internet_contract.pdf', ... ]
        @recipients
            A dictionary with the email and fullname of the person you want to sign.
            If you wanna send only to one person:
               - [{"email": "*****@*****.**", "fullname": "John"}]
            For multiple recipients, yo need to submit a list of dicts:
               - [{"email": "*****@*****.**", "fullname": "John"}, {"email":"*****@*****.**", "fullname": "Bob"}]
        @subject
            Email subject
        @body
            Email body
        @params
            Optional parameters
            send_email_event: Chooses the event that will trigger the audit trail generation
                - delivered: When email is delivered
                - seen: When app is opened (only emails with pdfs attached)
                - opened: When document is opened (only emails with pdfs attached)
        """
        params['files'] = files
        params['recipients'] = recipients
        params['subject'] = subject
        params['body'] = body

        parser = Parser(self.CREATE_EMAIL_PARAMS, [])
        params, files = parser.parse_data(params)

        connection = Connection(self.token)
        connection.set_url(self.production, self.EMAILS_URL)
        connection.add_params(params)
        connection.add_files(files)

        return connection.post_request()