Example #1
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()
Example #2
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()
Example #3
0
    def update_group(self, group_id, name):
        """
        Change group name
        :param group_id: Id of group
        :param name: Group name
        """
        parameters = {
            'name': name
        }

        url = self.TEAM_GROUPS_ID_URL % group_id

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

        return connection.patch_request()
Example #4
0
    def create_subscription(self, url, events):
        """
        Create subscription
        :param events: Events to subscribe
        :param url: Url to send events
        """
        params = {
            'url': url,
            'events': events
        }

        url = self.SUBSCRIPTIONS_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()
Example #5
0
    def update_contact(self, contact_id, email=None, name=None):
        """
        Update a current contact
        :param contact_id: contact id
        :param email: user email
        :param name: user name
        """
        params = {}

        if email is not None:
            params['email'] = email

        if name is not None:
            params['name'] = name

        url = self.CONTACTS_ID_URL % contact_id

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

        return connection.patch_request()
Example #6
0
    def update_subscription(self, subscription_id, url=None, events=None):
        """
        Create subscription
        :param subscription_id: Subscription to update
        :param events: Events to subscribe
        :param url: Url to send events
        """
        params = {}

        if url is not None:
            params['url'] = url

        if events is not None:
            params['events'] = events

        url = self.SUBSCRIPTIONS_ID_URL % subscription_id

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

        return connection.patch_request()
Example #7
0
    def create_branding(self, params):
        """
        Create a new branding
        @params: An array of params (all params are optional)
            - layout: Default color for all application widgets (hex code)
            - text: 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!'}
        """
        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()