Esempio n. 1
0
    def get_field(self, id):
        """
		The method to get field

		Parameters:
			id (int) : An int representing the id

		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)

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2.1/settings/fields/'
        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.add_param(
            Param('module', 'com.zoho.crm.api.Fields.GetFieldParam'),
            self.__module)
        try:
            from zcrmsdk.src.com.zoho.crm.api.fields.response_handler import ResponseHandler
        except Exception:
            from .response_handler import ResponseHandler
        return handler_instance.api_call(ResponseHandler.__module__,
                                         'application/json')
Esempio n. 2
0
    def get_field_attachments(self):
        """
		The method to get field attachments

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2.1/'
        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 + '/actions/download_fields_attachment'
        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.add_param(
            Param(
                'fields_attachment_id',
                'com.zoho.crm.api.FieldAttachments.GetFieldAttachmentsParam'),
            self.__fields_attachment_id)
        try:
            from zcrmsdk.src.com.zoho.crm.api.field_attachments.response_handler import ResponseHandler
        except Exception:
            from .response_handler import ResponseHandler
        return handler_instance.api_call(ResponseHandler.__module__,
                                         'application/x-download')
Esempio n. 3
0
    def get_layouts(self):
        """
		The method to get layouts

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2.1/settings/layouts'
        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.add_param(
            Param('module', 'com.zoho.crm.api.Layouts.GetLayoutsParam'),
            self.__module)
        try:
            from zcrmsdk.src.com.zoho.crm.api.layouts.response_handler import ResponseHandler
        except Exception:
            from .response_handler import ResponseHandler
        return handler_instance.api_call(ResponseHandler.__module__,
                                         'application/json')
Esempio n. 4
0
	def get_custom_views(self, param_instance=None):
		"""
		The method to get custom views

		Parameters:
			param_instance (ParameterMap) : An instance of ParameterMap

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

		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/settings/custom_views'
		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.add_param(Param('module', 'com.zoho.crm.api.CustomViews.GetCustomViewsParam'), self.__module)
		handler_instance.set_param(param_instance)
		try:
			from zcrmsdk.src.com.zoho.crm.api.custom_views.response_handler import ResponseHandler
		except Exception:
			from .response_handler import ResponseHandler
		return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
Esempio n. 5
0
    def update_pipeline(self, pipeline_id, request):
        """
		The method to update pipeline

		Parameters:
			pipeline_id (int) : An int representing the pipeline_id
			request (BodyWrapper) : An instance of BodyWrapper

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

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

        if not isinstance(pipeline_id, int):
            raise SDKException(Constants.DATA_TYPE_ERROR,
                               'KEY: pipeline_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)

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2.1/settings/pipeline/'
        api_path = api_path + str(pipeline_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.add_param(
            Param('layout_id',
                  'com.zoho.crm.api.Pipeline.UpdatePipelineParam'),
            self.__layout_id)
        try:
            from zcrmsdk.src.com.zoho.crm.api.pipeline.action_handler import ActionHandler
        except Exception:
            from .action_handler import ActionHandler
        return handler_instance.api_call(ActionHandler.__module__,
                                         'application/json')
Esempio n. 6
0
    def transfer_and_delete(self, request):
        """
		The method to transfer and delete

		Parameters:
			request (TransferAndDeleteWrapper) : An instance of TransferAndDeleteWrapper

		Returns:
			APIResponse: An instance of APIResponse

		Raises:
			SDKException
		"""

        try:
            from zcrmsdk.src.com.zoho.crm.api.pipeline.transfer_and_delete_wrapper import TransferAndDeleteWrapper
        except Exception:
            from .transfer_and_delete_wrapper import TransferAndDeleteWrapper

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

        handler_instance = CommonAPIHandler()
        api_path = ''
        api_path = api_path + '/crm/v2.1/settings/pipeline/actions/transfer'
        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)
        handler_instance.add_param(
            Param('layout_id',
                  'com.zoho.crm.api.Pipeline.TransferAndDeleteParam'),
            self.__layout_id)
        try:
            from zcrmsdk.src.com.zoho.crm.api.pipeline.transfer_action_handler import TransferActionHandler
        except Exception:
            from .transfer_action_handler import TransferActionHandler
        return handler_instance.api_call(TransferActionHandler.__module__,
                                         'application/json')