Example #1
0
	def create_bulk_write_job(self, request):
		"""
		The method to create bulk write job

		Parameters:
			request (RequestWrapper) : An instance of RequestWrapper

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		try:
			from zcrmsdk.src.com.zoho.crm.api.bulk_write.request_wrapper import RequestWrapper
		except Exception:
			from .request_wrapper import RequestWrapper

		if request is not None and not isinstance(request, RequestWrapper):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: RequestWrapper', None, None)
		
		handler_instance = CommonAPIHandler()
		api_path = ''
		api_path = api_path + '/crm/bulk/v2.1/write'
		handler_instance.set_api_path(api_path)
		handler_instance.set_http_method(Constants.REQUEST_METHOD_POST)
		handler_instance.set_category_method(Constants.REQUEST_CATEGORY_CREATE)
		handler_instance.set_content_type('application/json')
		handler_instance.set_request(request)
		handler_instance.set_mandatory_checker(True)
		try:
			from zcrmsdk.src.com.zoho.crm.api.bulk_write.action_response import ActionResponse
		except Exception:
			from .action_response import ActionResponse
		return handler_instance.api_call(ActionResponse.__module__, 'application/json')
Example #2
0
	def update_notifications(self, request):
		"""
		The method to update notifications

		Parameters:
			request (BodyWrapper) : An instance of BodyWrapper

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		try:
			from zcrmsdk.src.com.zoho.crm.api.notification.body_wrapper import BodyWrapper
		except Exception:
			from .body_wrapper import BodyWrapper

		if request is not None and not isinstance(request, BodyWrapper):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', None, None)
		
		handler_instance = CommonAPIHandler()
		api_path = ''
		api_path = api_path + '/crm/v2.1/actions/watch'
		handler_instance.set_api_path(api_path)
		handler_instance.set_http_method(Constants.REQUEST_METHOD_PUT)
		handler_instance.set_category_method(Constants.REQUEST_CATEGORY_UPDATE)
		handler_instance.set_content_type('application/json')
		handler_instance.set_request(request)
		handler_instance.set_mandatory_checker(True)
		try:
			from zcrmsdk.src.com.zoho.crm.api.notification.action_handler import ActionHandler
		except Exception:
			from .action_handler import ActionHandler
		return handler_instance.api_call(ActionHandler.__module__, 'application/json')
Example #3
0
	def remove_tags_from_multiple_records(self, module_api_name, param_instance=None):
		"""
		The method to remove tags from multiple records

		Parameters:
			module_api_name (string) : A string representing the module_api_name
			param_instance (ParameterMap) : An instance of ParameterMap

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		if not isinstance(module_api_name, str):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', None, None)
		
		if param_instance is not None and not isinstance(param_instance, ParameterMap):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', None, None)
		
		handler_instance = CommonAPIHandler()
		api_path = ''
		api_path = api_path + '/crm/v2.1/'
		api_path = api_path + str(module_api_name)
		api_path = api_path + '/actions/remove_tags'
		handler_instance.set_api_path(api_path)
		handler_instance.set_http_method(Constants.REQUEST_METHOD_POST)
		handler_instance.set_category_method(Constants.REQUEST_CATEGORY_CREATE)
		handler_instance.set_mandatory_checker(True)
		handler_instance.set_param(param_instance)
		try:
			from zcrmsdk.src.com.zoho.crm.api.tags.record_action_handler import RecordActionHandler
		except Exception:
			from .record_action_handler import RecordActionHandler
		return handler_instance.api_call(RecordActionHandler.__module__, 'application/json')
Example #4
0
	def delete_photo(self, id, module_api_name):
		"""
		The method to delete photo

		Parameters:
			id (int) : An int representing the id
			module_api_name (string) : A string representing the module_api_name

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		if not isinstance(id, int):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
		
		if not isinstance(module_api_name, str):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', None, None)
		
		handler_instance = CommonAPIHandler()
		api_path = ''
		api_path = api_path + '/crm/v2/'
		api_path = api_path + str(module_api_name)
		api_path = api_path + '/'
		api_path = api_path + str(id)
		api_path = api_path + '/photo'
		handler_instance.set_api_path(api_path)
		handler_instance.set_http_method(Constants.REQUEST_METHOD_DELETE)
		handler_instance.set_category_method(Constants.REQUEST_METHOD_DELETE)
		try:
			from zcrmsdk.src.com.zoho.crm.api.record.file_handler import FileHandler
		except Exception:
			from .file_handler import FileHandler
		return handler_instance.api_call(FileHandler.__module__, 'application/json')
Example #5
0
	def upload_organization_photo(self, request):
		"""
		The method to upload organization photo

		Parameters:
			request (FileBodyWrapper) : An instance of FileBodyWrapper

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		try:
			from zcrmsdk.src.com.zoho.crm.api.org.file_body_wrapper import FileBodyWrapper
		except Exception:
			from .file_body_wrapper import FileBodyWrapper

		if request is not None and not isinstance(request, FileBodyWrapper):
			raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: FileBodyWrapper', None, None)
		
		handler_instance = CommonAPIHandler()
		api_path = ''
		api_path = api_path + '/crm/v2/org/photo'
		handler_instance.set_api_path(api_path)
		handler_instance.set_http_method(Constants.REQUEST_METHOD_POST)
		handler_instance.set_category_method(Constants.REQUEST_CATEGORY_CREATE)
		handler_instance.set_content_type('multipart/form-data')
		handler_instance.set_request(request)
		handler_instance.set_mandatory_checker(True)
		try:
			from zcrmsdk.src.com.zoho.crm.api.org.action_response import ActionResponse
		except Exception:
			from .action_response import ActionResponse
		return handler_instance.api_call(ActionResponse.__module__, 'application/json')
Example #6
0
    def update_related_record(self,
                              related_record_id,
                              request,
                              header_instance=None):
        """
		The method to update related record

		Parameters:
			related_record_id (int) : An int representing the related_record_id
			request (BodyWrapper) : An instance of BodyWrapper
			header_instance (HeaderMap) : An instance of HeaderMap

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

        try:
            from zcrmsdk.src.com.zoho.crm.api.related_records.body_wrapper import BodyWrapper
        except Exception:
            from .body_wrapper import BodyWrapper

        if not isinstance(related_record_id, int):
            raise SDKException(Constants.DATA_TYPE_ERROR,
                               'KEY: related_record_id EXPECTED TYPE: int',
                               None, None)

        if request is not None and not isinstance(request, BodyWrapper):
            raise SDKException(Constants.DATA_TYPE_ERROR,
                               'KEY: request EXPECTED TYPE: BodyWrapper', None,
                               None)

        if header_instance is not None and not isinstance(
                header_instance, HeaderMap):
            raise SDKException(
                Constants.DATA_TYPE_ERROR,
                'KEY: header_instance EXPECTED TYPE: HeaderMap', None, None)

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2/'
        api_path = api_path + str(self.__module_api_name)
        api_path = api_path + '/'
        api_path = api_path + str(self.__record_id)
        api_path = api_path + '/'
        api_path = api_path + str(self.__related_list_api_name)
        api_path = api_path + '/'
        api_path = api_path + str(related_record_id)
        handler_instance.set_api_path(api_path)
        handler_instance.set_http_method(Constants.REQUEST_METHOD_PUT)
        handler_instance.set_category_method(Constants.REQUEST_CATEGORY_UPDATE)
        handler_instance.set_content_type('application/json')
        handler_instance.set_request(request)
        handler_instance.set_header(header_instance)
        Utility.get_related_lists(self.__related_list_api_name,
                                  self.__module_api_name, handler_instance)
        try:
            from zcrmsdk.src.com.zoho.crm.api.related_records.action_handler import ActionHandler
        except Exception:
            from .action_handler import ActionHandler
        return handler_instance.api_call(ActionHandler.__module__,
                                         'application/json')
Example #7
0
    def get_record(self,
                   id,
                   module_api_name,
                   param_instance=None,
                   header_instance=None):
        """
		The method to get record

		Parameters:
			id (int) : An int representing the id
			module_api_name (string) : A string representing the module_api_name
			param_instance (ParameterMap) : An instance of ParameterMap
			header_instance (HeaderMap) : An instance of HeaderMap

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

        if not isinstance(id, int):
            raise SDKException(Constants.DATA_TYPE_ERROR,
                               'KEY: id EXPECTED TYPE: int', None, None)

        if not isinstance(module_api_name, str):
            raise SDKException(Constants.DATA_TYPE_ERROR,
                               'KEY: module_api_name EXPECTED TYPE: str', None,
                               None)

        if param_instance is not None and not isinstance(
                param_instance, ParameterMap):
            raise SDKException(
                Constants.DATA_TYPE_ERROR,
                'KEY: param_instance EXPECTED TYPE: ParameterMap', None, None)

        if header_instance is not None and not isinstance(
                header_instance, HeaderMap):
            raise SDKException(
                Constants.DATA_TYPE_ERROR,
                'KEY: header_instance EXPECTED TYPE: HeaderMap', None, None)

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2/'
        api_path = api_path + str(module_api_name)
        api_path = api_path + '/'
        api_path = api_path + str(id)
        handler_instance.set_api_path(api_path)
        handler_instance.set_http_method(Constants.REQUEST_METHOD_GET)
        handler_instance.set_category_method(Constants.REQUEST_CATEGORY_READ)
        handler_instance.set_param(param_instance)
        handler_instance.set_header(header_instance)
        Utility.get_fields(module_api_name)
        handler_instance.set_module_api_name(module_api_name)
        try:
            from zcrmsdk.src.com.zoho.crm.api.record.response_handler import ResponseHandler
        except Exception:
            from .response_handler import ResponseHandler
        return handler_instance.api_call(ResponseHandler.__module__,
                                         'application/json')