code
stringlengths 501
5.19M
| package
stringlengths 2
81
| path
stringlengths 9
304
| filename
stringlengths 4
145
|
---|---|---|---|
# ZOHOCRM v2 REST API wrapper
# Installation
Install using `pip`...
pip install zohocrm-api
Or
git clone https://github.com/bzdvdn/zohocrm-api.git
python3 setup.py
# Usage
```python
from zohocrm import ZOHOClient
client = ZOHOClient("<access_token>", "<refresh_token>", "<app_client_id>", "<app_client_secret>") # init client
leads = client.leads.list() # get all leads
lead_statuses = client.leads.list(data={"fields": "Lead_Statuses"})
#update access_token
new_token = client.update_access_token() # save to db
```
# TODO
* full documentation
* examples
* async version
* tests | zohocrm-api | /zohocrm-api-0.0.5.tar.gz/zohocrm-api-0.0.5/README.md | README.md |
import requests
import json
from urllib.parse import urlencode
VALID_ENTITIES = (
'leads', 'contacts', 'accounts', 'deals', 'campaigns', 'tasks',
'cases', 'events', 'calls', 'solutions', 'products', 'vendors',
'sales_orders', 'purchase_orders', 'invoices', 'price_books',
'users', 'org', 'roles', 'profiles', "settings"
)
class _Session(object):
def __init__(self, access_token, refresh_token='', client_id='', client_secret='',
api_domain="https://www.zohoapis.eu"):
self.access_token = access_token
self.refresh_token = refresh_token
self.client_id = client_id
self.client_secret = client_secret
self.request_session = self._init_session()
self.API_URL = f"{api_domain}/crm/v2/"
def update_access_token(self):
update_url = f"https://accounts.zoho.eu/oauth/v2/token?refresh_token={self.refresh_token}&client_id={self.client_id}&client_secret={self.client_secret}&grant_type=refresh_token"
response = requests.post(update_url).json()
self.access_token = response['access_token']
self.request_session = self._init_session()
return self.access_token
def remove_refresh_token(self, refresh_token=''):
remove_url = f'https://accounts.zoho.eu/oauth/v2/token/revoke?token={refresh_token if refresh_token else self.refresh_token}'
requests.post(remove_url)
return True
def _init_session(self, access_token=None):
session = requests.Session()
session.headers["Authorization"] = f"Zoho-oauthtoken {access_token if access_token else self.access_token}"
return session
def __send_request(self, http_method, url, params):
response = self.request_session.__getattribute__(http_method)(url, data=params)
if response.status_code == 401:
self.update_access_token()
response = self.request_session.__getattribute__(http_method)(url, data=params)
return response
def _send_api_request(self, service, http_method='get', object_id=None, params={}):
url = f"{self.API_URL}{service}/{object_id}" if object_id else f"{self.API_URL}{service}"
if http_method == 'get' and params:
url += "&" + urlencode(params) if "?" in url else "?" + urlencode(params)
response = self.__send_request(http_method, url, params)
try:
response_data = response.json()
data_key = [key for key in response_data if key != 'info'][0]
data = {data_key: response_data[data_key]}
if "info" in response_data:
info = response_data["info"]
while info["more_records"]:
page_url = f"{url}&page{info['page'] + 1}"
response = self.__send_request(http_method, page_url, params).json()
data[data_key].extend(response[data_key])
return data
except json.JSONDecodeError:
return response.text
def list(self, service, params={}, object_id=None):
return self._send_api_request(service=service, params=params)
def get(self, service, object_id, params={}):
return self._send_api_request(service=service, object_id=object_id, params=params)
def create(self, service, params={}, object_id=None):
return self._send_api_request(service=service, http_method="post", params=params)
def update(self, service, object_id, params={}):
return self._send_api_request(service=service, object_id=object_id, http_method='put', params=params)
def delete(self, service, object_id, params={}):
return self._send_api_request(service=service, object_id=object_id, http_method='delete', params=params)
class ZOHOClient(object):
def __init__(self, access_token, refresh_token='', client_id="", client_secret="",
api_domain="https://www.zohoapis.eu"):
self._session = _Session(access_token, refresh_token, client_id=client_id, client_secret=client_secret,
api_domain=api_domain)
def __getattr__(self, method_name):
if method_name not in VALID_ENTITIES:
raise ValueError("invalid zohocrm entity - {}, choose one of them: {}".format(
method_name, VALID_ENTITIES)
)
return _Request(self, method_name)
@property
def access_token(self):
return self._session.access_token
@property
def refresh_token(self):
return self._session.refresh_token
def update_access_token(self):
return self._session.update_access_token()
def remove_refresh_token(self):
return self._session.remove_refresh_token()
def __call__(self, method_name, method_kwargs={}):
return getattr(self, method_name)(method_kwargs)
class _Request(object):
__slots__ = ('_api', '_methods', '_method_args', '_object_id')
def __init__(self, api, methods):
self._api = api
self._methods = methods
def __getattr__(self, method_name):
return _Request(self._api, {'service': self._methods, 'method': method_name})
def __call__(self, object_id=None, data={}):
if not isinstance(data, dict):
raise ValueError("data must be a dict")
return self._api._session.__getattribute__(self._methods['method'])(
service=self._methods["service"],
object_id=object_id,
params=data
) | zohocrm-api | /zohocrm-api-0.0.5.tar.gz/zohocrm-api-0.0.5/zohocrm/api.py | api.py |
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
from zcrmsdk.src.com.zoho.api.authenticator.store import FileStore
from zcrmsdk.src.com.zoho.api.logger import Logger
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken, TokenType
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
class ApiClient:
def __init__(self, log_path: str = None, store_path: str = None, resource_path: str = None, email: str = None,
env: str = "USDataCenter", client_id: str = None, client_secret: str = None,
refresh_token: str = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
self.logger = Logger.get_instance(level=Logger.Levels.INFO, file_path=log_path)
self.user = UserSignature(email=email)
if env is "USDatacenter":
self.environment = USDataCenter.PRODUCTION()
if env is "EUDatacenter":
self.environment = EUDataCenter.PRODUCTION()
if env is "INDatacenter":
self.environment = INDataCenter.PRODUCTION()
if env is "CNDatacenter":
self.environment = CNDataCenter.PRODUCTION()
if env is "AUDatacenter":
self.environment = AUDataCenter.PRODUCTION()
self.token = OAuthToken(client_id=client_id, client_secret=client_secret, token=refresh_token,
token_type=TokenType.REFRESH)
self.store = FileStore(file_path=store_path)
self.config = SDKConfig(auto_refresh_fields=True, pick_list_validation=False)
self.resource_path = resource_path
"""
Call the static initialize method of Initializer class that takes the following arguments
1 -> UserSignature instance
2 -> Environment instance
3 -> Token instance
4 -> TokenStore instance
5 -> SDKConfig instance
6 -> resource_path
7 -> Logger instance. Default value is None
8 -> RequestProxy instance. Default value is None
"""
Initializer.initialize(user=self.user, environment=self.environment, token=self.token, store=self.store,
logger=self.logger, sdk_config=self.config, resource_path=self.resource_path) | zohocrm-prefect-tasks | /zohocrm_prefect_tasks-0.0.10-py3-none-any.whl/zohocrm_prefect_tasks/client.py | client.py |
from zcrmsdk.src.com.zoho.crm.api.record import *
from zcrmsdk.src.com.zoho.crm.api import HeaderMap, ParameterMap
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
from typing import Any
from ..client import ApiClient
class Create(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, body: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if body is None:
raise ValueError("An object must be provided")
if "data" not in body or not isinstance(body.get("data"), list):
raise ValueError("An object must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
request = BodyWrapper()
records = []
for elem in body.get("data"):
rec = Record()
for key in elem:
rec.add_key_value(key, elem.get(key))
records.append(rec)
request.set_data(records)
triggers = []
if "triggers" in body:
triggers = body.get("triggers")
request.set_trigger(triggers)
response = RecordOperations().create_records(module_api_name=module_name, request=request)
return response
except Exception as error:
print(error)
raise error
class List(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, headers_map: dict = None,
params_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(GetRecordsHeader, key), headers_map.get(key))
"""TODO: Should accept a list of ids"""
params = ParameterMap()
for key in params_map:
params.add(getattr(GetRecordsParam, key), params_map.get(key))
response = RecordOperations().get_records(module_api_name=module_name, param_instance=params,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Fetch(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, record_id: int = None,
headers_map: dict = None, params_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if record_id is None:
raise ValueError("A record ID must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(GetRecordHeader, key), headers_map.get(key))
params = ParameterMap()
for key in params_map:
params.add(getattr(GetRecordParam, key), params_map.get(key))
response = RecordOperations().get_record(id=record_id, module_api_name=module_name, param_instance=params,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Update(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, body: dict = None,
headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if headers_map is None:
headers_map = {}
if body is None:
raise ValueError("An object must be provided")
if "data" not in body or not isinstance(body.get("data"), list):
raise ValueError("An object must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(UpdateRecordHeader, key), headers_map.get(key))
request = BodyWrapper()
records = []
for elem in body.get("data"):
rec = Record()
rec.set_id(elem.get("id"))
elem.pop("id")
for key in elem:
rec.add_key_value(key, elem.get(key))
records.append(rec)
request.set_data(records)
triggers = []
if "triggers" in body:
triggers = body.get("triggers")
request.set_trigger(trigger=triggers)
response = RecordOperations().update_records(module_api_name=module_name, request=request,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Upsert(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, body: dict = None,
headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if headers_map is None:
headers_map = {}
if body is None:
raise ValueError("An object must be provided")
if "data" not in body or not isinstance(body.get("data"), list):
raise ValueError("An object must be provided")
if "duplicate_check_fields" not in body or not isinstance(body.get("duplicate_check_fields"), list):
raise ValueError("An object must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(UpsertRecordsHeader, key), headers_map.get(key))
request = BodyWrapper()
records = []
for elem in body.get("data"):
rec = Record()
for key in elem:
rec.add_key_value(key, elem.get(key))
records.append(rec)
request.set_data(records)
request.set_duplicate_check_fields(body.get("duplicate_check_fields"))
triggers = []
if "triggers" in body:
triggers = body.get("triggers")
request.set_trigger(trigger=triggers)
response = RecordOperations().upsert_records(module_api_name=module_name, request=request,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Delete(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, record_ids: list = None,
params_map: dict = None, headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if record_ids is None or not isinstance(record_ids, list):
raise ValueError("A list of record IDs must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(DeleteRecordsHeader, key), headers_map.get(key))
params = ParameterMap()
for key in params_map:
params.add(getattr(DeleteRecordsParam, key), params_map.get(key))
for record_id in record_ids:
params.add(DeleteRecordsParam.ids, record_id)
response = RecordOperations().delete_records(module_api_name=module_name, param_instance=params,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class ListDeleted(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, params_map: dict = None,
headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(GetDeletedRecordsHeader, key), headers_map.get(key))
params = ParameterMap()
for key in params_map:
params.add(getattr(GetDeletedRecordsParam, key), params_map.get(key))
response = RecordOperations().get_deleted_records(module_api_name=module_name, param_instance=params,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Search(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, params_map: dict = None,
headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(SearchRecordsHeader, key), headers_map.get(key))
params = ParameterMap()
for key in params_map:
params.add(getattr(SearchRecordsParam, key), params_map.get(key))
response = RecordOperations().search_records(module_api_name=module_name, param_instance=params,
header_instance=headers)
return response
except Exception as error:
print(error)
raise error | zohocrm-prefect-tasks | /zohocrm_prefect_tasks-0.0.10-py3-none-any.whl/zohocrm_prefect_tasks/tasks/records.py | records.py |
from zcrmsdk.src.com.zoho.crm.api.notes import *
from zcrmsdk.src.com.zoho.crm.api.notes.note import Note
from zcrmsdk.src.com.zoho.crm.api.record import Record
from zcrmsdk.src.com.zoho.crm.api import HeaderMap, ParameterMap
from prefect import Task
from prefect.utilities.tasks import defaults_from_attrs
from typing import Any
from ..client import ApiClient
class Create(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", body: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if body is None:
raise ValueError("An object must be provided")
if "data" not in body or not isinstance(body.get("data"), list):
raise ValueError("An object must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
request = BodyWrapper()
notes = []
for elem in body.get("data"):
note = Note()
note.set_note_title(elem.get('title', ''))
note.set_note_content(elem.get('content', ''))
parent_record = Record()
parent_record.set_id(elem.get('id', None))
note.set_parent_id(parent_record)
note.set_se_module(elem.get('module', None))
notes.append(note)
request.set_data(notes)
response = NotesOperations().create_notes(request=request)
return response
except Exception as error:
print(error)
raise error
class List(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", headers_map: dict = None,
params_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(GetNotesHeader, key), headers_map.get(key))
"""TODO: Should accept a list of ids"""
params = ParameterMap()
for key in params_map:
params.add(getattr(GetNotesParam, key), params_map.get(key))
response = NotesOperations().get_notes(param_instance=params, header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Fetch(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", note_id: int = None, headers_map: dict = None,
params_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if note_id is None:
raise ValueError("A note ID must be provided")
if headers_map is None:
headers_map = {}
if params_map is None:
params_map = {}
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
headers = HeaderMap()
for key in headers_map:
headers.add(getattr(GetNoteHeader, key), headers_map.get(key))
params = ParameterMap()
for key in params_map:
params.add(getattr(GetNoteParam, key), params_map.get(key))
response = NotesOperations().get_note(id=note_id, param_instance=params, header_instance=headers)
return response
except Exception as error:
print(error)
raise error
class Update(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", body: dict = None, headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if body is None:
raise ValueError("An object must be provided")
if "data" not in body or not isinstance(body.get("data"), list):
raise ValueError("An object must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
request = BodyWrapper()
notes = []
for elem in body.get("data"):
note = Note()
note.set_id(elem.get("id"))
elem.pop("id")
note.set_note_title(elem.get('title', ''))
note.set_note_content(elem.get('content', ''))
parent_record = Record()
parent_record.set_id(elem.get('id', None))
note.set_parent_id(parent_record)
note.set_se_module(elem.get('module', None))
notes.append(note)
request.set_data(notes)
response = NotesOperations().update_notes(request=request)
return response
except Exception as error:
print(error)
raise error
class Delete(Task):
def __init__(self, **kwargs: Any):
super().__init__(**kwargs)
@defaults_from_attrs()
def run(self, log_path: str = "ZOHO_LOG_PATH", store_path: str = "ZOHO_STORE_PATH",
resource_path: str = "ZOHO_RESOURCE_PATH", email: str = "ZOHO_USER_ID", env: str = "ZOHO_DATA_CENTER",
client_id: str = "ZOHO_CLIENT_ID", client_secret: str = "ZOHO_CLIENT_SECRET",
refresh_token: str = "ZOHO_REFRESH_TOKEN", module_name: str = None, record_ids: list = None,
params_map: dict = None, headers_map: dict = None):
if log_path is None:
raise ValueError("A log path must be provided.")
if store_path is None:
raise ValueError("A store path must be provided.")
if resource_path is None:
raise ValueError("A resource path must be provided.")
if email is None:
raise ValueError("An email must be provided.")
if client_id is None:
raise ValueError("A client id must be provided.")
if client_secret is None:
raise ValueError("A client secret must be provided")
if refresh_token is None:
raise ValueError("A refresh token must be provided")
if module_name is None:
raise ValueError("A module name must be provided")
if record_ids is None or not isinstance(record_ids, list):
raise ValueError("A list of record IDs must be provided")
try:
api_client = ApiClient(log_path, store_path, resource_path, email, env, client_id, client_secret,
refresh_token)
params = ParameterMap()
for record_id in record_ids:
params.add(DeleteNotesParam.ids, record_id)
response = NotesOperations().delete_notes(param_instance=params)
return response
except Exception as error:
print(error)
raise error | zohocrm-prefect-tasks | /zohocrm_prefect_tasks-0.0.10-py3-none-any.whl/zohocrm_prefect_tasks/tasks/notes.py | notes.py |
import json
import requests
from urllib.parse import urlencode
from zohocrm.exceptions import UnknownError, InvalidModuleError, NoPermissionError, MandatoryKeyNotFoundError, \
InvalidDataError, MandatoryFieldNotFoundError
BASE_URL = 'https://www.zohoapis.com/crm/v2/'
ZOHOCRM_AUTHORIZE_URL = 'https://accounts.zoho.com/oauth/v2/auth'
ZOHOCRM_REQUEST_TOKEN_URL = 'https://accounts.zoho.com/oauth/v2/token'
ZOHOCRM_REFRESH_TOKEN_URL = "https://accounts.zoho.com/oauth/v2/token"
READ_MODULE_LIST = ['leads', 'accounts', 'contacts', 'deals', 'campaigns', 'tasks', 'cases', 'events', 'calls',
'solutions', 'products', 'vendors', 'pricebooks', 'quotes', 'salesorders', 'purchaseorders',
'invoices', 'custom', 'notes', 'approvals', 'dashboards', 'search', 'activities']
# module purchaseorders, 'invoices', salesorders and quotes are temporarily disable for writing this
# due to the complexity of the module
WRITE_MODULE_LIST = ['leads', 'accounts', 'contacts', 'deals', 'campaigns', 'tasks', 'cases', 'events', 'calls',
'solutions', 'products', 'vendors', 'pricebooks', 'purchaseorders', 'custom', 'notes']
class Client(object):
def __init__(self, client_id, client_secret, redirect_uri, scope, access_type, refresh_token=None):
self.code = None
self.scope = scope
self.access_type = access_type
self.client_id = client_id
self._refresh_token = refresh_token
self.redirect_uri = redirect_uri
self.client_secret = client_secret
self.access_token = None
def get_authorization_url(self):
"""
:return:
"""
params = {'scope': ','.join(self.scope), 'client_id': self.client_id, 'access_type': 'offline',
'redirect_uri': self.redirect_uri, 'response_type': 'code', 'prompt':'consent'}
url = ZOHOCRM_AUTHORIZE_URL + '?' + urlencode(params)
return url
def exchange_code(self, code):
"""
:param code:
:return:
"""
params = {'code': code, 'client_id': self.client_id, 'client_secret': self.client_secret,
'redirect_uri': self.redirect_uri, 'grant_type': 'authorization_code'}
url = ZOHOCRM_REQUEST_TOKEN_URL + '?' + urlencode(params)
return self._post(url)
def refresh_token(self):
"""
:return:
"""
params = {'refresh_token': self._refresh_token, 'client_id': self.client_id,
'client_secret': self.client_secret, 'grant_type': 'refresh_token'}
url = ZOHOCRM_REFRESH_TOKEN_URL + '?' + urlencode(params)
response = self._post(url)
return response
def set_access_token(self, token):
"""
:param token:
:return:
"""
if isinstance(token, dict):
self.access_token = token['access_token']
if 'refresh_token' in token:
self._refresh_token = token['refresh_token']
else:
self.access_token = token
def get_module_list(self):
"""
:return:
"""
url = BASE_URL + "settings/modules"
response = self._get(url)
if response:
return [i for i in response['modules'] if i['api_supported'] is True]
else:
return None
def get_fields_list(self, module):
"""
:param module:
:return:
"""
params = {'module': module}
url = BASE_URL + "settings/fields" + "?" + urlencode(params)
response = self._get(url)
if response:
try:
result = [
{
'id': i['id'],
'label': i['field_label'],
'api_name': i['api_name'],
'max_length': i['length'],
'read_only': i['read_only'],
'data_type': i['data_type'],
'currency': i['currency'],
'lookup': i['lookup'],
'pick_list_values': i['pick_list_values']
} for i in response['fields']]
except Exception as e:
print(e)
else:
return None
return result
def create_webhook(self, module, gearplug_webhook_id, notify_url):
"""
:param module:
:param gearplug_webhook_id:
:param notify_url:
:return:
"""
endpoint = 'actions/watch'
event = ["{0}.create".format(module)]
data = [{'notify_url': notify_url, 'channel_id': gearplug_webhook_id, 'events': event, }]
data = {'watch': data}
url = BASE_URL + endpoint
try:
response = self._post(url, data=data)
except Exception as e:
return False
if response['watch'][-1]['code'] == "SUCCESS":
return response['watch'][-1]['details']
else:
return False
def delete_webhook(self, webhook_id, module):
"""
:return:
"""
events = ["{0}.create".format(module)]
data = [{'channel_id': webhook_id, 'events': events, '_delete_events': 'true'}]
data = {'watch': data}
endpoint = 'actions/watch'
url = BASE_URL + endpoint
response = self._patch(url, data=data)
if response['watch'][-1]['code'] == "SUCCESS":
return response['watch'][-1]['details']
else:
return False
def get_records(self, module_name):
"""
:param module_name: module from which to read record (api_name)
:return:
"""
if module_name not in READ_MODULE_LIST:
return None
url = BASE_URL + str(module_name)
response = self._get(url)
all_data = [response['data']]
while response['info']['more_records'] == 'true':
page = response['info']['page']
response = self._get(url, params={'page': int(page) + 1})
all_data.append(response['data'])
return all_data
def get_specific_record(self, module, id):
"""
:return:
"""
endpoint = '{0}/{1}'.format(module, id)
url = BASE_URL + str(endpoint)
response = self._get(url)
if response and 'data' in response and len(response['data']) > 0 and response['data'][0]['id'] == id:
return response['data']
else:
return False
def get_all_active_users(self):
"""
:return: all active users
"""
endpoint = 'users?type=ActiveUsers'
url = BASE_URL + str(endpoint)
response = self._get(url)
if response and 'users' in response and isinstance(response['users'], list) and len(response['users']) > 0:
return response['users']
else:
return False
def get_all_organizations(self):
"""
:return: all oganizations
"""
endpoint = 'org'
url = BASE_URL + str(endpoint)
response = self._get(url)
if response and 'org' in response and isinstance(response['org'], list) and len(response['users']) > 0:
return response['org']
else:
return False
def insert_record(self, module_name, data):
"""
:param module_name:
:param data:
:return:
"""
if module_name.lower() not in WRITE_MODULE_LIST:
return None
url = BASE_URL + str(module_name)
data = dict(data)
for k, v in data.items():
if v == 'False':
data[k] = False
if v == 'True':
data[k] = True
formatted_data = {'data': []}
formatted_data['data'].append(data)
return self._post(url, data=formatted_data)
def _get(self, endpoint, params=None):
headers = {'Authorization': 'Zoho-oauthtoken {0}'.format(self.access_token), }
response = requests.get(endpoint, params=params, headers=headers)
return self._parse(response, method='get')
def _post(self, endpoint, params=None, data=None):
headers = {'Authorization': 'Zoho-oauthtoken {0}'.format(self.access_token), }
response = requests.post(endpoint, params=params, json=data, headers=headers)
return self._parse(response, method='post')
def _put(self, endpoint, params=None, data=None):
headers = {'Authorization': 'Zoho-oauthtoken {0}'.format(self.access_token), }
response = requests.put(endpoint, params=params, json=data, headers=headers)
return self._parse(response, method='put')
def _patch(self, endpoint, params=None, data=None):
headers = {'Authorization': 'Zoho-oauthtoken {0}'.format(self.access_token), }
response = requests.patch(endpoint, params=params, json=data, headers=headers)
return self._parse(response, method='patch')
def _delete(self, endpoint, params=None):
headers = {'Authorization': 'Zoho-oauthtoken {0}'.format(self.access_token), }
response = requests.delete(endpoint, params=params, headers=headers)
return self._parse(response, method='delete')
def _parse(self, response, method=None):
status_code = response.status_code
if 'application/json' in response.headers['Content-Type']:
r = response.json()
else:
r = response.text
if status_code in (200, 201):
return r
if status_code == 204:
return None
message = None
try:
if 'message' in r:
message = r['message']
except Exception:
message = 'No error message.'
if status_code == 400:
raise InvalidModuleError(message)
if status_code == 401:
raise NoPermissionError(status_code)
if status_code == 201:
raise MandatoryFieldNotFoundError(message)
elif status_code == 202:
raise InvalidDataError(message)
elif status_code == 400:
raise InvalidDataError(message) | zohocrm-python | /zohocrm_python-0.1.6.tar.gz/zohocrm_python-0.1.6/zohocrm/client.py | client.py |
# Zoho CRM API
This API is for people who are having trouble with the official Zoho API.
* Supports Zoho API v2
For full documentation visit [zoho-crm-api.readthedocs.io](https://zoho-crm-api.readthedocs.io).
## Quickstart
Install:
```
$ pip install zohocrmapi
```
Get a Client ID, Client Secret, and Grant Token from Zoho, then create a `ZohoCRMRestClient` object and generate an access token:
```python
from zohocrm import ZohoCRMRestClient
client_id = '<paste your Zoho client id>'
client_secret = '<paste your Zoho client secret>'
redirect_uri = '<paste your Redirect URL>'
grant_token = '<paste your newly created token>'
zoho_client = ZohoCRMRestClient(client_id, client_secret, redirect_uri)
zoho_client.generate_access_token(grant_token)
```
Download a Record from the API, for example a Contact:
```python
from zohocrm import ZohoCRMContact
contact_id = 1234023423424
contact = ZohoCRMContact.fetch(
zoho_client,
contact_id
)
```
Create a new record:
```python
contact = ZohoCRMContact(zoho_client)
contact.Last_Name = "John"
```
Update or save a Record:
```python
# no id? insert
contact.save() # or contact.insert()
# id = <int>? update
contact.id = 12232423423
contact.save() # or contact.update()
```
Delete a Record:
```python
# delete loaded record
contact.delete()
# delete non-loaded record from ID
ZohoCRMContact.delete_id(zoho_client, contact_id)
```
| zohocrmapi | /zohocrmapi-0.0.11.tar.gz/zohocrmapi-0.0.11/README.md | README.md |
import time
import requests
# import json
class ZohoCRMOAuthToken:
"""Zoho access token."""
access_token = None
refresh_token = None
api_domain = None
token_type = None
expiry_timestamp = None
def __init__(self, json_data):
"""Initialize."""
self.load_json(json_data)
def to_json(self):
"""Output to JSON."""
data = {
'access_token': self.access_token,
'api_domain': self.api_domain,
'token_type': self.token_type,
'expiry_timestamp': self.expiry_timestamp,
}
if self.refresh_token is not None:
data['refresh_token'] = self.refresh_token
return data
def load_json(self, json_data):
"""Convert from JSON."""
self.access_token = json_data['access_token']
self.api_domain = json_data['api_domain']
self.token_type = json_data['token_type']
if 'expires_in' in json_data:
self.expiry_timestamp = json_data['expires_in'] + time.time()
if 'expiry_timestamp' in json_data:
self.expiry_timestamp = json_data['expiry_timestamp']
if 'refresh_token' in json_data:
self.refresh_token = json_data['refresh_token']
def is_expired(self):
"""Return True if this code is expired."""
return time.time() >= self.expiry_timestamp
class ZohoCRMRestClient:
"""Zoho rest client."""
api_base_url = 'https://www.zohoapis.com'
api_version = 'v2'
accounts_url = 'https://accounts.zoho.com'
client_id = None
client_secret = None
redirect_uri = None
oauth_access_token = None
oauth_refresh_token = None
def __init__(self, client_id, client_secret, redirect_uri):
"""Initialize REST client."""
self.client_id = client_id,
self.client_secret = client_secret
self.redirect_uri = redirect_uri
def generate_access_token(self, grant_token):
"""Generate access token."""
url = '{accounts_url}/oauth/{api_version}/token'.format(
accounts_url=self.accounts_url,
api_version=self.api_version
)
post_parameters = {
'grant_type': 'authorization_code',
'client_id': self.client_id,
'client_secret': self.client_secret,
'redirect_uri': self.redirect_uri,
'code': grant_token,
}
response = requests.post(url, data=post_parameters)
# print(response.status_code)
# print(json.dumps(response.json(), indent=4))
if response.status_code == 200:
response_json = response.json()
if 'error' not in response_json:
access_token = ZohoCRMOAuthToken(response.json())
self.oauth_access_token = access_token
return access_token
else:
raise ValueError(response_json['error'])
else:
raise ValueError(response_json['message'])
def generate_refresh_token(self):
"""Generate access token."""
url = '{accounts_url}/oauth/{api_version}/token'.format(
accounts_url=self.accounts_url,
api_version=self.api_version
)
query_parameters = {
'refresh_token': self.oauth_access_token.refresh_token,
'client_id': self.client_id,
'client_secret': self.client_secret,
'grant_type': 'refresh_token'
}
response = requests.post(url, params=query_parameters)
# print(response.status_code)
# print(json.dumps(response.json(), indent=4))
if response.status_code == 200:
response_json = response.json()
if 'error' not in response_json:
access_token = ZohoCRMOAuthToken(response.json())
self.oauth_refresh_token = access_token
return access_token
else:
raise ValueError(response_json['error'])
else:
raise ValueError(response_json['message'])
def is_logged_in(self, access_token):
"""Return true if access_token is active."""
return access_token.is_expired() is False
def api_fetch(self, endpoint, method='GET', headers=None, params=None, json_data=None):
"""Fetch from endpoint."""
url = '{api_base_url}/crm/{api_version}/{endpoint}'.format(
api_base_url=self.api_base_url,
api_version=self.api_version,
endpoint=endpoint
)
if headers is None:
headers = {}
if self.oauth_refresh_token is None:
headers['Authorization'] = 'Zoho-oauthtoken {}'.format(self.oauth_access_token.access_token)
else:
headers['Authorization'] = 'Zoho-oauthtoken {}'.format(self.oauth_refresh_token.access_token)
response = requests.request(
method,
url=url,
headers=headers,
params=params,
json=json_data
)
# print(response.status_code)
# print(json.dumps(response.json(), indent=4))
return response
class ZohoCRMRecord:
"""Zoho Record."""
_module_name = ''
_rest_client = None
def __init__(self, zoho_rest_client):
"""Initialize."""
self._rest_client = zoho_rest_client
def clear(self):
"""Clean the object."""
for property, value in vars(self).items():
if property[0] != '_':
setattr(self, property, None)
def to_json(self):
"""To JSON."""
data = {}
for property, value in vars(self).items():
if property[0] != '_':
data[property] = value
return data
def from_json(self, json_data):
"""From JSON."""
for key, value in json_data.items():
setattr(self, key, value)
def save(self):
"""Save contact."""
if hasattr(self, 'id') and self.id is not None:
self.update()
else:
self.insert()
def insert(self):
"""Insert."""
data = {}
for property, value in vars(self).items():
if property[0] != '_':
data[property] = value
# print(json.dumps({'data': [data]}, indent=4))
response = self._rest_client.api_fetch(
'{module_name}'.format(module_name=self._module_name),
method='POST',
json_data={'data': [data]}
)
if response.status_code == 201:
response_json = response.json()
self.id = response_json['data'][0]['details']['id']
else:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
def update(self):
"""Update."""
data = self.to_json()
response = self._rest_client.api_fetch(
'{module_name}/{record_id}'.format(module_name=self._module_name, record_id=self.id),
method='PUT',
json_data={'data': [data]}
)
if response.status_code != 200:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
def delete(self):
"""Delete."""
response = self._rest_client.api_fetch(
'{module_name}/{record_id}'.format(module_name=self._module_name, record_id=self.id),
method='DELETE'
)
if response.status_code == 200:
self.id = None
else:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
@classmethod
def fetch(cls, zoho_rest_client, id):
"""Fetch by ID."""
print(cls._module_name)
obj = cls(zoho_rest_client)
response = zoho_rest_client.api_fetch(
'{module_name}/{id}'.format(module_name=cls._module_name, id=id),
method='GET'
)
if response.status_code == 200:
obj.from_json(response.json()['data'][0])
return obj
else:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
@classmethod
def delete_id(cls, zoho_rest_client, id):
"""Delete from ID."""
response = zoho_rest_client.api_fetch(
'{module_name}/{record_id}'.format(module_name=cls._module_name, record_id=id),
method='DELETE'
)
if response.status_code != 200:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
class ZohoCRMUser(ZohoCRMRecord):
"""Zoho CRM User."""
_module_name = 'users'
_rest_client = None
def fetch_current_user(self, access_token):
"""Fetch current User."""
self.clear()
response = self._rest_client.api_fetch(
access_token,
'users',
params={
'type': 'CurrentUser'
}
)
if response.status_code == 200:
self.from_json(response.json()['users'][0])
else:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
def fetch_user(self, access_token, user_id):
"""Fetch User."""
self.clear()
response = self._rest_client.api_fetch(
access_token,
'users/{user_id}'.format(user_id=user_id),
)
if response.status_code == 200:
self.from_json(response.json()['users'][0])
else:
response_json = response.json()
if 'data' in response_json:
raise ValueError(response_json['data'][0]['message'])
else:
raise ValueError(response_json['message'])
class ZohoCRMContact(ZohoCRMRecord):
"""Zoho CRM Contact."""
_module_name = 'Contacts'
class ZohoCRMVendor(ZohoCRMRecord):
"""Zoho CRM Vendor."""
_module_name = 'Vendors'
class ZohoCRMLead(ZohoCRMRecord):
"""Zoho CRM Lead."""
_module_name = 'Leads'
class ZohoCRMAccount(ZohoCRMRecord):
"""Zoho CRM Account."""
_module_name = 'Deal'
class ZohoCRMDeal(ZohoCRMRecord):
"""Zoho CRM Account."""
_module_name = 'Deals'
class ZohoCRMCampaign(ZohoCRMRecord):
"""Zoho CRM Campaign."""
_module_name = 'Campaigns'
class ZohoCRMTask(ZohoCRMRecord):
"""Zoho CRM Task."""
_module_name = 'Tasks'
class ZohoCRMCase(ZohoCRMRecord):
"""Zoho CRM Case."""
_module_name = 'Cases'
class ZohoCRMEvent(ZohoCRMRecord):
"""Zoho CRM Event."""
_module_name = 'Events'
class ZohoCRMCall(ZohoCRMRecord):
"""Zoho CRM Call."""
_module_name = 'Calls'
class ZohoCRMSolution(ZohoCRMRecord):
"""Zoho CRM Solution."""
_module_name = 'Solutions'
class ZohoCRMProduct(ZohoCRMRecord):
"""Zoho CRM Product."""
_module_name = 'Products'
class ZohoCRMQuote(ZohoCRMRecord):
"""Zoho CRM Quote."""
_module_name = 'Quotes'
class ZohoCRMInvoice(ZohoCRMRecord):
"""Zoho CRM Invoice."""
_module_name = 'Invoices'
class ZohoCRMCustom(ZohoCRMRecord):
"""Zoho CRM Custom."""
_module_name = 'Custom'
class ZohoCRMActivity(ZohoCRMRecord):
"""Zoho CRM Activity."""
_module_name = 'Activities'
class ZohoCRMPriceBook(ZohoCRMRecord):
"""Zoho CRM Price Book."""
_module_name = 'pricebooks'
class ZohoCRMSalesOrder(ZohoCRMRecord):
"""Zoho CRM Sales Order."""
_module_name = 'salesorders'
class ZohoCRMPurchaseOrder(ZohoCRMRecord):
"""Zoho CRM Purchase Order."""
_module_name = 'purchaseorders'
class ZohoCRMNote(ZohoCRMRecord):
"""Zoho CRM Note."""
_module_name = 'notes' | zohocrmapi | /zohocrmapi-0.0.11.tar.gz/zohocrmapi-0.0.11/zohocrm/__init__.py | __init__.py |
# ZOHO CRM PYTHON SDK 2.0
## Table Of Contents
* [Overview](#overview)
* [Registering a Zoho Client](#registering-a-zoho-client)
* [Environmental Setup](#environmental-setup)
* [Including the SDK in your project](#including-the-sdk-in-your-project)
* [Persistence](#token-persistence)
* [DataBase Persistence](#database-persistence)
* [File Persistence](#file-persistence)
* [Custom Persistence](#custom-persistence)
* [Configuration](#configuration)
* [Initialization](#initializing-the-application)
* [Class Hierarchy](#class-hierarchy)
* [Responses And Exceptions](#responses-and-exceptions)
* [Threading](#threading-in-the-python-sdk)
* [Multithreading in a Multi-User App](#multithreading-in-a-multi-user-app)
* [Multi-threading in a Single User App](#multi-threading-in-a-single-user-app)
* [Sample Code](#sdk-sample-code)
## Overview
Zoho CRM PYTHON SDK offers a way to create client Python applications that can be integrated with Zoho CRM.
## Registering a Zoho Client
Since Zoho CRM APIs are authenticated with OAuth2 standards, you should register your client app with Zoho. To register your app:
- Visit this page [https://api-console.zoho.com](https://api-console.zoho.com)
- Click on `ADD CLIENT`.
- Choose the `Client Type`.
- Enter **Client Name**, **Client Domain** or **Homepage URL** and **Authorized Redirect URIs** then click `CREATE`.
- Your Client app will be created.
- Select the created OAuth client.
- Generate grant token by providing the necessary scopes, time duration (the duration for which the generated token is valid) and Scope Description.
## Environmental Setup
Python SDK is installable through **pip**. **pip** is a tool for dependency management in Python. SDK expects the following from the client app.
- Client app must have Python(version 3 and above)
- Python SDK must be installed into client app through **pip**.
## Including the SDK in your project
- Install **Python** from [python.org](https://www.python.org/downloads/) (if not installed).
- Install **Python SDK**
- Navigate to the workspace of your client app.
- Run the command below:
```sh
pip install zohocrmsdk2_0==5.x.x
```
- The Python SDK will be installed in your client application.
## Token Persistence
Token persistence refers to storing and utilizing the authentication tokens that are provided by Zoho. There are three ways provided by the SDK in which persistence can be utilized. They are DataBase Persistence, File Persistence and Custom Persistence.
### Table of Contents
- [DataBase Persistence](#database-persistence)
- [File Persistence](#file-persistence)
- [Custom Persistence](#custom-persistence)
### Implementing OAuth Persistence
Once the application is authorized, OAuth access and refresh tokens can be used for subsequent user data requests to Zoho CRM. Hence, they need to be persisted by the client app.
The persistence is achieved by writing an implementation of the inbuilt Abstract Base Class **[TokenStore](zcrmsdk/src/com/zoho/api/authenticator/store/token_store.py)**, which has the following callback methods.
- **get_token(self, user, [token](zcrmsdk/src/com/zoho/api/authenticator/token.py))** - invoked before firing a request to fetch the saved tokens. This method should return implementation of inbuilt **Token Class** object for the library to process it.
- **save_token(self, user, [token](zcrmsdk/src/com/zoho/api/authenticator/token.py))** - invoked after fetching access and refresh tokens from Zoho.
- **delete_token(self, [token](zcrmsdk/src/com/zoho/api/authenticator/token.py))** - invoked before saving the latest tokens.
- **get_tokens(self)** - The method to get the all the stored tokens.
- **delete_tokens(self)** - The method to delete all the stored tokens.
- **get_token_by_id(self, id, token)** - The method to retrieve the user's token details based on unique ID.
Note:
- user is an instance of UserSignature Class.
- token is an instance of Token Class.
### DataBase Persistence
In case the user prefers to use default DataBase persistence, **MySQL** can be used.
- The database name should be **zohooauth**.
- There must be a table name **oauthtoken** with the following columns.
- id int(11)
- user_mail varchar(255)
- client_id varchar(255)
- client_secret varchar(255)
- refresh_token varchar(255)
- access_token varchar(255)
- grant_token varchar(255)
- expiry_time varchar(20)
- redirect_url varchar(255)
Note:
- Custom database name and table name can be set in DBStore instance.
#### MySQL Query
```sql
CREATE TABLE oauthtoken (
id varchar(255) NOT NULL,
user_mail varchar(255) NOT NULL,
client_id varchar(255),
client_secret varchar(255),
refresh_token varchar(255),
access_token varchar(255),
grant_token varchar(255),
expiry_time varchar(20),
redirect_url varchar(255),
primary key (id)
)
alter table oauthtoken auto_increment = 1;
```
#### Create DBStore object
```python
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore
"""
DBStore takes the following parameters
1 -> DataBase host name. Default value "localhost"
2 -> DataBase name. Default value "zohooauth"
3 -> DataBase user name. Default value "root"
4 -> DataBase password. Default value ""
5 -> DataBase port number. Default value "3306"
6-> DataBase table name . Default value "oauthtoken"
"""
store = DBStore()
store = DBStore(host='host_name', database_name='database_name', user_name='user_name', password='password', port_number='port_number', table_name = "table_name")
```
### File Persistence
In case of File Persistence, the user can persist tokens in the local drive, by providing the absolute file path to the FileStore object.
- The File contains
- id
- user_mail
- client_id
- client_secret
- refresh_token
- access_token
- grant_token
- expiry_time
- redirect_url
#### Create FileStore object
```python
from zcrmsdk.src.com.zoho.api.authenticator.store import FileStore
"""
FileStore takes the following parameter
1 -> Absolute file path of the file to persist tokens
"""
store = FileStore(file_path='/Users/username/Documents/python_sdk_token.txt')
```
### Custom Persistence
To use Custom Persistence, you must implement **[TokenStore](zcrmsdk/src/com/zoho/api/authenticator/store/token_store.py)** and override the methods.
```python
from zcrmsdk.src.com.zoho.api.authenticator.store import TokenStore
class CustomStore(TokenStore):
def __init__(self):
pass
def get_token(self, user, token):
"""
Parameters:
user (UserSignature) : A UserSignature class instance.
token (Token) : A Token (zcrmsdk.src.com.zoho.api.authenticator.OAuthToken) class instance
"""
# Add code to get the token
return None
def save_token(self, user, token):
"""
Parameters:
user (UserSignature) : A UserSignature class instance.
token (Token) : A Token (zcrmsdk.src.com.zoho.api.authenticator.OAuthToken) class instance
"""
# Add code to save the token
def delete_token(self, token):
"""
Parameters:
token (Token) : A Token (zcrmsdk.src.com.zoho.api.authenticator.OAuthToken) class instance
"""
# Add code to delete the token
def get_tokens(self):
"""
Returns:
list: List of stored tokens
"""
# Add code to get all the stored tokens
def delete_tokens(self):
# Add code to delete all the stored tokens
def get_token_by_id(id, token):
"""
The method to get id token details.
Parameters:
id (String) : A String id.
token (Token) : A Token class instance.
Returns:
Token : A Token class instance representing the id token details.
"""
```
## Configuration
Before you get started with creating your Python application, you need to register your client and authenticate the app with Zoho.
| Mandatory Keys | Optional Keys |
| :---------------- | :------------ |
| user | logger |
| environment | store |
| token | sdk_config |
| | proxy |
| | resource_path |
----
- Create an instance of **UserSignature** Class that identifies the current user.
```python
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
# Create an UserSignature instance that takes user Email as parameter
user = UserSignature(email='[email protected]')
```
- Configure the API environment which decides the domain and the URL to make API calls.
```python
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter
"""
Configure the environment
which is of the pattern Domain.Environment
Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
Available Environments: PRODUCTION(), DEVELOPER(), SANDBOX()
"""
environment = USDataCenter.PRODUCTION()
```
- Create an instance of **OAuthToken** with the information that you get after registering your Zoho client.
```python
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
"""
Create a Token instance that takes the following parameters
1 -> OAuth client id.
2 -> OAuth client secret.
3 -> Grant token.
4 -> Refresh token.
5 -> OAuth redirect URL. Default value is None
6 -> id
7 -> Access token
"""
token = OAuthToken(client_id='clientId', client_secret='clientSecret', grant_token='grant_token', refresh_token="refresh_token", redirect_url='redirectURL', id="id", access_token="access_token")
```
- Create an instance of **Logger** Class to log exception and API information. By default, the SDK constructs a Logger instance with level - INFO and file_path - (sdk_logs.log, created in the current working directory)
```python
from zcrmsdk.src.com.zoho.api.logger import Logger
"""
Create an instance of Logger Class that takes two parameters
1 -> Level of the log messages to be logged. Can be configured by typing Logger.Levels "." and choose any level from the list displayed.
2 -> Absolute file path, where messages need to be logged.
"""
logger = Logger.get_instance(level=Logger.Levels.INFO, file_path="/Users/user_name/Documents/python_sdk_log.log")
```
- Create an instance of **TokenStore** to persist tokens, used for authenticating all the requests. By default, the SDK creates the sdk_tokens.txt created in the current working directory) to persist the tokens.
```python
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore, FileStore
"""
DBStore takes the following parameters
1 -> DataBase host name. Default value "localhost"
2 -> DataBase name. Default value "zohooauth"
3 -> DataBase user name. Default value "root"
4 -> DataBase password. Default value ""
5 -> DataBase port number. Default value "3306"
6 -> DataBase table name. Default value "oauthtoken"
"""
store = DBStore()
#store = DBStore(host='host_name', database_name='database_name', user_name='user_name', password='password', port_number='port_number', table_name = "table_name")
"""
FileStore takes the following parameter
1 -> Absolute file path of the file to persist tokens
"""
#store = FileStore(file_path='/Users/username/Documents/python_sdk_tokens.txt')
```
- Create an instance of SDKConfig containing SDK configurations.
```python
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
"""
By default, the SDK creates the SDKConfig instance
auto_refresh_fields (Default value is False)
if True - all the modules' fields will be auto-refreshed in the background, every hour.
if False - the fields will not be auto-refreshed in the background. The user can manually delete the file(s) or refresh the fields using methods from ModuleFieldsHandler(zcrmsdk/src/com/zoho/crm/api/util/module_fields_handler.py)
pick_list_validation (Default value is True)
A boolean field that validates user input for a pick list field and allows or disallows the addition of a new value to the list.
if True - the SDK validates the input. If the value does not exist in the pick list, the SDK throws an error.
if False - the SDK does not validate the input and makes the API request with the user’s input to the pick list
connect_timeout (Default value is None)
A Float field to set connect timeout
read_timeout (Default value is None)
A Float field to set read timeout
"""
config = SDKConfig(auto_refresh_fields=True, pick_list_validation=False, connect_timeout=None, read_timeout=None)
```
- The path containing the absolute directory path to store user specific files containing module fields information. By default, the SDK stores the user-specific files within a folder in the current working directory.
```python
resource_path = '/Users/user_name/Documents/python-app'
```
- Create an instance of RequestProxy containing the proxy properties of the user.
```python
from zcrmsdk.src.com.zoho.crm.api.request_proxy import RequestProxy
"""
RequestProxy takes the following parameters
1 -> Host
2 -> Port Number
3 -> User Name. Default value is None
4 -> Password. Default value is an empty string
"""
request_proxy = RequestProxy(host='proxyHost', port=80)
request_proxy = RequestProxy(host='proxyHost', port=80, user='userName', password='password')
```
## Initializing the Application
Initialize the SDK using the following code.
```python
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore, FileStore
from zcrmsdk.src.com.zoho.api.logger import Logger
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
class SDKInitializer(object):
@staticmethod
def initialize():
"""
Create an instance of Logger Class that takes two parameters
1 -> Level of the log messages to be logged. Can be configured by typing Logger.Levels "." and choose any level from the list displayed.
2 -> Absolute file path, where messages need to be logged.
"""
logger = Logger.get_instance(level=Logger.Levels.INFO, file_path='/Users/user_name/Documents/python_sdk_log.log')
# Create an UserSignature instance that takes user Email as parameter
user = UserSignature(email='[email protected]')
"""
Configure the environment
which is of the pattern Domain.Environment
Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
Available Environments: PRODUCTION(), DEVELOPER(), SANDBOX()
"""
environment = USDataCenter.PRODUCTION()
"""
Create a Token instance that takes the following parameters
1 -> OAuth client id.
2 -> OAuth client secret.
3 -> Grant token.
4 -> Refresh token.
5 -> OAuth redirect URL.
6 -> id
"""
token = OAuthToken(client_id='clientId', client_secret='clientSecret', grant_token='grant_token', refresh_token="refresh_token", redirect_url='redirectURL', id="id")
"""
Create an instance of TokenStore
1 -> Absolute file path of the file to persist tokens
"""
store = FileStore(file_path='/Users/username/Documents/python_sdk_tokens.txt')
"""
Create an instance of TokenStore
1 -> DataBase host name. Default value "localhost"
2 -> DataBase name. Default value "zohooauth"
3 -> DataBase user name. Default value "root"
4 -> DataBase password. Default value ""
5 -> DataBase port number. Default value "3306"
6-> DataBase table name . Default value "oauthtoken"
"""
store = DBStore()
store = DBStore(host='host_name', database_name='database_name', user_name='user_name', password='password',port_number='port_number', table_name = "table_name")
"""
auto_refresh_fields (Default value is False)
if True - all the modules' fields will be auto-refreshed in the background, every hour.
if False - the fields will not be auto-refreshed in the background. The user can manually delete the file(s) or refresh the fields using methods from ModuleFieldsHandler(zcrmsdk/src/com/zoho/crm/api/util/module_fields_handler.py)
pick_list_validation (Default value is True)
A boolean field that validates user input for a pick list field and allows or disallows the addition of a new value to the list.
if True - the SDK validates the input. If the value does not exist in the pick list, the SDK throws an error.
if False - the SDK does not validate the input and makes the API request with the user’s input to the pick list
connect_timeout (Default value is None)
A Float field to set connect timeout
read_timeout (Default value is None)
A Float field to set read timeout
"""
config = SDKConfig(auto_refresh_fields=True, pick_list_validation=False, connect_timeout=None, read_timeout=None)
"""
The path containing the absolute directory path (in the key resource_path) to store user-specific files containing information about fields in modules.
"""
resource_path = '/Users/user_name/Documents/python-app'
"""
Create an instance of RequestProxy class that takes the following parameters
1 -> Host
2 -> Port Number
3 -> User Name. Default value is None
4 -> Password. Default value is None
"""
request_proxy = RequestProxy(host='host', port=8080)
request_proxy = RequestProxy(host='host', port=8080, user='user', password='password')
"""
Call the static initialize method of Initializer class that takes the following arguments
1 -> UserSignature instance
2 -> Environment instance
3 -> Token instance
4 -> TokenStore instance
5 -> SDKConfig instance
6 -> resource_path
7 -> Logger instance. Default value is None
8 -> RequestProxy instance. Default value is None
"""
Initializer.initialize(user=user, environment=environment, token=token, store=store, sdk_config=config, resource_path=resource_path, logger=logger, proxy=request_proxy)
SDKInitializer.initialize()
```
- You can now access the functionalities of the SDK. Refer to the sample codes to make various API calls through the SDK.
## Class Hierarchy

## Responses and Exceptions
All SDK methods return an instance of the APIResponse class.
After a successful API request, the **get_object()** method returns an instance of the **ResponseWrapper** (for **GET**) or the **ActionWrapper** (for **POST, PUT, DELETE**)
Whenever the API returns an error response, the **get_object()** returns an instance of **APIException** class.
**ResponseWrapper** (for **GET** requests) and **ActionWrapper** (for **POST, PUT, DELETE** requests) are the expected objects for Zoho CRM APIs’ responses
However, some specific operations have different expected objects, such as the following:
- Operations involving records in Tags
- **RecordActionWrapper**
- Getting Record Count for a specific Tag operation
- **CountWrapper**
- Operations involving BaseCurrency
- **BaseCurrencyActionWrapper**
- Lead convert operation
- **ConvertActionWrapper**
- Retrieving Deleted records operation
- **DeletedRecordsWrapper**
- Record image download operation
- **FileBodyWrapper**
- MassUpdate record operations
- **MassUpdateActionWrapper**
- **MassUpdateResponseWrapper**
### GET Requests
- The **get_object()** returns an instance of one of the following classes, based on the return type.
- For **application/json** responses
- **ResponseWrapper**
- **CountWrapper**
- **DeletedRecordsWrapper**
- **MassUpdateResponseWrapper**
- **APIException**
- For **file download** responses
- **FileBodyWrapper**
- **APIException**
### POST, PUT, DELETE Requests
- The **getObject()** returns an instance of one of the following classes
- **ActionWrapper**
- **RecordActionWrapper**
- **BaseCurrencyActionWrapper**
- **MassUpdateActionWrapper**
- **ConvertActionWrapper**
- **APIException**
- These wrapper classes may contain one or a list of instances of the following classes, depending on the response.
- **SuccessResponse Class**, if the request was successful.
- **APIException Class**, if the request was erroneous.
For example, when you insert two records, and one of them was inserted successfully while the other one failed, the ActionWrapper will contain one instance each of the SuccessResponse and APIException classes.
All other exceptions such as SDK anomalies and other unexpected behaviours are thrown under the SDKException class.
## Threading in the Python SDK
Threads in a Python program help you achieve parallelism. By using multiple threads, you can make a Python program run faster and do multiple things simultaneously.
### Multithreading in a Multi-user App
Multi-threading for multi-users is achieved using Initializer's static **switch_user()** method.
switch_user() takes the value initialized previously for user, enviroment, token and sdk_config incase None is passed (or default value is passed). In case of request_proxy, if intended, the value has to be passed again else None(default value) will be taken.
```python
# without proxy
Initializer.switch_user(user=user, environment=environment, token=token, sdk_config=sdk_config_instance)
# with proxy
Initializer.switch_user(user=user, environment=environment, token=token, sdk_config=sdk_config_instance, proxy=request_proxy)
```
Here is a sample code to depict multi-threading for a multi-user app.
```python
import threading
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter, EUDataCenter
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore
from zcrmsdk.src.com.zoho.api.logger import Logger
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from zcrmsdk.src.com.zoho.crm.api.record import *
from zcrmsdk.src.com.zoho.crm.api.request_proxy import RequestProxy
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
class MultiThread(threading.Thread):
def __init__(self, environment, token, user, module_api_name, sdk_config, proxy=None):
super().__init__()
self.environment = environment
self.token = token
self.user = user
self.module_api_name = module_api_name
self.sdk_config = sdk_config
self.proxy = proxy
def run(self):
try:
Initializer.switch_user(user=self.user, environment=self.environment, token=self.token, sdk_config=self.sdk_config, proxy=self.proxy)
print('Getting records for User: ' + Initializer.get_initializer().user.get_email())
response = RecordOperations().get_records(self.module_api_name)
if response is not None:
# Get the status code from response
print('Status Code: ' + str(response.get_status_code()))
if response.get_status_code() in [204, 304]:
print('No Content' if response.get_status_code() == 204 else 'Not Modified')
return
# Get object from response
response_object = response.get_object()
if response_object is not None:
# Check if expected ResponseWrapper instance is received.
if isinstance(response_object, ResponseWrapper):
# Get the list of obtained Record instances
record_list = response_object.get_data()
for record in record_list:
for key, value in record.get_key_values().items():
print(key + " : " + str(value))
# Check if the request returned an exception
elif isinstance(response_object, APIException):
# Get the Status
print("Status: " + response_object.get_status().get_value())
# Get the Code
print("Code: " + response_object.get_code().get_value())
print("Details")
# Get the details dict
details = response_object.get_details()
for key, value in details.items():
print(key + ' : ' + str(value))
# Get the Message
print("Message: " + response_object.get_message().get_value())
except Exception as e:
print(e)
@staticmethod
def call():
logger = Logger.get_instance(level=Logger.Levels.INFO, file_path="/Users/user_name/Documents/python_sdk_log.log")
user1 = UserSignature(email="[email protected]")
token1 = OAuthToken(client_id="clientId1", client_secret="clientSecret1", grant_token="Grant Token", refresh_token="refresh_token", id="id")
environment1 = USDataCenter.PRODUCTION()
store = DBStore()
sdk_config_1 = SDKConfig(auto_refresh_fields=True, pick_list_validation=False)
resource_path = '/Users/user_name/Documents/python-app'
user1_module_api_name = 'Leads'
user2_module_api_name = 'Contacts'
environment2 = EUDataCenter.SANDBOX()
user2 = UserSignature(email="[email protected]")
sdk_config_2 = SDKConfig(auto_refresh_fields=False, pick_list_validation=True)
token2 = OAuthToken(client_id="clientId2", client_secret="clientSecret2",grant_token="GRANT Token", refresh_token="refresh_token", redirect_url="redirectURL", id="id")
request_proxy_user_2 = RequestProxy("host", 8080)
Initializer.initialize(user=user1, environment=environment1, token=token1, store=store, sdk_config=sdk_config_1, resource_path=resource_path, logger=logger)
t1 = MultiThread(environment1, token1, user1, user1_module_api_name, sdk_config_1)
t2 = MultiThread(environment2, token2, user2, user2_module_api_name, sdk_config_2, request_proxy_user_2)
t1.start()
t2.start()
t1.join()
t2.join()
MultiThread.call()
```
- The program execution starts from **call()**.
- The details of **user1** are given in the variables user1, token1, environment1.
- Similarly, the details of another user **user2** are given in the variables user2, token2, environment2.
- For each user, an instance of **MultiThread class** is created.
- When the **start()** is called which in-turn invokes the **run()**, the details of user1 are passed to the **switch_user** method through the **MultiThread object**. Therefore, this creates a thread for user1.
- Similarly, When the **start()** is invoked again, the details of user2 are passed to the **switch_user** function through the **MultiThread object**. Therefore, this creates a thread for user2.
### Multi-threading in a Single User App
Here is a sample code to depict multi-threading for a single-user app.
```python
import threading
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore
from zcrmsdk.src.com.zoho.api.logger import Logger
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
from zcrmsdk.src.com.zoho.crm.api.record import *
class MultiThread(threading.Thread):
def __init__(self, module_api_name):
super().__init__()
self.module_api_name = module_api_name
def run(self):
try:
print("Calling Get Records for module: " + self.module_api_name)
response = RecordOperations().get_records(self.module_api_name)
if response is not None:
# Get the status code from response
print('Status Code: ' + str(response.get_status_code()))
if response.get_status_code() in [204, 304]:
print('No Content' if response.get_status_code() == 204 else 'Not Modified')
return
# Get object from response
response_object = response.get_object()
if response_object is not None:
# Check if expected ResponseWrapper instance is received.
if isinstance(response_object, ResponseWrapper):
# Get the list of obtained Record instances
record_list = response_object.get_data()
for record in record_list:
for key, value in record.get_key_values().items():
print(key + " : " + str(value))
# Check if the request returned an exception
elif isinstance(response_object, APIException):
# Get the Status
print("Status: " + response_object.get_status().get_value())
# Get the Code
print("Code: " + response_object.get_code().get_value())
print("Details")
# Get the details dict
details = response_object.get_details()
for key, value in details.items():
print(key + ' : ' + str(value))
# Get the Message
print("Message: " + response_object.get_message().get_value())
except Exception as e:
print(e)
@staticmethod
def call():
logger = Logger.get_instance(level=Logger.Levels.INFO, file_path="/Users/user_name/Documents/python_sdk_log.log")
user = UserSignature(email="[email protected]")
token = OAuthToken(client_id="clientId", client_secret="clientSecret", grant_token="grant_token", refresh_token="refresh_token", redirect_url="redirectURL", id="id")
environment = USDataCenter.PRODUCTION()
store = DBStore()
sdk_config = SDKConfig()
resource_path = '/Users/user_name/Documents/python-app'
Initializer.initialize(user=user, environment=environment, token=token, store=store, sdk_config=sdk_config, resource_path=resource_path, logger=logger)
t1 = MultiThread('Leads')
t2 = MultiThread('Quotes')
t1.start()
t2.start()
t1.join()
t2.join()
MultiThread.call()
```
- The program execution starts from **call()** where the SDK is initialized with the details of the user.
- When the **start()** is called which in-turn invokes the run(), the module_api_name is switched through the MultiThread object. Therefore, this creates a thread for the particular MultiThread instance.
## SDK Sample code
```python
from datetime import datetime
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.crm.api.dc import USDataCenter
from zcrmsdk.src.com.zoho.api.authenticator.store import DBStore
from zcrmsdk.src.com.zoho.api.logger import Logger
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from zcrmsdk.src.com.zoho.crm.api.record import *
from zcrmsdk.src.com.zoho.crm.api import HeaderMap, ParameterMap
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
class Record(object):
def __init__(self):
pass
@staticmethod
def get_records():
"""
Create an instance of Logger Class that takes two parameters
1 -> Level of the log messages to be logged. Can be configured by typing Logger.Levels "." and choose any level from the list displayed.
2 -> Absolute file path, where messages need to be logged.
"""
logger = Logger.get_instance(level=Logger.Levels.INFO,
file_path="/Users/user_name/Documents/python_sdk_log.log")
# Create an UserSignature instance that takes user Email as parameter
user = UserSignature(email="[email protected]")
"""
Configure the environment
which is of the pattern Domain.Environment
Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
Available Environments: PRODUCTION(), DEVELOPER(), SANDBOX()
"""
environment = USDataCenter.PRODUCTION()
"""
Create a Token instance that takes the following parameters
1 -> OAuth client id.
2 -> OAuth client secret.
3 -> Grant token.
4 -> Refresh token.
5 -> OAuth redirect URL.
6 -> id
"""
token = OAuthToken(client_id="clientId", client_secret="clientSecret", grant_token="grant_token", refresh_token="refresh_token", redirect_url="redirectURL", id="id")
"""
Create an instance of TokenStore
1 -> DataBase host name. Default value "localhost"
2 -> DataBase name. Default value "zohooauth"
3 -> DataBase user name. Default value "root"
4 -> DataBase password. Default value ""
5 -> DataBase port number. Default value "3306"
6-> DataBase table name . Default value "oauthtoken"
"""
store = DBStore()
"""
auto_refresh_fields (Default value is False)
if True - all the modules' fields will be auto-refreshed in the background, every hour.
if False - the fields will not be auto-refreshed in the background. The user can manually delete the file(s) or refresh the fields using methods from ModuleFieldsHandler(zcrmsdk/src/com/zoho/crm/api/util/module_fields_handler.py)
pick_list_validation (Default value is True)
A boolean field that validates user input for a pick list field and allows or disallows the addition of a new value to the list.
if True - the SDK validates the input. If the value does not exist in the pick list, the SDK throws an error.
if False - the SDK does not validate the input and makes the API request with the user’s input to the pick list
connect_timeout (Default value is None)
A Float field to set connect timeout
read_timeout (Default value is None)
A Float field to set read timeout
"""
config = SDKConfig(auto_refresh_fields=True, pick_list_validation=False, connect_timeout=None, read_timeout=None)
"""
The path containing the absolute directory path (in the key resource_path) to store user-specific files containing information about fields in modules.
"""
resource_path = '/Users/user_name/Documents/python-app'
"""
Call the static initialize method of Initializer class that takes the following arguments
1 -> UserSignature instance
2 -> Environment instance
3 -> Token instance
4 -> TokenStore instance
5 -> SDKConfig instance
6 -> resource_path
7 -> Logger instance
"""
Initializer.initialize(user=user, environment=environment, token=token, store=store, sdk_config=config, resource_path=resource_path, logger=logger)
try:
module_api_name = 'Leads'
param_instance = ParameterMap()
param_instance.add(GetRecordsParam.converted, 'both')
param_instance.add(GetRecordsParam.cvid, '12712717217218')
header_instance = HeaderMap()
header_instance.add(GetRecordsHeader.if_modified_since, datetime.now())
response = RecordOperations().get_records(module_api_name, param_instance, header_instance)
if response is not None:
# Get the status code from response
print('Status Code: ' + str(response.get_status_code()))
if response.get_status_code() in [204, 304]:
print('No Content' if response.get_status_code() == 204 else 'Not Modified')
return
# Get object from response
response_object = response.get_object()
if response_object is not None:
# Check if expected ResponseWrapper instance is received.
if isinstance(response_object, ResponseWrapper):
# Get the list of obtained Record instances
record_list = response_object.get_data()
for record in record_list:
# Get the ID of each Record
print("Record ID: " + record.get_id())
# Get the createdBy User instance of each Record
created_by = record.get_created_by()
# Check if created_by is not None
if created_by is not None:
# Get the Name of the created_by User
print("Record Created By - Name: " + created_by.get_name())
# Get the ID of the created_by User
print("Record Created By - ID: " + created_by.get_id())
# Get the Email of the created_by User
print("Record Created By - Email: " + created_by.get_email())
# Get the CreatedTime of each Record
print("Record CreatedTime: " + str(record.get_created_time()))
if record.get_modified_time() is not None:
# Get the ModifiedTime of each Record
print("Record ModifiedTime: " + str(record.get_modified_time()))
# Get the modified_by User instance of each Record
modified_by = record.get_modified_by()
# Check if modified_by is not None
if modified_by is not None:
# Get the Name of the modified_by User
print("Record Modified By - Name: " + modified_by.get_name())
# Get the ID of the modified_by User
print("Record Modified By - ID: " + modified_by.get_id())
# Get the Email of the modified_by User
print("Record Modified By - Email: " + modified_by.get_email())
# Get the list of obtained Tag instance of each Record
tags = record.get_tag()
if tags is not None:
for tag in tags:
# Get the Name of each Tag
print("Record Tag Name: " + tag.get_name())
# Get the Id of each Tag
print("Record Tag ID: " + tag.get_id())
# To get particular field value
print("Record Field Value: " + str(record.get_key_value('Last_Name')))
print('Record KeyValues: ')
for key, value in record.get_key_values().items():
print(key + " : " + str(value))
# Check if the request returned an exception
elif isinstance(response_object, APIException):
# Get the Status
print("Status: " + response_object.get_status().get_value())
# Get the Code
print("Code: " + response_object.get_code().get_value())
print("Details")
# Get the details dict
details = response_object.get_details()
for key, value in details.items():
print(key + ' : ' + str(value))
# Get the Message
print("Message: " + response_object.get_message().get_value())
except Exception as e:
print(e)
Record.get_records()
```
| zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/README.md | README.md |
try:
import threading
import logging
import enum
import json
import time
import requests
from .token import Token
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from ...crm.api.util import APIHTTPConnector
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from ...crm.api.util.constants import Constants
except Exception as e:
import threading
import logging
import enum
import json
import time
import requests
from .token import Token
from zcrmsdk.src.com.zoho.crm.api.initializer import Initializer
from ...crm.api.util import APIHTTPConnector
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from ...crm.api.util.constants import Constants
class OAuthToken(Token):
"""
This class maintains the tokens and authenticates every request.
"""
logger = logging.getLogger('SDKLogger')
lock = threading.Lock()
def __init__(self, client_id=None, client_secret=None, grant_token=None, refresh_token=None, redirect_url=None, id=None, access_token=None):
"""
Creates an OAuthToken class instance with the specified parameters.
Parameters:
client_id (str) : A string containing the OAuth client id.
client_secret (str) : A string containing the OAuth client secret.
grant_token (str) : A string containing the GRANT token.
refresh_token (str) : A string containing the REFRESH token.
redirect_url (str) : A string containing the OAuth redirect URL. Default value is None
id (str) : A string containing the Id. Default value is None
"""
error = {}
if grant_token is None and refresh_token is None and id is None and access_token is None:
raise SDKException(code=Constants.MANDATORY_VALUE_ERROR, message=Constants.MANDATORY_KEY_ERROR, details=Constants.OAUTH_MANDATORY_KEYS)
if id is None and access_token is None:
if not isinstance(client_id, str):
error[Constants.FIELD] = Constants.CLIENT_ID
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if not isinstance(client_secret, str):
error[Constants.FIELD] = Constants.CLIENT_SECRET
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if grant_token is not None and not isinstance(grant_token, str):
error[Constants.FIELD] = Constants.GRANT_TOKEN
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if refresh_token is not None and not isinstance(refresh_token, str):
error[Constants.FIELD] = Constants.REFRESH_TOKEN
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if redirect_url is not None and not isinstance(redirect_url, str):
error[Constants.FIELD] = Constants.REDIRECT_URI
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if id is not None and not isinstance(id, str):
error[Constants.FIELD] = Constants.ID
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
if access_token is not None and not isinstance(access_token, str):
error[Constants.FIELD] = Constants.ACCESS_TOKEN
error[Constants.EXPECTED_TYPE] = Constants.STRING
error[Constants.CLASS] = OAuthToken.__name__
raise SDKException(code=Constants.TOKEN_ERROR, details=error)
self.__client_id = client_id
self.__client_secret = client_secret
self.__redirect_url = redirect_url
self.__grant_token = grant_token
self.__refresh_token = refresh_token
self.__id = id
self.__access_token = access_token
self.__expires_in = None
self.__user_mail = None
def get_client_id(self):
"""
This is a getter method to get __client_id.
Returns:
string: A string representing __client_id
"""
return self.__client_id
def get_client_secret(self):
"""
This is a getter method to get __client_secret.
Returns:
string: A string representing __client_secret
"""
return self.__client_secret
def get_redirect_url(self):
"""
This is a getter method to get __redirect_url.
Returns:
string: A string representing __redirect_url
"""
return self.__redirect_url
def get_grant_token(self):
"""
This is a getter method to get __grant_token.
Returns:
string: A string representing __grant_token
"""
return self.__grant_token
def get_refresh_token(self):
"""
This is a getter method to get __refresh_token.
Returns:
string: A string representing __refresh_token
"""
return self.__refresh_token
def get_access_token(self):
"""
This is a getter method to get __access_token.
Returns:
string: A string representing __access_token
"""
return self.__access_token
def get_id(self):
"""
This is a getter method to get __id.
Returns:
string: A string representing __id
"""
return self.__id
def get_expires_in(self):
"""
This is a getter method to get __expires_in.
Returns:
string: A string representing __expires_in
"""
return self.__expires_in
def get_user_mail(self):
"""
This is a getter method to get __user_mail.
Returns:
string: A string representing __user_mail
"""
return self.__user_mail
def set_grant_token(self, grant_token):
"""
This is a setter method to set __grant_token.
"""
self.__grant_token = grant_token
def set_refresh_token(self, refresh_token):
"""
This is a setter method to set __refresh_token.
"""
self.__refresh_token = refresh_token
def set_redirect_url(self, redirect_url):
"""
This is a setter method to set __redirect_url.
"""
self.__redirect_url = redirect_url
def set_access_token(self, access_token):
"""
This is a setter method to set __access_token.
"""
self.__access_token = access_token
def set_client_id(self, client_id):
"""
This is a setter method to set __client_id.
"""
self.__client_id = client_id
def set_client_secret(self, client_secret):
"""
This is a setter method to set __client_secret.
"""
self.__client_secret = client_secret
def set_id(self, id):
"""
This is a setter method to set __id.
"""
self.__id = id
def set_expires_in(self, expires_in):
"""
This is a setter method to set __expires_in.
"""
self.__expires_in = expires_in
def set_user_mail(self, user_mail):
"""
This is a setter method to set __user_mail.
"""
self.__user_mail = user_mail
def authenticate(self, url_connection):
with OAuthToken.lock:
initializer = Initializer.get_initializer()
store = initializer.store
user = initializer.user
if self.__access_token is None:
if self.__id is not None:
oauth_token = initializer.store.get_token_by_id(self.__id, self)
else:
oauth_token = initializer.store.get_token(user, self)
else:
oauth_token = self
if oauth_token is None:
token = self.generate_access_token(user, store).get_access_token() if (
self.__refresh_token is None) else self.refresh_access_token(user, store).get_access_token()
elif oauth_token.get_expires_in() is not None and int(oauth_token.get_expires_in()) - int(time.time() * 1000) < 5000:
OAuthToken.logger.info(Constants.REFRESH_TOKEN_MESSAGE)
token = oauth_token.refresh_access_token(user, store).get_access_token()
else:
token = oauth_token.get_access_token()
url_connection.add_header(Constants.AUTHORIZATION, Constants.OAUTH_HEADER_PREFIX + token)
def refresh_access_token(self, user, store):
try:
url = Initializer.get_initializer().environment.accounts_url
body = {
Constants.REFRESH_TOKEN: self.__refresh_token,
Constants.CLIENT_ID: self.__client_id,
Constants.CLIENT_SECRET: self.__client_secret,
Constants.GRANT_TYPE: Constants.REFRESH_TOKEN
}
response = requests.post(url, data=body, params=None, headers=None, allow_redirects=False).json()
self.parse_response(response)
if self.__id is None:
self.generate_id()
store.save_token(user, self)
except SDKException as ex:
raise ex
except Exception as ex:
raise SDKException(code=Constants.SAVE_TOKEN_ERROR, cause=ex)
return self
def generate_access_token(self, user, store):
try:
url = Initializer.get_initializer().environment.accounts_url
body = {
Constants.GRANT_TYPE: Constants.GRANT_TYPE_AUTH_CODE,
Constants.CLIENT_ID: self.__client_id,
Constants.CLIENT_SECRET: self.__client_secret,
Constants.REDIRECT_URI: self.__redirect_url if self.__redirect_url is not None else None,
Constants.CODE: self.__grant_token
}
headers = dict()
headers[Constants.USER_AGENT_KEY] = Constants.USER_AGENT
response = requests.post(url, data=body, params=None, headers=headers, allow_redirects=True).json()
self.parse_response(response)
self.generate_id()
store.save_token(user, self)
except SDKException as ex:
raise ex
except Exception as ex:
raise SDKException(code=Constants.SAVE_TOKEN_ERROR, cause=ex)
return self
def parse_response(self, response):
response_json = dict(response)
if Constants.ACCESS_TOKEN not in response_json:
raise SDKException(code=Constants.INVALID_TOKEN_ERROR, message=str(response_json.get(Constants.ERROR_KEY))if Constants.ERROR_KEY in response_json else Constants.NO_ACCESS_TOKEN_ERROR)
self.__access_token = response_json.get(Constants.ACCESS_TOKEN)
self.__expires_in = str(int(time.time() * 1000) + self.get_token_expires_in(response=response_json))
if Constants.REFRESH_TOKEN in response_json:
self.__refresh_token = response_json.get(Constants.REFRESH_TOKEN)
return self
@staticmethod
def get_token_expires_in(response):
return int(response[Constants.EXPIRES_IN]) if Constants.EXPIRES_IN_SEC in response else int(
response[Constants.EXPIRES_IN]) * 1000
def generate_id(self):
id = ""
email = str(Initializer.get_initializer().user.get_email())
environment = str(Initializer.get_initializer().environment.name)
id += Constants.PYTHON + email[0:email.find(Constants.AT)] + Constants.UNDERSCORE
id += environment + Constants.UNDERSCORE + self.__refresh_token[len(self.__refresh_token)-4:]
self.__id = id
return self.__id
def remove(self):
try:
Initializer.get_initializer().store.delete_token(self)
return True
except Exception:
return False | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/api/authenticator/oauth_token.py | oauth_token.py |
try:
import os
import csv
from zcrmsdk.src.com.zoho.api.authenticator.store.token_store import TokenStore
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from ....crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
except Exception as e:
import os
import csv
from .token_store import TokenStore
from ..oauth_token import OAuthToken
from ....crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
class FileStore(TokenStore):
"""
The class to store user token details to the file.
"""
def __init__(self, file_path):
"""
Creates an FileStore class instance with the specified parameters.
Parameters:
file_path (str) : A string containing the absolute file path of the file to store tokens
"""
self.file_path = file_path
self.headers = [Constants.ID, Constants.USER_MAIL, Constants.CLIENT_ID, Constants.CLIENT_SECRET, Constants.REFRESH_TOKEN, Constants.ACCESS_TOKEN, Constants.GRANT_TOKEN, Constants.EXPIRY_TIME, Constants.REDIRECT_URI]
if (os.path.exists(file_path) and os.stat(file_path).st_size == 0) or not os.path.exists(file_path):
with open(self.file_path, mode='w') as token_file:
csv_writer = csv.writer(token_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow(self.headers)
def get_token(self, user, token):
try:
if isinstance(token, OAuthToken):
with open(self.file_path, mode='r') as f:
data = csv.reader(f, delimiter=',')
next(data, None)
for next_record in data:
if len(next_record) == 0:
continue
if self.check_token_exists(user.get_email(), token, next_record):
grant_token = next_record[6] if next_record[6] is not None and len(
next_record[6]) > 0 else None
redirect_url = next_record[8] if next_record[8] is not None and len(
next_record[8]) > 0 else None
oauthtoken = token
oauthtoken.set_id(next_record[0])
oauthtoken.set_user_mail(next_record[1])
oauthtoken.set_client_id(next_record[2])
oauthtoken.set_client_secret(next_record[3])
oauthtoken.set_refresh_token(next_record[4])
oauthtoken.set_access_token(next_record[5])
oauthtoken.set_grant_token(grant_token)
oauthtoken.set_expires_in(next_record[7])
oauthtoken.set_redirect_url(redirect_url)
return oauthtoken
except IOError as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKEN_FILE_ERROR, cause=ex)
return None
def save_token(self, user, token):
if isinstance(token, OAuthToken):
token.set_user_mail(user.get_email())
self.delete_token(token)
try:
with open(self.file_path, mode='a+') as f:
csv_writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow([token.get_id(), user.get_email(), token.get_client_id(), token.get_client_secret(), token.get_refresh_token(), token.get_access_token(), token.get_grant_token(), token.get_expires_in(), token.get_redirect_url()])
except IOError as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.SAVE_TOKEN_FILE_ERROR, cause=ex)
def delete_token(self, token):
lines = list()
if isinstance(token, OAuthToken):
try:
with open(self.file_path, mode='r') as f:
data = csv.reader(f, delimiter=',')
for next_record in data:
if len(next_record) == 0:
continue
lines.append(next_record)
if self.check_token_exists(token.get_user_mail(), token, next_record):
lines.remove(next_record)
with open(self.file_path, mode='w') as f:
csv_writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerows(lines)
except IOError as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.DELETE_TOKEN_FILE_ERROR, cause=ex)
def get_tokens(self):
tokens = []
try:
with open(self.file_path, mode='r') as f:
data = csv.reader(f, delimiter=',')
next(data, None)
for next_record in data:
if len(next_record) == 0:
continue
grant_token = next_record[6] if next_record[6] is not None and len(
next_record[6]) > 0 else None
redirect_url = next_record[8] if next_record[8] is not None and len(
next_record[8]) > 0 else None
token = OAuthToken(client_id=next_record[2], client_secret=next_record[3], grant_token=grant_token, refresh_token=next_record[4])
token.set_id(next_record[0])
token.set_user_mail(next_record[1])
token.set_access_token(next_record[5])
token.set_expires_in(next_record[7])
token.set_redirect_url(redirect_url)
tokens.append(token)
return tokens
except Exception as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKENS_FILE_ERROR, cause=ex)
def delete_tokens(self):
try:
with open(self.file_path, mode='w') as token_file:
csv_writer = csv.writer(token_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow(self.headers)
except Exception as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.DELETE_TOKENS_FILE_ERROR, cause=ex)
def get_token_by_id(self, id, token):
try:
if isinstance(token, OAuthToken):
is_row_present = False
with open(self.file_path, mode='r') as f:
data = csv.reader(f, delimiter=',')
next(data, None)
for next_record in data:
if len(next_record) == 0:
continue
if next_record[0] == id:
is_row_present = True
grant_token = next_record[6] if next_record[6] is not None and len(
next_record[6]) > 0 else None
redirect_url = next_record[8] if next_record[8] is not None and len(
next_record[8]) > 0 else None
oauthtoken = token
oauthtoken.set_id(next_record[0])
oauthtoken.set_user_mail(next_record[1])
oauthtoken.set_client_id(next_record[2])
oauthtoken.set_client_secret(next_record[3])
oauthtoken.set_refresh_token(next_record[4])
oauthtoken.set_access_token(next_record[5])
oauthtoken.set_grant_token(grant_token)
oauthtoken.set_expires_in(next_record[7])
oauthtoken.set_redirect_url(redirect_url)
return oauthtoken
if not is_row_present:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKEN_BY_ID_FILE_ERROR)
except IOError as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKEN_BY_ID_FILE_ERROR, cause=ex)
return None
@staticmethod
def check_token_exists(email, token, row):
if email is None:
raise SDKException(Constants.USER_MAIL_NULL_ERROR, Constants.USER_MAIL_NULL_ERROR_MESSAGE)
client_id = token.get_client_id()
grant_token = token.get_grant_token()
refresh_token = token.get_refresh_token()
token_check = grant_token == row[6] if grant_token is not None else refresh_token == row[4]
if row[1] == email and row[2] == client_id and token_check:
return True
return False | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/api/authenticator/store/file_store.py | file_store.py |
try:
import mysql.connector
from mysql.connector import Error
from zcrmsdk.src.com.zoho.api.authenticator.store.token_store import TokenStore
from zcrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken
from zcrmsdk.src.com.zoho.crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
except Exception as e:
import mysql.connector
from mysql.connector import Error
from .token_store import TokenStore
from ..oauth_token import OAuthToken
from ....crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
class DBStore(TokenStore):
"""
This class to store user token details to the MySQL DataBase.
"""
def __init__(self, host=Constants.MYSQL_HOST, database_name=Constants.MYSQL_DATABASE_NAME,
user_name=Constants.MYSQL_USER_NAME, password="", port_number=Constants.MYSQL_PORT_NUMBER,
table_name=Constants.MYSQL_TABLE_NAME):
"""
Creates a DBStore class instance with the specified parameters.
Parameters:
host (str) : A string containing the DataBase host name. Default value is localhost
database_name (str) : A string containing the DataBase name. Default value is zohooauth
user_name (str) : A string containing the DataBase user name. Default value is root
password (str) : A string containing the DataBase password. Default value is an empty string
port_number (str) : A string containing the DataBase port number. Default value is 3306
"""
self.__host = host
self.__database_name = database_name
self.__user_name = user_name
self.__password = password
self.__port_number = port_number
self.__table_name = table_name
def get_host(self):
"""
This is a getter method to get __host.
Returns:
string: A string representing __host
"""
return self.__host
def get_database_name(self):
"""
This is a getter method to get __database_name.
Returns:
string: A string representing __database_name
"""
return self.__database_name
def get_user_name(self):
"""
This is a getter method to get __user_name.
Returns:
string: A string representing __user_name
"""
return self.__user_name
def get_password(self):
"""
This is a getter method to get __password.
Returns:
string: A string representing __password
"""
return self.__password
def get_port_number(self):
"""
This is a getter method to get __port_number.
Returns:
string: A string representing __port_number
"""
return self.__port_number
def get_table_name(self):
"""
This is a getter method to get __table_name.
Returns:
string: A string representing __table_name
"""
return self.__table_name
def get_token(self, user, token):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
try:
if isinstance(token, OAuthToken):
cursor = connection.cursor()
query = self.construct_dbquery(user.get_email(), token, False)
cursor.execute(query)
result = cursor.fetchone()
if result is not None:
oauthtoken = token
oauthtoken.set_id(result[0])
oauthtoken.set_user_mail(result[1])
oauthtoken.set_client_id(result[2])
oauthtoken.set_client_secret(result[3])
oauthtoken.set_refresh_token(result[4])
oauthtoken.set_access_token(result[5])
oauthtoken.set_grant_token(result[6])
oauthtoken.set_expires_in(str(result[7]))
oauthtoken.set_redirect_url(result[8])
return oauthtoken
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKEN_DB_ERROR, cause=ex)
def save_token(self, user, token):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
try:
if isinstance(token, OAuthToken):
token.set_user_mail(user.get_email())
self.delete_token(token)
cursor = connection.cursor()
query = "insert into "+self.__table_name+" (id,user_mail,client_id,client_secret,refresh_token,access_token,grant_token,expiry_time,redirect_url) values (%s,%s,%s,%s,%s,%s,%s,%s,%s);"
val = (token.get_id(), user.get_email(), token.get_client_id(), token.get_client_secret(), token.get_refresh_token(), token.get_access_token(), token.get_grant_token(), token.get_expires_in(), token.get_redirect_url())
cursor.execute(query, val)
connection.commit()
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.SAVE_TOKEN_DB_ERROR, cause=ex)
def delete_token(self, token):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
try:
if isinstance(token, OAuthToken):
cursor = connection.cursor()
query = self.construct_dbquery(token.get_user_mail(), token, True)
cursor.execute(query)
connection.commit()
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.DELETE_TOKEN_DB_ERROR, cause=ex)
def get_tokens(self):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
tokens = []
try:
cursor = connection.cursor()
query = 'select * from ' + self.__table_name + ";"
cursor.execute(query)
results = cursor.fetchall()
for result in results:
token = OAuthToken(client_id=result[2], client_secret=result[3], refresh_token=result[4], grant_token=result[6])
token.set_id(result[0])
token.set_user_mail(result[1])
token.set_access_token(result[5])
token.set_expires_in(str(result[7]))
token.set_redirect_url(result[8])
tokens.append(token)
return tokens
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKENS_DB_ERROR, cause=ex)
def delete_tokens(self):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
try:
cursor = connection.cursor()
query = 'delete from ' + self.__table_name + ";"
cursor.execute(query)
connection.commit()
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.DELETE_TOKENS_DB_ERROR, cause=ex)
def get_token_by_id(self, id, token):
cursor = None
try:
connection = mysql.connector.connect(host=self.__host, database=self.__database_name, user=self.__user_name, password=self.__password, port=self.__port_number)
try:
if isinstance(token, OAuthToken):
query = "select * from " + self.__table_name + " where id='" + id + "'"
oauthtoken = token
cursor = connection.cursor()
cursor.execute(query)
results = cursor.fetchall()
for result in results:
if result[0] == id:
oauthtoken.set_id(result[0])
oauthtoken.set_user_mail(result[1])
oauthtoken.set_client_id(result[2])
oauthtoken.set_client_secret(result[3])
oauthtoken.set_refresh_token(result[4])
oauthtoken.set_access_token(result[5])
oauthtoken.set_grant_token(result[6])
oauthtoken.set_expires_in(str(result[7]))
oauthtoken.set_redirect_url(result[8])
return oauthtoken
except Error as ex:
raise ex
finally:
cursor.close() if cursor is not None else None
connection.close() if connection is not None else None
except Error as ex:
raise SDKException(code=Constants.TOKEN_STORE, message=Constants.GET_TOKEN_BY_ID_DB_ERROR, cause=ex)
def construct_dbquery(self, email, token, is_delete):
if email is None:
raise SDKException(Constants.USER_MAIL_NULL_ERROR, Constants.USER_MAIL_NULL_ERROR_MESSAGE)
query = "delete from " if is_delete is True else "select * from "
query += self.__table_name + " where user_mail ='" + email + "' and client_id='" + token.get_client_id() + "' and "
if token.get_grant_token() is not None:
query += "grant_token='" + token.get_grant_token() + "'"
else:
query += "refresh_token='" + token.get_refresh_token() + "'"
return query | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/api/authenticator/store/db_store.py | db_store.py |
try:
import logging
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
from ...crm.api.util.constants import Constants
except:
from ...crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
class Logger(object):
"""
This class represents the Logger level and the file path.
"""
def __init__(self, level, file_path=None):
self.__level = level
self.__file_path = file_path
def get_level(self):
"""
This is a getter method to get __level.
Returns:
string: A enum representing __level
"""
return self.__level
def get_file_path(self):
"""
This is a getter method to get __file_path.
Returns:
string: A string representing __file_path
"""
return self.__file_path
@staticmethod
def get_instance(level, file_path=None):
"""
Creates an Logger class instance with the specified log level and file path.
:param level: A Levels class instance containing the log level.
:param file_path: A str containing the log file path.
:return: A Logger class instance.
"""
return Logger(level=level, file_path=file_path)
import enum
class Levels(enum.Enum):
"""
This class represents the possible logger levels
"""
CRITICAL = logging.CRITICAL
ERROR = logging.ERROR
WARNING = logging.WARNING
INFO = logging.INFO
DEBUG = logging.DEBUG
NOTSET = logging.NOTSET
class SDKLogger(object):
"""
The class to initialize the SDK logger.
"""
def __init__(self, logger_instance):
logger = logging.getLogger('SDKLogger')
logger_level = logger_instance.get_level()
logger_file_path = logger_instance.get_file_path()
if logger_level is not None and logger_level != logging.NOTSET and logger_file_path is not None and logger_file_path != "":
file_handler = logging.FileHandler(logger_file_path)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(module)s - %(filename)s - %(funcName)s - %(lineno)d - %(message)s')
file_handler.setLevel(logger_level.name)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
if logger_level is not None and Constants.LOGGER_LEVELS.__contains__(logger_level.name):
logger.setLevel(logger_level.name)
@staticmethod
def initialize(logger_instance):
try:
SDKLogger(logger_instance=logger_instance)
except Exception as ex:
raise SDKException(message=Constants.LOGGER_INITIALIZATION_ERROR, Exception=ex) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/api/logger/logger.py | logger.py |
try:
import logging
import os
import json
import threading
from zcrmsdk.src.com.zoho.crm.api.user_signature import UserSignature
from zcrmsdk.src.com.zoho.api.authenticator.store.token_store import TokenStore
from zcrmsdk.src.com.zoho.crm.api.exception.sdk_exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.dc.data_center import DataCenter
from zcrmsdk.src.com.zoho.crm.api.util.constants import Constants
from zcrmsdk.src.com.zoho.api.authenticator.token import Token
from zcrmsdk.src.com.zoho.api.logger import Logger, SDKLogger
from zcrmsdk.src.com.zoho.crm.api.request_proxy import RequestProxy
from zcrmsdk.src.com.zoho.crm.api.sdk_config import SDKConfig
except Exception:
import logging
import os
import json
import threading
from ..api.user_signature import UserSignature
from ...api.authenticator.store.token_store import TokenStore
from ..api.exception import SDKException
from ..api.dc.data_center import DataCenter
from ..api.util.constants import Constants
from ...api.authenticator.token import Token
from ...api.logger import Logger, SDKLogger
from .request_proxy import RequestProxy
from .sdk_config import SDKConfig
class Initializer(object):
"""
The class to initialize Zoho CRM SDK.
"""
def __init__(self):
self.environment = None
self.user = None
self.store = None
self.token = None
self.sdk_config = None
self.request_proxy = None
self.resource_path = None
json_details = None
initializer = None
LOCAL = threading.local()
LOCAL.init = None
@staticmethod
def initialize(user, environment, token, store=None, sdk_config=None, resource_path=None, logger=None, proxy=None):
"""
The method to initialize the SDK.
Parameters:
user (UserSignature) : A UserSignature class instance represents the CRM user
environment (DataCenter.Environment) : An Environment class instance containing the CRM API base URL and Accounts URL.
token (Token) : A Token class instance containing the OAuth client application information.
store (TokenStore) : A TokenStore class instance containing the token store information.
sdk_config (SDKConfig) : A SDKConfig class instance containing the configuration.
resource_path (str) : A String containing the absolute directory path to store user specific JSON files containing module fields information.
logger (Logger): A Logger class instance containing the log file path and Logger type.
proxy (RequestProxy) : A RequestProxy class instance containing the proxy properties of the user.
"""
try:
if not isinstance(user, UserSignature):
error = {Constants.FIELD: Constants.USER, Constants.EXPECTED_TYPE: UserSignature.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.USER_SIGNATURE_ERROR_MESSAGE, details=error)
if not isinstance(environment, DataCenter.Environment):
error = {Constants.FIELD: Constants.ENVIRONMENT,
Constants.EXPECTED_TYPE: DataCenter.Environment.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.ENVIRONMENT_ERROR_MESSAGE, details=error)
if not isinstance(token, Token):
error = {Constants.FIELD: Constants.TOKEN, Constants.EXPECTED_TYPE: Token.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.TOKEN_ERROR_MESSAGE, details=error)
if store is not None and not isinstance(store, TokenStore):
error = {Constants.FIELD: Constants.STORE, Constants.EXPECTED_TYPE: TokenStore.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.STORE_ERROR_MESSAGE, details=error)
if sdk_config is not None and not isinstance(sdk_config, SDKConfig):
error = {Constants.FIELD: Constants.SDK_CONFIG, Constants.EXPECTED_TYPE: SDKConfig.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.SDK_CONFIG_ERROR_MESSAGE, details=error)
if proxy is not None and not isinstance(proxy, RequestProxy):
error = {Constants.FIELD: Constants.USER_PROXY, Constants.EXPECTED_TYPE: RequestProxy.__module__}
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.REQUEST_PROXY_ERROR_MESSAGE, details=error)
if store is None:
try:
from zcrmsdk.src.com.zoho.api.authenticator.store.file_store import FileStore
except Exception:
from ...api.authenticator.store.file_store import FileStore
store = FileStore(os.path.join(os.getcwd(), Constants.TOKEN_FILE))
if sdk_config is None:
sdk_config = SDKConfig()
if resource_path is None or len(resource_path) == 0:
resource_path = os.getcwd()
if logger is None:
logger = Logger(Logger.Levels.INFO, os.path.join(os.getcwd(), Constants.LOG_FILE_NAME))
SDKLogger.initialize(logger)
if not os.path.isdir(resource_path):
raise SDKException(Constants.INITIALIZATION_ERROR, Constants.RESOURCE_PATH_INVALID_ERROR_MESSAGE)
try:
json_details_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', Constants.JSON_DETAILS_FILE_PATH)
if Initializer.json_details is None or len(Initializer.json_details)==0:
with open(json_details_path, mode='r') as JSON:
Initializer.json_details = json.load(JSON)
except Exception as e:
raise SDKException(code=Constants.JSON_DETAILS_ERROR, cause=e)
initializer = Initializer()
initializer.environment = environment
initializer.user = user
initializer.token = token
initializer.store = store
initializer.sdk_config = sdk_config
initializer.resource_path = resource_path
initializer.request_proxy = proxy
Initializer.initializer = initializer
logging.getLogger('SDKLogger').info(Constants.INITIALIZATION_SUCCESSFUL + initializer.__str__())
except SDKException as e:
raise e
def __str__(self):
return Constants.FOR_EMAIL_ID + Initializer.get_initializer().user.get_email() + Constants.IN_ENVIRONMENT + Initializer.get_initializer().environment.url + '.'
@staticmethod
def get_initializer():
"""
The method to get Initializer class instance.
Returns:
Initializer : An instance of Initializer
"""
if getattr(Initializer.LOCAL, 'init', None) is not None:
return getattr(Initializer.LOCAL, 'init')
return Initializer.initializer
@staticmethod
def get_json(file_path):
with open(file_path, mode="r") as JSON:
file_contents = json.load(JSON)
JSON.close()
return file_contents
@staticmethod
def switch_user(user=None, environment=None, token=None, sdk_config=None, proxy=None):
"""
The method to switch the different user in SDK environment.
Parameters:
user (UserSignature) : A UserSignature class instance represents the CRM user
environment (DataCenter.Environment) : An Environment class instance containing the CRM API base URL and Accounts URL.
token (Token) : A Token class instance containing the OAuth client application information.
sdk_config (SDKConfig) : A SDKConfig class instance containing the configuration.
proxy (RequestProxy) : A RequestProxy class instance containing the proxy properties of the user.
"""
if Initializer.initializer is None:
raise SDKException(Constants.SDK_UNINITIALIZATION_ERROR, Constants.SDK_UNINITIALIZATION_MESSAGE)
if user is not None and not isinstance(user, UserSignature):
error = {Constants.FIELD: Constants.USER, Constants.EXPECTED_TYPE: UserSignature.__module__}
raise SDKException(Constants.SWITCH_USER_ERROR, Constants.USER_SIGNATURE_ERROR_MESSAGE, details=error)
if environment is not None and not isinstance(environment, DataCenter.Environment):
error = {Constants.FIELD: Constants.ENVIRONMENT,
Constants.EXPECTED_TYPE: DataCenter.Environment.__module__}
raise SDKException(Constants.SWITCH_USER_ERROR, Constants.ENVIRONMENT_ERROR_MESSAGE, details=error)
if token is not None and not isinstance(token, Token):
error = {Constants.FIELD: Constants.TOKEN, Constants.EXPECTED_TYPE: Token.__module__}
raise SDKException(Constants.SWITCH_USER_ERROR, Constants.TOKEN_ERROR_MESSAGE, details=error)
if sdk_config is not None and not isinstance(sdk_config, SDKConfig):
error = {Constants.FIELD: Constants.SDK_CONFIG, Constants.EXPECTED_TYPE: SDKConfig.__module__}
raise SDKException(Constants.SWITCH_USER_ERROR, Constants.SDK_CONFIG_ERROR_MESSAGE, details=error)
if proxy is not None and not isinstance(proxy, RequestProxy):
error = {Constants.FIELD: Constants.USER_PROXY, Constants.EXPECTED_TYPE: RequestProxy.__module__}
raise SDKException(Constants.SWITCH_USER_ERROR, Constants.REQUEST_PROXY_ERROR_MESSAGE, details=error)
previous_initializer = Initializer.get_initializer()
initializer = Initializer()
initializer.user = previous_initializer.user if user is None else user
initializer.environment = previous_initializer.environment if environment is None else environment
initializer.token = previous_initializer.token if token is None else token
initializer.sdk_config = previous_initializer.sdk_config if sdk_config is None else sdk_config
initializer.store = Initializer.initializer.store
initializer.resource_path = Initializer.initializer.resource_path
initializer.request_proxy = proxy
Initializer.LOCAL.init = initializer
logging.getLogger('SDKLogger').info(Constants.INITIALIZATION_SWITCHED + initializer.__str__()) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/initializer.py | initializer.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.org.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__org = None
self.__key_modified = dict()
def get_org(self):
"""
The method to get the org
Returns:
list: An instance of list
"""
return self.__org
def set_org(self, org):
"""
The method to set the value to org
Parameters:
org (list) : An instance of list
"""
if org is not None and not isinstance(org, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: org EXPECTED TYPE: list', None, None)
self.__org = org
self.__key_modified['org'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.org.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.org.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .response_handler import ResponseHandler
class APIException(ResponseHandler, ActionResponse):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class LicenseDetails(object):
def __init__(self):
"""Creates an instance of LicenseDetails"""
self.__paid_expiry = None
self.__users_license_purchased = None
self.__trial_type = None
self.__trial_expiry = None
self.__paid = None
self.__paid_type = None
self.__key_modified = dict()
def get_paid_expiry(self):
"""
The method to get the paid_expiry
Returns:
datetime: An instance of datetime
"""
return self.__paid_expiry
def set_paid_expiry(self, paid_expiry):
"""
The method to set the value to paid_expiry
Parameters:
paid_expiry (datetime) : An instance of datetime
"""
from datetime import datetime
if paid_expiry is not None and not isinstance(paid_expiry, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: paid_expiry EXPECTED TYPE: datetime', None, None)
self.__paid_expiry = paid_expiry
self.__key_modified['paid_expiry'] = 1
def get_users_license_purchased(self):
"""
The method to get the users_license_purchased
Returns:
int: An int representing the users_license_purchased
"""
return self.__users_license_purchased
def set_users_license_purchased(self, users_license_purchased):
"""
The method to set the value to users_license_purchased
Parameters:
users_license_purchased (int) : An int representing the users_license_purchased
"""
if users_license_purchased is not None and not isinstance(users_license_purchased, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: users_license_purchased EXPECTED TYPE: int', None, None)
self.__users_license_purchased = users_license_purchased
self.__key_modified['users_license_purchased'] = 1
def get_trial_type(self):
"""
The method to get the trial_type
Returns:
string: A string representing the trial_type
"""
return self.__trial_type
def set_trial_type(self, trial_type):
"""
The method to set the value to trial_type
Parameters:
trial_type (string) : A string representing the trial_type
"""
if trial_type is not None and not isinstance(trial_type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: trial_type EXPECTED TYPE: str', None, None)
self.__trial_type = trial_type
self.__key_modified['trial_type'] = 1
def get_trial_expiry(self):
"""
The method to get the trial_expiry
Returns:
string: A string representing the trial_expiry
"""
return self.__trial_expiry
def set_trial_expiry(self, trial_expiry):
"""
The method to set the value to trial_expiry
Parameters:
trial_expiry (string) : A string representing the trial_expiry
"""
if trial_expiry is not None and not isinstance(trial_expiry, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: trial_expiry EXPECTED TYPE: str', None, None)
self.__trial_expiry = trial_expiry
self.__key_modified['trial_expiry'] = 1
def get_paid(self):
"""
The method to get the paid
Returns:
bool: A bool representing the paid
"""
return self.__paid
def set_paid(self, paid):
"""
The method to set the value to paid
Parameters:
paid (bool) : A bool representing the paid
"""
if paid is not None and not isinstance(paid, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: paid EXPECTED TYPE: bool', None, None)
self.__paid = paid
self.__key_modified['paid'] = 1
def get_paid_type(self):
"""
The method to get the paid_type
Returns:
string: A string representing the paid_type
"""
return self.__paid_type
def set_paid_type(self, paid_type):
"""
The method to set the value to paid_type
Parameters:
paid_type (string) : A string representing the paid_type
"""
if paid_type is not None and not isinstance(paid_type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: paid_type EXPECTED TYPE: str', None, None)
self.__paid_type = paid_type
self.__key_modified['paid_type'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/license_details.py | license_details.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
except Exception:
from ..exception import SDKException
from ..util import APIResponse, CommonAPIHandler, Constants
class OrgOperations(object):
def __init__(self):
"""Creates an instance of OrgOperations"""
pass
def get_organization(self):
"""
The method to get organization
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
handler_instance = CommonAPIHandler()
api_path = ''
api_path = api_path + '/crm/v2/org'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.org.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
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') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/org_operations.py | org_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Org(object):
def __init__(self):
"""Creates an instance of Org"""
self.__country = None
self.__photo_id = None
self.__city = None
self.__description = None
self.__mc_status = None
self.__gapps_enabled = None
self.__domain_name = None
self.__translation_enabled = None
self.__street = None
self.__alias = None
self.__currency = None
self.__id = None
self.__state = None
self.__fax = None
self.__employee_count = None
self.__zip = None
self.__website = None
self.__currency_symbol = None
self.__mobile = None
self.__currency_locale = None
self.__primary_zuid = None
self.__zia_portal_id = None
self.__time_zone = None
self.__zgid = None
self.__country_code = None
self.__license_details = None
self.__phone = None
self.__company_name = None
self.__privacy_settings = None
self.__primary_email = None
self.__iso_code = None
self.__key_modified = dict()
def get_country(self):
"""
The method to get the country
Returns:
string: A string representing the country
"""
return self.__country
def set_country(self, country):
"""
The method to set the value to country
Parameters:
country (string) : A string representing the country
"""
if country is not None and not isinstance(country, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: country EXPECTED TYPE: str', None, None)
self.__country = country
self.__key_modified['country'] = 1
def get_photo_id(self):
"""
The method to get the photo_id
Returns:
string: A string representing the photo_id
"""
return self.__photo_id
def set_photo_id(self, photo_id):
"""
The method to set the value to photo_id
Parameters:
photo_id (string) : A string representing the photo_id
"""
if photo_id is not None and not isinstance(photo_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: photo_id EXPECTED TYPE: str', None, None)
self.__photo_id = photo_id
self.__key_modified['photo_id'] = 1
def get_city(self):
"""
The method to get the city
Returns:
string: A string representing the city
"""
return self.__city
def set_city(self, city):
"""
The method to set the value to city
Parameters:
city (string) : A string representing the city
"""
if city is not None and not isinstance(city, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: city EXPECTED TYPE: str', None, None)
self.__city = city
self.__key_modified['city'] = 1
def get_description(self):
"""
The method to get the description
Returns:
string: A string representing the description
"""
return self.__description
def set_description(self, description):
"""
The method to set the value to description
Parameters:
description (string) : A string representing the description
"""
if description is not None and not isinstance(description, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: description EXPECTED TYPE: str', None, None)
self.__description = description
self.__key_modified['description'] = 1
def get_mc_status(self):
"""
The method to get the mc_status
Returns:
bool: A bool representing the mc_status
"""
return self.__mc_status
def set_mc_status(self, mc_status):
"""
The method to set the value to mc_status
Parameters:
mc_status (bool) : A bool representing the mc_status
"""
if mc_status is not None and not isinstance(mc_status, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: mc_status EXPECTED TYPE: bool', None, None)
self.__mc_status = mc_status
self.__key_modified['mc_status'] = 1
def get_gapps_enabled(self):
"""
The method to get the gapps_enabled
Returns:
bool: A bool representing the gapps_enabled
"""
return self.__gapps_enabled
def set_gapps_enabled(self, gapps_enabled):
"""
The method to set the value to gapps_enabled
Parameters:
gapps_enabled (bool) : A bool representing the gapps_enabled
"""
if gapps_enabled is not None and not isinstance(gapps_enabled, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: gapps_enabled EXPECTED TYPE: bool', None, None)
self.__gapps_enabled = gapps_enabled
self.__key_modified['gapps_enabled'] = 1
def get_domain_name(self):
"""
The method to get the domain_name
Returns:
string: A string representing the domain_name
"""
return self.__domain_name
def set_domain_name(self, domain_name):
"""
The method to set the value to domain_name
Parameters:
domain_name (string) : A string representing the domain_name
"""
if domain_name is not None and not isinstance(domain_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: domain_name EXPECTED TYPE: str', None, None)
self.__domain_name = domain_name
self.__key_modified['domain_name'] = 1
def get_translation_enabled(self):
"""
The method to get the translation_enabled
Returns:
bool: A bool representing the translation_enabled
"""
return self.__translation_enabled
def set_translation_enabled(self, translation_enabled):
"""
The method to set the value to translation_enabled
Parameters:
translation_enabled (bool) : A bool representing the translation_enabled
"""
if translation_enabled is not None and not isinstance(translation_enabled, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: translation_enabled EXPECTED TYPE: bool', None, None)
self.__translation_enabled = translation_enabled
self.__key_modified['translation_enabled'] = 1
def get_street(self):
"""
The method to get the street
Returns:
string: A string representing the street
"""
return self.__street
def set_street(self, street):
"""
The method to set the value to street
Parameters:
street (string) : A string representing the street
"""
if street is not None and not isinstance(street, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: street EXPECTED TYPE: str', None, None)
self.__street = street
self.__key_modified['street'] = 1
def get_alias(self):
"""
The method to get the alias
Returns:
string: A string representing the alias
"""
return self.__alias
def set_alias(self, alias):
"""
The method to set the value to alias
Parameters:
alias (string) : A string representing the alias
"""
if alias is not None and not isinstance(alias, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: alias EXPECTED TYPE: str', None, None)
self.__alias = alias
self.__key_modified['alias'] = 1
def get_currency(self):
"""
The method to get the currency
Returns:
string: A string representing the currency
"""
return self.__currency
def set_currency(self, currency):
"""
The method to set the value to currency
Parameters:
currency (string) : A string representing the currency
"""
if currency is not None and not isinstance(currency, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: currency EXPECTED TYPE: str', None, None)
self.__currency = currency
self.__key_modified['currency'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_state(self):
"""
The method to get the state
Returns:
string: A string representing the state
"""
return self.__state
def set_state(self, state):
"""
The method to set the value to state
Parameters:
state (string) : A string representing the state
"""
if state is not None and not isinstance(state, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: state EXPECTED TYPE: str', None, None)
self.__state = state
self.__key_modified['state'] = 1
def get_fax(self):
"""
The method to get the fax
Returns:
string: A string representing the fax
"""
return self.__fax
def set_fax(self, fax):
"""
The method to set the value to fax
Parameters:
fax (string) : A string representing the fax
"""
if fax is not None and not isinstance(fax, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: fax EXPECTED TYPE: str', None, None)
self.__fax = fax
self.__key_modified['fax'] = 1
def get_employee_count(self):
"""
The method to get the employee_count
Returns:
string: A string representing the employee_count
"""
return self.__employee_count
def set_employee_count(self, employee_count):
"""
The method to set the value to employee_count
Parameters:
employee_count (string) : A string representing the employee_count
"""
if employee_count is not None and not isinstance(employee_count, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: employee_count EXPECTED TYPE: str', None, None)
self.__employee_count = employee_count
self.__key_modified['employee_count'] = 1
def get_zip(self):
"""
The method to get the zip
Returns:
string: A string representing the zip
"""
return self.__zip
def set_zip(self, zip):
"""
The method to set the value to zip
Parameters:
zip (string) : A string representing the zip
"""
if zip is not None and not isinstance(zip, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: zip EXPECTED TYPE: str', None, None)
self.__zip = zip
self.__key_modified['zip'] = 1
def get_website(self):
"""
The method to get the website
Returns:
string: A string representing the website
"""
return self.__website
def set_website(self, website):
"""
The method to set the value to website
Parameters:
website (string) : A string representing the website
"""
if website is not None and not isinstance(website, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: website EXPECTED TYPE: str', None, None)
self.__website = website
self.__key_modified['website'] = 1
def get_currency_symbol(self):
"""
The method to get the currency_symbol
Returns:
string: A string representing the currency_symbol
"""
return self.__currency_symbol
def set_currency_symbol(self, currency_symbol):
"""
The method to set the value to currency_symbol
Parameters:
currency_symbol (string) : A string representing the currency_symbol
"""
if currency_symbol is not None and not isinstance(currency_symbol, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: currency_symbol EXPECTED TYPE: str', None, None)
self.__currency_symbol = currency_symbol
self.__key_modified['currency_symbol'] = 1
def get_mobile(self):
"""
The method to get the mobile
Returns:
string: A string representing the mobile
"""
return self.__mobile
def set_mobile(self, mobile):
"""
The method to set the value to mobile
Parameters:
mobile (string) : A string representing the mobile
"""
if mobile is not None and not isinstance(mobile, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: mobile EXPECTED TYPE: str', None, None)
self.__mobile = mobile
self.__key_modified['mobile'] = 1
def get_currency_locale(self):
"""
The method to get the currency_locale
Returns:
string: A string representing the currency_locale
"""
return self.__currency_locale
def set_currency_locale(self, currency_locale):
"""
The method to set the value to currency_locale
Parameters:
currency_locale (string) : A string representing the currency_locale
"""
if currency_locale is not None and not isinstance(currency_locale, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: currency_locale EXPECTED TYPE: str', None, None)
self.__currency_locale = currency_locale
self.__key_modified['currency_locale'] = 1
def get_primary_zuid(self):
"""
The method to get the primary_zuid
Returns:
string: A string representing the primary_zuid
"""
return self.__primary_zuid
def set_primary_zuid(self, primary_zuid):
"""
The method to set the value to primary_zuid
Parameters:
primary_zuid (string) : A string representing the primary_zuid
"""
if primary_zuid is not None and not isinstance(primary_zuid, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: primary_zuid EXPECTED TYPE: str', None, None)
self.__primary_zuid = primary_zuid
self.__key_modified['primary_zuid'] = 1
def get_zia_portal_id(self):
"""
The method to get the zia_portal_id
Returns:
string: A string representing the zia_portal_id
"""
return self.__zia_portal_id
def set_zia_portal_id(self, zia_portal_id):
"""
The method to set the value to zia_portal_id
Parameters:
zia_portal_id (string) : A string representing the zia_portal_id
"""
if zia_portal_id is not None and not isinstance(zia_portal_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: zia_portal_id EXPECTED TYPE: str', None, None)
self.__zia_portal_id = zia_portal_id
self.__key_modified['zia_portal_id'] = 1
def get_time_zone(self):
"""
The method to get the time_zone
Returns:
string: A string representing the time_zone
"""
return self.__time_zone
def set_time_zone(self, time_zone):
"""
The method to set the value to time_zone
Parameters:
time_zone (string) : A string representing the time_zone
"""
if time_zone is not None and not isinstance(time_zone, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: time_zone EXPECTED TYPE: str', None, None)
self.__time_zone = time_zone
self.__key_modified['time_zone'] = 1
def get_zgid(self):
"""
The method to get the zgid
Returns:
string: A string representing the zgid
"""
return self.__zgid
def set_zgid(self, zgid):
"""
The method to set the value to zgid
Parameters:
zgid (string) : A string representing the zgid
"""
if zgid is not None and not isinstance(zgid, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: zgid EXPECTED TYPE: str', None, None)
self.__zgid = zgid
self.__key_modified['zgid'] = 1
def get_country_code(self):
"""
The method to get the country_code
Returns:
string: A string representing the country_code
"""
return self.__country_code
def set_country_code(self, country_code):
"""
The method to set the value to country_code
Parameters:
country_code (string) : A string representing the country_code
"""
if country_code is not None and not isinstance(country_code, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: country_code EXPECTED TYPE: str', None, None)
self.__country_code = country_code
self.__key_modified['country_code'] = 1
def get_license_details(self):
"""
The method to get the license_details
Returns:
LicenseDetails: An instance of LicenseDetails
"""
return self.__license_details
def set_license_details(self, license_details):
"""
The method to set the value to license_details
Parameters:
license_details (LicenseDetails) : An instance of LicenseDetails
"""
try:
from zcrmsdk.src.com.zoho.crm.api.org.license_details import LicenseDetails
except Exception:
from .license_details import LicenseDetails
if license_details is not None and not isinstance(license_details, LicenseDetails):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: license_details EXPECTED TYPE: LicenseDetails', None, None)
self.__license_details = license_details
self.__key_modified['license_details'] = 1
def get_phone(self):
"""
The method to get the phone
Returns:
string: A string representing the phone
"""
return self.__phone
def set_phone(self, phone):
"""
The method to set the value to phone
Parameters:
phone (string) : A string representing the phone
"""
if phone is not None and not isinstance(phone, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: phone EXPECTED TYPE: str', None, None)
self.__phone = phone
self.__key_modified['phone'] = 1
def get_company_name(self):
"""
The method to get the company_name
Returns:
string: A string representing the company_name
"""
return self.__company_name
def set_company_name(self, company_name):
"""
The method to set the value to company_name
Parameters:
company_name (string) : A string representing the company_name
"""
if company_name is not None and not isinstance(company_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: company_name EXPECTED TYPE: str', None, None)
self.__company_name = company_name
self.__key_modified['company_name'] = 1
def get_privacy_settings(self):
"""
The method to get the privacy_settings
Returns:
bool: A bool representing the privacy_settings
"""
return self.__privacy_settings
def set_privacy_settings(self, privacy_settings):
"""
The method to set the value to privacy_settings
Parameters:
privacy_settings (bool) : A bool representing the privacy_settings
"""
if privacy_settings is not None and not isinstance(privacy_settings, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: privacy_settings EXPECTED TYPE: bool', None, None)
self.__privacy_settings = privacy_settings
self.__key_modified['privacy_settings'] = 1
def get_primary_email(self):
"""
The method to get the primary_email
Returns:
string: A string representing the primary_email
"""
return self.__primary_email
def set_primary_email(self, primary_email):
"""
The method to set the value to primary_email
Parameters:
primary_email (string) : A string representing the primary_email
"""
if primary_email is not None and not isinstance(primary_email, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: primary_email EXPECTED TYPE: str', None, None)
self.__primary_email = primary_email
self.__key_modified['primary_email'] = 1
def get_iso_code(self):
"""
The method to get the iso_code
Returns:
string: A string representing the iso_code
"""
return self.__iso_code
def set_iso_code(self, iso_code):
"""
The method to set the value to iso_code
Parameters:
iso_code (string) : A string representing the iso_code
"""
if iso_code is not None and not isinstance(iso_code, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: iso_code EXPECTED TYPE: str', None, None)
self.__iso_code = iso_code
self.__key_modified['iso_code'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/org.py | org.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.org.action_response import ActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
class SuccessResponse(ActionResponse):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/org/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.modules.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .action_handler import ActionHandler
class ActionWrapper(ActionHandler):
def __init__(self):
"""Creates an instance of ActionWrapper"""
super().__init__()
self.__modules = None
self.__key_modified = dict()
def get_modules(self):
"""
The method to get the modules
Returns:
list: An instance of list
"""
return self.__modules
def set_modules(self, modules):
"""
The method to set the value to modules
Parameters:
modules (list) : An instance of list
"""
if modules is not None and not isinstance(modules, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modules EXPECTED TYPE: list', None, None)
self.__modules = modules
self.__key_modified['modules'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/action_wrapper.py | action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.modules.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__modules = None
self.__key_modified = dict()
def get_modules(self):
"""
The method to get the modules
Returns:
list: An instance of list
"""
return self.__modules
def set_modules(self, modules):
"""
The method to set the value to modules
Parameters:
modules (list) : An instance of list
"""
if modules is not None and not isinstance(modules, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modules EXPECTED TYPE: list', None, None)
self.__modules = modules
self.__key_modified['modules'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Territory(object):
def __init__(self):
"""Creates an instance of Territory"""
self.__id = None
self.__name = None
self.__subordinates = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_subordinates(self):
"""
The method to get the subordinates
Returns:
bool: A bool representing the subordinates
"""
return self.__subordinates
def set_subordinates(self, subordinates):
"""
The method to set the value to subordinates
Parameters:
subordinates (bool) : A bool representing the subordinates
"""
if subordinates is not None and not isinstance(subordinates, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: subordinates EXPECTED TYPE: bool', None, None)
self.__subordinates = subordinates
self.__key_modified['subordinates'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/territory.py | territory.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.modules.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.modules.response_handler import ResponseHandler
from zcrmsdk.src.com.zoho.crm.api.modules.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .response_handler import ResponseHandler
from .action_handler import ActionHandler
class APIException(ResponseHandler, ActionResponse, ActionHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Argument(object):
def __init__(self):
"""Creates an instance of Argument"""
self.__name = None
self.__value = None
self.__key_modified = dict()
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_value(self):
"""
The method to get the value
Returns:
string: A string representing the value
"""
return self.__value
def set_value(self, value):
"""
The method to set the value to value
Parameters:
value (string) : A string representing the value
"""
if value is not None and not isinstance(value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: value EXPECTED TYPE: str', None, None)
self.__value = value
self.__key_modified['value'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/argument.py | argument.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
class Module(object):
def __init__(self):
"""Creates an instance of Module"""
self.__name = None
self.__global_search_supported = None
self.__kanban_view = None
self.__deletable = None
self.__description = None
self.__creatable = None
self.__filter_status = None
self.__inventory_template_supported = None
self.__modified_time = None
self.__plural_label = None
self.__presence_sub_menu = None
self.__triggers_supported = None
self.__id = None
self.__related_list_properties = None
self.__properties = None
self.__per_page = None
self.__visibility = None
self.__convertable = None
self.__editable = None
self.__emailtemplate_support = None
self.__profiles = None
self.__filter_supported = None
self.__display_field = None
self.__search_layout_fields = None
self.__kanban_view_supported = None
self.__show_as_tab = None
self.__web_link = None
self.__sequence_number = None
self.__singular_label = None
self.__viewable = None
self.__api_supported = None
self.__api_name = None
self.__quick_create = None
self.__modified_by = None
self.__generated_type = None
self.__feeds_required = None
self.__scoring_supported = None
self.__webform_supported = None
self.__arguments = None
self.__module_name = None
self.__business_card_field_limit = None
self.__custom_view = None
self.__parent_module = None
self.__territory = None
self.__key_modified = dict()
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_global_search_supported(self):
"""
The method to get the global_search_supported
Returns:
bool: A bool representing the global_search_supported
"""
return self.__global_search_supported
def set_global_search_supported(self, global_search_supported):
"""
The method to set the value to global_search_supported
Parameters:
global_search_supported (bool) : A bool representing the global_search_supported
"""
if global_search_supported is not None and not isinstance(global_search_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: global_search_supported EXPECTED TYPE: bool', None, None)
self.__global_search_supported = global_search_supported
self.__key_modified['global_search_supported'] = 1
def get_kanban_view(self):
"""
The method to get the kanban_view
Returns:
bool: A bool representing the kanban_view
"""
return self.__kanban_view
def set_kanban_view(self, kanban_view):
"""
The method to set the value to kanban_view
Parameters:
kanban_view (bool) : A bool representing the kanban_view
"""
if kanban_view is not None and not isinstance(kanban_view, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: kanban_view EXPECTED TYPE: bool', None, None)
self.__kanban_view = kanban_view
self.__key_modified['kanban_view'] = 1
def get_deletable(self):
"""
The method to get the deletable
Returns:
bool: A bool representing the deletable
"""
return self.__deletable
def set_deletable(self, deletable):
"""
The method to set the value to deletable
Parameters:
deletable (bool) : A bool representing the deletable
"""
if deletable is not None and not isinstance(deletable, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deletable EXPECTED TYPE: bool', None, None)
self.__deletable = deletable
self.__key_modified['deletable'] = 1
def get_description(self):
"""
The method to get the description
Returns:
string: A string representing the description
"""
return self.__description
def set_description(self, description):
"""
The method to set the value to description
Parameters:
description (string) : A string representing the description
"""
if description is not None and not isinstance(description, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: description EXPECTED TYPE: str', None, None)
self.__description = description
self.__key_modified['description'] = 1
def get_creatable(self):
"""
The method to get the creatable
Returns:
bool: A bool representing the creatable
"""
return self.__creatable
def set_creatable(self, creatable):
"""
The method to set the value to creatable
Parameters:
creatable (bool) : A bool representing the creatable
"""
if creatable is not None and not isinstance(creatable, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: creatable EXPECTED TYPE: bool', None, None)
self.__creatable = creatable
self.__key_modified['creatable'] = 1
def get_filter_status(self):
"""
The method to get the filter_status
Returns:
bool: A bool representing the filter_status
"""
return self.__filter_status
def set_filter_status(self, filter_status):
"""
The method to set the value to filter_status
Parameters:
filter_status (bool) : A bool representing the filter_status
"""
if filter_status is not None and not isinstance(filter_status, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: filter_status EXPECTED TYPE: bool', None, None)
self.__filter_status = filter_status
self.__key_modified['filter_status'] = 1
def get_inventory_template_supported(self):
"""
The method to get the inventory_template_supported
Returns:
bool: A bool representing the inventory_template_supported
"""
return self.__inventory_template_supported
def set_inventory_template_supported(self, inventory_template_supported):
"""
The method to set the value to inventory_template_supported
Parameters:
inventory_template_supported (bool) : A bool representing the inventory_template_supported
"""
if inventory_template_supported is not None and not isinstance(inventory_template_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: inventory_template_supported EXPECTED TYPE: bool', None, None)
self.__inventory_template_supported = inventory_template_supported
self.__key_modified['inventory_template_supported'] = 1
def get_modified_time(self):
"""
The method to get the modified_time
Returns:
datetime: An instance of datetime
"""
return self.__modified_time
def set_modified_time(self, modified_time):
"""
The method to set the value to modified_time
Parameters:
modified_time (datetime) : An instance of datetime
"""
from datetime import datetime
if modified_time is not None and not isinstance(modified_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modified_time EXPECTED TYPE: datetime', None, None)
self.__modified_time = modified_time
self.__key_modified['modified_time'] = 1
def get_plural_label(self):
"""
The method to get the plural_label
Returns:
string: A string representing the plural_label
"""
return self.__plural_label
def set_plural_label(self, plural_label):
"""
The method to set the value to plural_label
Parameters:
plural_label (string) : A string representing the plural_label
"""
if plural_label is not None and not isinstance(plural_label, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: plural_label EXPECTED TYPE: str', None, None)
self.__plural_label = plural_label
self.__key_modified['plural_label'] = 1
def get_presence_sub_menu(self):
"""
The method to get the presence_sub_menu
Returns:
bool: A bool representing the presence_sub_menu
"""
return self.__presence_sub_menu
def set_presence_sub_menu(self, presence_sub_menu):
"""
The method to set the value to presence_sub_menu
Parameters:
presence_sub_menu (bool) : A bool representing the presence_sub_menu
"""
if presence_sub_menu is not None and not isinstance(presence_sub_menu, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: presence_sub_menu EXPECTED TYPE: bool', None, None)
self.__presence_sub_menu = presence_sub_menu
self.__key_modified['presence_sub_menu'] = 1
def get_triggers_supported(self):
"""
The method to get the triggers_supported
Returns:
bool: A bool representing the triggers_supported
"""
return self.__triggers_supported
def set_triggers_supported(self, triggers_supported):
"""
The method to set the value to triggers_supported
Parameters:
triggers_supported (bool) : A bool representing the triggers_supported
"""
if triggers_supported is not None and not isinstance(triggers_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: triggers_supported EXPECTED TYPE: bool', None, None)
self.__triggers_supported = triggers_supported
self.__key_modified['triggers_supported'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_related_list_properties(self):
"""
The method to get the related_list_properties
Returns:
RelatedListProperties: An instance of RelatedListProperties
"""
return self.__related_list_properties
def set_related_list_properties(self, related_list_properties):
"""
The method to set the value to related_list_properties
Parameters:
related_list_properties (RelatedListProperties) : An instance of RelatedListProperties
"""
try:
from zcrmsdk.src.com.zoho.crm.api.modules.related_list_properties import RelatedListProperties
except Exception:
from .related_list_properties import RelatedListProperties
if related_list_properties is not None and not isinstance(related_list_properties, RelatedListProperties):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: related_list_properties EXPECTED TYPE: RelatedListProperties', None, None)
self.__related_list_properties = related_list_properties
self.__key_modified['related_list_properties'] = 1
def get_properties(self):
"""
The method to get the properties
Returns:
list: An instance of list
"""
return self.__properties
def set_properties(self, properties):
"""
The method to set the value to properties
Parameters:
properties (list) : An instance of list
"""
if properties is not None and not isinstance(properties, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: properties EXPECTED TYPE: list', None, None)
self.__properties = properties
self.__key_modified['$properties'] = 1
def get_per_page(self):
"""
The method to get the per_page
Returns:
int: An int representing the per_page
"""
return self.__per_page
def set_per_page(self, per_page):
"""
The method to set the value to per_page
Parameters:
per_page (int) : An int representing the per_page
"""
if per_page is not None and not isinstance(per_page, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: per_page EXPECTED TYPE: int', None, None)
self.__per_page = per_page
self.__key_modified['per_page'] = 1
def get_visibility(self):
"""
The method to get the visibility
Returns:
int: An int representing the visibility
"""
return self.__visibility
def set_visibility(self, visibility):
"""
The method to set the value to visibility
Parameters:
visibility (int) : An int representing the visibility
"""
if visibility is not None and not isinstance(visibility, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: visibility EXPECTED TYPE: int', None, None)
self.__visibility = visibility
self.__key_modified['visibility'] = 1
def get_convertable(self):
"""
The method to get the convertable
Returns:
bool: A bool representing the convertable
"""
return self.__convertable
def set_convertable(self, convertable):
"""
The method to set the value to convertable
Parameters:
convertable (bool) : A bool representing the convertable
"""
if convertable is not None and not isinstance(convertable, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: convertable EXPECTED TYPE: bool', None, None)
self.__convertable = convertable
self.__key_modified['convertable'] = 1
def get_editable(self):
"""
The method to get the editable
Returns:
bool: A bool representing the editable
"""
return self.__editable
def set_editable(self, editable):
"""
The method to set the value to editable
Parameters:
editable (bool) : A bool representing the editable
"""
if editable is not None and not isinstance(editable, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: editable EXPECTED TYPE: bool', None, None)
self.__editable = editable
self.__key_modified['editable'] = 1
def get_emailtemplate_support(self):
"""
The method to get the emailtemplate_support
Returns:
bool: A bool representing the emailtemplate_support
"""
return self.__emailtemplate_support
def set_emailtemplate_support(self, emailtemplate_support):
"""
The method to set the value to emailtemplate_support
Parameters:
emailtemplate_support (bool) : A bool representing the emailtemplate_support
"""
if emailtemplate_support is not None and not isinstance(emailtemplate_support, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: emailtemplate_support EXPECTED TYPE: bool', None, None)
self.__emailtemplate_support = emailtemplate_support
self.__key_modified['emailTemplate_support'] = 1
def get_profiles(self):
"""
The method to get the profiles
Returns:
list: An instance of list
"""
return self.__profiles
def set_profiles(self, profiles):
"""
The method to set the value to profiles
Parameters:
profiles (list) : An instance of list
"""
if profiles is not None and not isinstance(profiles, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: profiles EXPECTED TYPE: list', None, None)
self.__profiles = profiles
self.__key_modified['profiles'] = 1
def get_filter_supported(self):
"""
The method to get the filter_supported
Returns:
bool: A bool representing the filter_supported
"""
return self.__filter_supported
def set_filter_supported(self, filter_supported):
"""
The method to set the value to filter_supported
Parameters:
filter_supported (bool) : A bool representing the filter_supported
"""
if filter_supported is not None and not isinstance(filter_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: filter_supported EXPECTED TYPE: bool', None, None)
self.__filter_supported = filter_supported
self.__key_modified['filter_supported'] = 1
def get_display_field(self):
"""
The method to get the display_field
Returns:
string: A string representing the display_field
"""
return self.__display_field
def set_display_field(self, display_field):
"""
The method to set the value to display_field
Parameters:
display_field (string) : A string representing the display_field
"""
if display_field is not None and not isinstance(display_field, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: display_field EXPECTED TYPE: str', None, None)
self.__display_field = display_field
self.__key_modified['display_field'] = 1
def get_search_layout_fields(self):
"""
The method to get the search_layout_fields
Returns:
list: An instance of list
"""
return self.__search_layout_fields
def set_search_layout_fields(self, search_layout_fields):
"""
The method to set the value to search_layout_fields
Parameters:
search_layout_fields (list) : An instance of list
"""
if search_layout_fields is not None and not isinstance(search_layout_fields, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: search_layout_fields EXPECTED TYPE: list', None, None)
self.__search_layout_fields = search_layout_fields
self.__key_modified['search_layout_fields'] = 1
def get_kanban_view_supported(self):
"""
The method to get the kanban_view_supported
Returns:
bool: A bool representing the kanban_view_supported
"""
return self.__kanban_view_supported
def set_kanban_view_supported(self, kanban_view_supported):
"""
The method to set the value to kanban_view_supported
Parameters:
kanban_view_supported (bool) : A bool representing the kanban_view_supported
"""
if kanban_view_supported is not None and not isinstance(kanban_view_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: kanban_view_supported EXPECTED TYPE: bool', None, None)
self.__kanban_view_supported = kanban_view_supported
self.__key_modified['kanban_view_supported'] = 1
def get_show_as_tab(self):
"""
The method to get the show_as_tab
Returns:
bool: A bool representing the show_as_tab
"""
return self.__show_as_tab
def set_show_as_tab(self, show_as_tab):
"""
The method to set the value to show_as_tab
Parameters:
show_as_tab (bool) : A bool representing the show_as_tab
"""
if show_as_tab is not None and not isinstance(show_as_tab, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: show_as_tab EXPECTED TYPE: bool', None, None)
self.__show_as_tab = show_as_tab
self.__key_modified['show_as_tab'] = 1
def get_web_link(self):
"""
The method to get the web_link
Returns:
string: A string representing the web_link
"""
return self.__web_link
def set_web_link(self, web_link):
"""
The method to set the value to web_link
Parameters:
web_link (string) : A string representing the web_link
"""
if web_link is not None and not isinstance(web_link, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: web_link EXPECTED TYPE: str', None, None)
self.__web_link = web_link
self.__key_modified['web_link'] = 1
def get_sequence_number(self):
"""
The method to get the sequence_number
Returns:
int: An int representing the sequence_number
"""
return self.__sequence_number
def set_sequence_number(self, sequence_number):
"""
The method to set the value to sequence_number
Parameters:
sequence_number (int) : An int representing the sequence_number
"""
if sequence_number is not None and not isinstance(sequence_number, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sequence_number EXPECTED TYPE: int', None, None)
self.__sequence_number = sequence_number
self.__key_modified['sequence_number'] = 1
def get_singular_label(self):
"""
The method to get the singular_label
Returns:
string: A string representing the singular_label
"""
return self.__singular_label
def set_singular_label(self, singular_label):
"""
The method to set the value to singular_label
Parameters:
singular_label (string) : A string representing the singular_label
"""
if singular_label is not None and not isinstance(singular_label, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: singular_label EXPECTED TYPE: str', None, None)
self.__singular_label = singular_label
self.__key_modified['singular_label'] = 1
def get_viewable(self):
"""
The method to get the viewable
Returns:
bool: A bool representing the viewable
"""
return self.__viewable
def set_viewable(self, viewable):
"""
The method to set the value to viewable
Parameters:
viewable (bool) : A bool representing the viewable
"""
if viewable is not None and not isinstance(viewable, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: viewable EXPECTED TYPE: bool', None, None)
self.__viewable = viewable
self.__key_modified['viewable'] = 1
def get_api_supported(self):
"""
The method to get the api_supported
Returns:
bool: A bool representing the api_supported
"""
return self.__api_supported
def set_api_supported(self, api_supported):
"""
The method to set the value to api_supported
Parameters:
api_supported (bool) : A bool representing the api_supported
"""
if api_supported is not None and not isinstance(api_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_supported EXPECTED TYPE: bool', None, None)
self.__api_supported = api_supported
self.__key_modified['api_supported'] = 1
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
def set_api_name(self, api_name):
"""
The method to set the value to api_name
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
self.__key_modified['api_name'] = 1
def get_quick_create(self):
"""
The method to get the quick_create
Returns:
bool: A bool representing the quick_create
"""
return self.__quick_create
def set_quick_create(self, quick_create):
"""
The method to set the value to quick_create
Parameters:
quick_create (bool) : A bool representing the quick_create
"""
if quick_create is not None and not isinstance(quick_create, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: quick_create EXPECTED TYPE: bool', None, None)
self.__quick_create = quick_create
self.__key_modified['quick_create'] = 1
def get_modified_by(self):
"""
The method to get the modified_by
Returns:
User: An instance of User
"""
return self.__modified_by
def set_modified_by(self, modified_by):
"""
The method to set the value to modified_by
Parameters:
modified_by (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if modified_by is not None and not isinstance(modified_by, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modified_by EXPECTED TYPE: User', None, None)
self.__modified_by = modified_by
self.__key_modified['modified_by'] = 1
def get_generated_type(self):
"""
The method to get the generated_type
Returns:
Choice: An instance of Choice
"""
return self.__generated_type
def set_generated_type(self, generated_type):
"""
The method to set the value to generated_type
Parameters:
generated_type (Choice) : An instance of Choice
"""
if generated_type is not None and not isinstance(generated_type, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: generated_type EXPECTED TYPE: Choice', None, None)
self.__generated_type = generated_type
self.__key_modified['generated_type'] = 1
def get_feeds_required(self):
"""
The method to get the feeds_required
Returns:
bool: A bool representing the feeds_required
"""
return self.__feeds_required
def set_feeds_required(self, feeds_required):
"""
The method to set the value to feeds_required
Parameters:
feeds_required (bool) : A bool representing the feeds_required
"""
if feeds_required is not None and not isinstance(feeds_required, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: feeds_required EXPECTED TYPE: bool', None, None)
self.__feeds_required = feeds_required
self.__key_modified['feeds_required'] = 1
def get_scoring_supported(self):
"""
The method to get the scoring_supported
Returns:
bool: A bool representing the scoring_supported
"""
return self.__scoring_supported
def set_scoring_supported(self, scoring_supported):
"""
The method to set the value to scoring_supported
Parameters:
scoring_supported (bool) : A bool representing the scoring_supported
"""
if scoring_supported is not None and not isinstance(scoring_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: scoring_supported EXPECTED TYPE: bool', None, None)
self.__scoring_supported = scoring_supported
self.__key_modified['scoring_supported'] = 1
def get_webform_supported(self):
"""
The method to get the webform_supported
Returns:
bool: A bool representing the webform_supported
"""
return self.__webform_supported
def set_webform_supported(self, webform_supported):
"""
The method to set the value to webform_supported
Parameters:
webform_supported (bool) : A bool representing the webform_supported
"""
if webform_supported is not None and not isinstance(webform_supported, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: webform_supported EXPECTED TYPE: bool', None, None)
self.__webform_supported = webform_supported
self.__key_modified['webform_supported'] = 1
def get_arguments(self):
"""
The method to get the arguments
Returns:
list: An instance of list
"""
return self.__arguments
def set_arguments(self, arguments):
"""
The method to set the value to arguments
Parameters:
arguments (list) : An instance of list
"""
if arguments is not None and not isinstance(arguments, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: arguments EXPECTED TYPE: list', None, None)
self.__arguments = arguments
self.__key_modified['arguments'] = 1
def get_module_name(self):
"""
The method to get the module_name
Returns:
string: A string representing the module_name
"""
return self.__module_name
def set_module_name(self, module_name):
"""
The method to set the value to module_name
Parameters:
module_name (string) : A string representing the module_name
"""
if module_name is not None and not isinstance(module_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_name EXPECTED TYPE: str', None, None)
self.__module_name = module_name
self.__key_modified['module_name'] = 1
def get_business_card_field_limit(self):
"""
The method to get the business_card_field_limit
Returns:
int: An int representing the business_card_field_limit
"""
return self.__business_card_field_limit
def set_business_card_field_limit(self, business_card_field_limit):
"""
The method to set the value to business_card_field_limit
Parameters:
business_card_field_limit (int) : An int representing the business_card_field_limit
"""
if business_card_field_limit is not None and not isinstance(business_card_field_limit, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: business_card_field_limit EXPECTED TYPE: int', None, None)
self.__business_card_field_limit = business_card_field_limit
self.__key_modified['business_card_field_limit'] = 1
def get_custom_view(self):
"""
The method to get the custom_view
Returns:
CustomView: An instance of CustomView
"""
return self.__custom_view
def set_custom_view(self, custom_view):
"""
The method to set the value to custom_view
Parameters:
custom_view (CustomView) : An instance of CustomView
"""
try:
from zcrmsdk.src.com.zoho.crm.api.customviews import CustomView
except Exception:
from ..custom_views import CustomView
if custom_view is not None and not isinstance(custom_view, CustomView):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: custom_view EXPECTED TYPE: CustomView', None, None)
self.__custom_view = custom_view
self.__key_modified['custom_view'] = 1
def get_parent_module(self):
"""
The method to get the parent_module
Returns:
Module: An instance of Module
"""
return self.__parent_module
def set_parent_module(self, parent_module):
"""
The method to set the value to parent_module
Parameters:
parent_module (Module) : An instance of Module
"""
try:
from zcrmsdk.src.com.zoho.crm.api.modules.module import Module
except Exception:
from .module import Module
if parent_module is not None and not isinstance(parent_module, Module):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: parent_module EXPECTED TYPE: Module', None, None)
self.__parent_module = parent_module
self.__key_modified['parent_module'] = 1
def get_territory(self):
"""
The method to get the territory
Returns:
Territory: An instance of Territory
"""
return self.__territory
def set_territory(self, territory):
"""
The method to set the value to territory
Parameters:
territory (Territory) : An instance of Territory
"""
try:
from zcrmsdk.src.com.zoho.crm.api.modules.territory import Territory
except Exception:
from .territory import Territory
if territory is not None and not isinstance(territory, Territory):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: territory EXPECTED TYPE: Territory', None, None)
self.__territory = territory
self.__key_modified['territory'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/module.py | module.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class RelatedListProperties(object):
def __init__(self):
"""Creates an instance of RelatedListProperties"""
self.__sort_by = None
self.__fields = None
self.__sort_order = None
self.__key_modified = dict()
def get_sort_by(self):
"""
The method to get the sort_by
Returns:
string: A string representing the sort_by
"""
return self.__sort_by
def set_sort_by(self, sort_by):
"""
The method to set the value to sort_by
Parameters:
sort_by (string) : A string representing the sort_by
"""
if sort_by is not None and not isinstance(sort_by, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_by EXPECTED TYPE: str', None, None)
self.__sort_by = sort_by
self.__key_modified['sort_by'] = 1
def get_fields(self):
"""
The method to get the fields
Returns:
list: An instance of list
"""
return self.__fields
def set_fields(self, fields):
"""
The method to set the value to fields
Parameters:
fields (list) : An instance of list
"""
if fields is not None and not isinstance(fields, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: fields EXPECTED TYPE: list', None, None)
self.__fields = fields
self.__key_modified['fields'] = 1
def get_sort_order(self):
"""
The method to get the sort_order
Returns:
string: A string representing the sort_order
"""
return self.__sort_order
def set_sort_order(self, sort_order):
"""
The method to set the value to sort_order
Parameters:
sort_order (string) : A string representing the sort_order
"""
if sort_order is not None and not isinstance(sort_order, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_order EXPECTED TYPE: str', None, None)
self.__sort_order = sort_order
self.__key_modified['sort_order'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/related_list_properties.py | related_list_properties.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.modules.action_response import ActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
class SuccessResponse(ActionResponse):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
from zcrmsdk.src.com.zoho.crm.api.header import Header
from zcrmsdk.src.com.zoho.crm.api.header_map import HeaderMap
except Exception:
from ..exception import SDKException
from ..util import APIResponse, CommonAPIHandler, Constants
from ..header import Header
from ..header_map import HeaderMap
class ModulesOperations(object):
def __init__(self):
"""Creates an instance of ModulesOperations"""
pass
def get_modules(self, header_instance=None):
"""
The method to get modules
Parameters:
header_instance (HeaderMap) : An instance of HeaderMap
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
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/settings/modules'
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_header(header_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.modules.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def get_module(self, api_name):
"""
The method to get module
Parameters:
api_name (string) : A string representing the api_name
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
if not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
handler_instance = CommonAPIHandler()
api_path = ''
api_path = api_path + '/crm/v2/settings/modules/'
api_path = api_path + str(api_name)
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)
try:
from zcrmsdk.src.com.zoho.crm.api.modules.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def update_module_by_api_name(self, api_name, request):
"""
The method to update module by api name
Parameters:
api_name (string) : A string representing the api_name
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.modules.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', 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/settings/modules/'
api_path = api_path + str(api_name)
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)
try:
from zcrmsdk.src.com.zoho.crm.api.modules.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def update_module_by_id(self, id, request):
"""
The method to update module by id
Parameters:
id (int) : An int representing the id
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.modules.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: 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/settings/modules/'
api_path = api_path + str(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)
try:
from zcrmsdk.src.com.zoho.crm.api.modules.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
class GetModulesHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Modules.GetModulesHeader') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/modules/modules_operations.py | modules_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.variables.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .action_handler import ActionHandler
class ActionWrapper(ActionHandler):
def __init__(self):
"""Creates an instance of ActionWrapper"""
super().__init__()
self.__variables = None
self.__key_modified = dict()
def get_variables(self):
"""
The method to get the variables
Returns:
list: An instance of list
"""
return self.__variables
def set_variables(self, variables):
"""
The method to set the value to variables
Parameters:
variables (list) : An instance of list
"""
if variables is not None and not isinstance(variables, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: variables EXPECTED TYPE: list', None, None)
self.__variables = variables
self.__key_modified['variables'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/action_wrapper.py | action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.variables.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__variables = None
self.__key_modified = dict()
def get_variables(self):
"""
The method to get the variables
Returns:
list: An instance of list
"""
return self.__variables
def set_variables(self, variables):
"""
The method to set the value to variables
Parameters:
variables (list) : An instance of list
"""
if variables is not None and not isinstance(variables, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: variables EXPECTED TYPE: list', None, None)
self.__variables = variables
self.__key_modified['variables'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.variables.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.variables.response_handler import ResponseHandler
from zcrmsdk.src.com.zoho.crm.api.variables.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .response_handler import ResponseHandler
from .action_handler import ActionHandler
class APIException(ResponseHandler, ActionResponse, ActionHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.parameter_map import ParameterMap
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
from zcrmsdk.src.com.zoho.crm.api.param import Param
except Exception:
from ..exception import SDKException
from ..parameter_map import ParameterMap
from ..util import APIResponse, CommonAPIHandler, Constants
from ..param import Param
class VariablesOperations(object):
def __init__(self):
"""Creates an instance of VariablesOperations"""
pass
def get_variables(self, param_instance=None):
"""
The method to get variables
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/settings/variables'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def create_variables(self, request):
"""
The method to create variables
Parameters:
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.variables.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/settings/variables'
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.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def update_variables(self, request):
"""
The method to update variables
Parameters:
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.variables.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/settings/variables'
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.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_variables(self, param_instance=None):
"""
The method to delete variables
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/settings/variables'
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)
handler_instance.set_param(param_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def get_variable_by_id(self, id, param_instance=None):
"""
The method to get variable by id
Parameters:
id (int) : An int representing the id
param_instance (ParameterMap) : An instance of ParameterMap
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 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/settings/variables/'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def update_variable_by_id(self, id, request):
"""
The method to update variable by id
Parameters:
id (int) : An int representing the id
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.variables.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: 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/settings/variables/'
api_path = api_path + str(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)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_variable(self, id):
"""
The method to delete variable
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/settings/variables/'
api_path = api_path + str(id)
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.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def get_variable_for_api_name(self, api_name, param_instance=None):
"""
The method to get variable for api name
Parameters:
api_name (string) : A string representing the api_name
param_instance (ParameterMap) : An instance of ParameterMap
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
if not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: 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/settings/variables/'
api_path = api_path + str(api_name)
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)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def update_variable_by_api_name(self, api_name, request):
"""
The method to update variable by api name
Parameters:
api_name (string) : A string representing the api_name
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.variables.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', 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/settings/variables/'
api_path = api_path + str(api_name)
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)
try:
from zcrmsdk.src.com.zoho.crm.api.variables.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
class GetVariablesParam(object):
group = Param('group', 'com.zoho.crm.api.Variables.GetVariablesParam')
class DeleteVariablesParam(object):
ids = Param('ids', 'com.zoho.crm.api.Variables.DeleteVariablesParam')
class GetVariableByIDParam(object):
group = Param('group', 'com.zoho.crm.api.Variables.GetVariableByIDParam')
class GetVariableForAPINameParam(object):
group = Param('group', 'com.zoho.crm.api.Variables.GetVariableForAPINameParam') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/variables_operations.py | variables_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Variable(object):
def __init__(self):
"""Creates an instance of Variable"""
self.__api_name = None
self.__name = None
self.__description = None
self.__id = None
self.__type = None
self.__variable_group = None
self.__value = None
self.__key_modified = dict()
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
def set_api_name(self, api_name):
"""
The method to set the value to api_name
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
self.__key_modified['api_name'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_description(self):
"""
The method to get the description
Returns:
string: A string representing the description
"""
return self.__description
def set_description(self, description):
"""
The method to set the value to description
Parameters:
description (string) : A string representing the description
"""
if description is not None and not isinstance(description, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: description EXPECTED TYPE: str', None, None)
self.__description = description
self.__key_modified['description'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.__type
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.__type = type
self.__key_modified['type'] = 1
def get_variable_group(self):
"""
The method to get the variable_group
Returns:
VariableGroup: An instance of VariableGroup
"""
return self.__variable_group
def set_variable_group(self, variable_group):
"""
The method to set the value to variable_group
Parameters:
variable_group (VariableGroup) : An instance of VariableGroup
"""
try:
from zcrmsdk.src.com.zoho.crm.api.variablegroups import VariableGroup
except Exception:
from ..variable_groups import VariableGroup
if variable_group is not None and not isinstance(variable_group, VariableGroup):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: variable_group EXPECTED TYPE: VariableGroup', None, None)
self.__variable_group = variable_group
self.__key_modified['variable_group'] = 1
def get_value(self):
"""
The method to get the value
Returns:
Object: A Object representing the value
"""
return self.__value
def set_value(self, value):
"""
The method to set the value to value
Parameters:
value (Object) : A Object representing the value
"""
self.__value = value
self.__key_modified['value'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/variable.py | variable.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.variables.action_response import ActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
class SuccessResponse(ActionResponse):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/variables/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.roles.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__roles = None
self.__key_modified = dict()
def get_roles(self):
"""
The method to get the roles
Returns:
list: An instance of list
"""
return self.__roles
def set_roles(self, roles):
"""
The method to set the value to roles
Parameters:
roles (list) : An instance of list
"""
if roles is not None and not isinstance(roles, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: roles EXPECTED TYPE: list', None, None)
self.__roles = roles
self.__key_modified['roles'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/roles/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.roles.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .response_handler import ResponseHandler
class APIException(ResponseHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/roles/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Role(object):
def __init__(self):
"""Creates an instance of Role"""
self.__display_label = None
self.__forecast_manager = None
self.__share_with_peers = None
self.__name = None
self.__description = None
self.__id = None
self.__reporting_to = None
self.__admin_user = None
self.__key_modified = dict()
def get_display_label(self):
"""
The method to get the display_label
Returns:
string: A string representing the display_label
"""
return self.__display_label
def set_display_label(self, display_label):
"""
The method to set the value to display_label
Parameters:
display_label (string) : A string representing the display_label
"""
if display_label is not None and not isinstance(display_label, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: display_label EXPECTED TYPE: str', None, None)
self.__display_label = display_label
self.__key_modified['display_label'] = 1
def get_forecast_manager(self):
"""
The method to get the forecast_manager
Returns:
User: An instance of User
"""
return self.__forecast_manager
def set_forecast_manager(self, forecast_manager):
"""
The method to set the value to forecast_manager
Parameters:
forecast_manager (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if forecast_manager is not None and not isinstance(forecast_manager, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: forecast_manager EXPECTED TYPE: User', None, None)
self.__forecast_manager = forecast_manager
self.__key_modified['forecast_manager'] = 1
def get_share_with_peers(self):
"""
The method to get the share_with_peers
Returns:
bool: A bool representing the share_with_peers
"""
return self.__share_with_peers
def set_share_with_peers(self, share_with_peers):
"""
The method to set the value to share_with_peers
Parameters:
share_with_peers (bool) : A bool representing the share_with_peers
"""
if share_with_peers is not None and not isinstance(share_with_peers, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: share_with_peers EXPECTED TYPE: bool', None, None)
self.__share_with_peers = share_with_peers
self.__key_modified['share_with_peers'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_description(self):
"""
The method to get the description
Returns:
string: A string representing the description
"""
return self.__description
def set_description(self, description):
"""
The method to set the value to description
Parameters:
description (string) : A string representing the description
"""
if description is not None and not isinstance(description, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: description EXPECTED TYPE: str', None, None)
self.__description = description
self.__key_modified['description'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_reporting_to(self):
"""
The method to get the reporting_to
Returns:
User: An instance of User
"""
return self.__reporting_to
def set_reporting_to(self, reporting_to):
"""
The method to set the value to reporting_to
Parameters:
reporting_to (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if reporting_to is not None and not isinstance(reporting_to, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: reporting_to EXPECTED TYPE: User', None, None)
self.__reporting_to = reporting_to
self.__key_modified['reporting_to'] = 1
def get_admin_user(self):
"""
The method to get the admin_user
Returns:
bool: A bool representing the admin_user
"""
return self.__admin_user
def set_admin_user(self, admin_user):
"""
The method to set the value to admin_user
Parameters:
admin_user (bool) : A bool representing the admin_user
"""
if admin_user is not None and not isinstance(admin_user, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: admin_user EXPECTED TYPE: bool', None, None)
self.__admin_user = admin_user
self.__key_modified['admin_user'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/roles/role.py | role.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .action_handler import ActionHandler
class ActionWrapper(ActionHandler):
def __init__(self):
"""Creates an instance of ActionWrapper"""
super().__init__()
self.__data = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/action_wrapper.py | action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Field(object):
def __init__(self, api_name):
"""
Creates an instance of Field with the given parameters
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
class Products(object):
@classmethod
def product_category(cls):
return Field('Product_Category')
@classmethod
def qty_in_demand(cls):
return Field('Qty_in_Demand')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def vendor_name(cls):
return Field('Vendor_Name')
@classmethod
def tax(cls):
return Field('Tax')
@classmethod
def sales_start_date(cls):
return Field('Sales_Start_Date')
@classmethod
def product_active(cls):
return Field('Product_Active')
@classmethod
def record_image(cls):
return Field('Record_Image')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def product_code(cls):
return Field('Product_Code')
@classmethod
def manufacturer(cls):
return Field('Manufacturer')
@classmethod
def id(cls):
return Field('id')
@classmethod
def support_expiry_date(cls):
return Field('Support_Expiry_Date')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def commission_rate(cls):
return Field('Commission_Rate')
@classmethod
def product_name(cls):
return Field('Product_Name')
@classmethod
def handler(cls):
return Field('Handler')
@classmethod
def support_start_date(cls):
return Field('Support_Start_Date')
@classmethod
def usage_unit(cls):
return Field('Usage_Unit')
@classmethod
def qty_ordered(cls):
return Field('Qty_Ordered')
@classmethod
def qty_in_stock(cls):
return Field('Qty_in_Stock')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def sales_end_date(cls):
return Field('Sales_End_Date')
@classmethod
def unit_price(cls):
return Field('Unit_Price')
@classmethod
def taxable(cls):
return Field('Taxable')
@classmethod
def reorder_level(cls):
return Field('Reorder_Level')
class Tasks(object):
@classmethod
def status(cls):
return Field('Status')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def due_date(cls):
return Field('Due_Date')
@classmethod
def priority(cls):
return Field('Priority')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def closed_time(cls):
return Field('Closed_Time')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def send_notification_email(cls):
return Field('Send_Notification_Email')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def recurring_activity(cls):
return Field('Recurring_Activity')
@classmethod
def what_id(cls):
return Field('What_Id')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def remind_at(cls):
return Field('Remind_At')
@classmethod
def who_id(cls):
return Field('Who_Id')
class Vendors(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def email(cls):
return Field('Email')
@classmethod
def category(cls):
return Field('Category')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def vendor_name(cls):
return Field('Vendor_Name')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def website(cls):
return Field('Website')
@classmethod
def city(cls):
return Field('City')
@classmethod
def record_image(cls):
return Field('Record_Image')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def phone(cls):
return Field('Phone')
@classmethod
def state(cls):
return Field('State')
@classmethod
def gl_account(cls):
return Field('GL_Account')
@classmethod
def street(cls):
return Field('Street')
@classmethod
def country(cls):
return Field('Country')
@classmethod
def zip_code(cls):
return Field('Zip_Code')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
class Calls(object):
@classmethod
def call_duration(cls):
return Field('Call_Duration')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def reminder(cls):
return Field('Reminder')
@classmethod
def caller_id(cls):
return Field('Caller_ID')
@classmethod
def cti_entry(cls):
return Field('CTI_Entry')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def call_start_time(cls):
return Field('Call_Start_Time')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def call_agenda(cls):
return Field('Call_Agenda')
@classmethod
def call_result(cls):
return Field('Call_Result')
@classmethod
def call_type(cls):
return Field('Call_Type')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def what_id(cls):
return Field('What_Id')
@classmethod
def call_duration_in_seconds(cls):
return Field('Call_Duration_in_seconds')
@classmethod
def call_purpose(cls):
return Field('Call_Purpose')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def dialled_number(cls):
return Field('Dialled_Number')
@classmethod
def call_status(cls):
return Field('Call_Status')
@classmethod
def who_id(cls):
return Field('Who_Id')
class Leads(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def company(cls):
return Field('Company')
@classmethod
def email(cls):
return Field('Email')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def rating(cls):
return Field('Rating')
@classmethod
def website(cls):
return Field('Website')
@classmethod
def twitter(cls):
return Field('Twitter')
@classmethod
def salutation(cls):
return Field('Salutation')
@classmethod
def last_activity_time(cls):
return Field('Last_Activity_Time')
@classmethod
def first_name(cls):
return Field('First_Name')
@classmethod
def full_name(cls):
return Field('Full_Name')
@classmethod
def lead_status(cls):
return Field('Lead_Status')
@classmethod
def industry(cls):
return Field('Industry')
@classmethod
def record_image(cls):
return Field('Record_Image')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def skype_id(cls):
return Field('Skype_ID')
@classmethod
def phone(cls):
return Field('Phone')
@classmethod
def street(cls):
return Field('Street')
@classmethod
def zip_code(cls):
return Field('Zip_Code')
@classmethod
def id(cls):
return Field('id')
@classmethod
def email_opt_out(cls):
return Field('Email_Opt_Out')
@classmethod
def designation(cls):
return Field('Designation')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def city(cls):
return Field('City')
@classmethod
def no_of_employees(cls):
return Field('No_of_Employees')
@classmethod
def mobile(cls):
return Field('Mobile')
@classmethod
def converted_date_time(cls):
return Field('Converted_Date_Time')
@classmethod
def last_name(cls):
return Field('Last_Name')
@classmethod
def layout(cls):
return Field('Layout')
@classmethod
def state(cls):
return Field('State')
@classmethod
def lead_source(cls):
return Field('Lead_Source')
@classmethod
def is_record_duplicate(cls):
return Field('Is_Record_Duplicate')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def fax(cls):
return Field('Fax')
@classmethod
def annual_revenue(cls):
return Field('Annual_Revenue')
@classmethod
def secondary_email(cls):
return Field('Secondary_Email')
class Deals(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def campaign_source(cls):
return Field('Campaign_Source')
@classmethod
def closing_date(cls):
return Field('Closing_Date')
@classmethod
def last_activity_time(cls):
return Field('Last_Activity_Time')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def lead_conversion_time(cls):
return Field('Lead_Conversion_Time')
@classmethod
def deal_name(cls):
return Field('Deal_Name')
@classmethod
def expected_revenue(cls):
return Field('Expected_Revenue')
@classmethod
def overall_sales_duration(cls):
return Field('Overall_Sales_Duration')
@classmethod
def stage(cls):
return Field('Stage')
@classmethod
def id(cls):
return Field('id')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def territory(cls):
return Field('Territory')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def amount(cls):
return Field('Amount')
@classmethod
def probability(cls):
return Field('Probability')
@classmethod
def next_step(cls):
return Field('Next_Step')
@classmethod
def contact_name(cls):
return Field('Contact_Name')
@classmethod
def sales_cycle_duration(cls):
return Field('Sales_Cycle_Duration')
@classmethod
def type(cls):
return Field('Type')
@classmethod
def deal_category_status(cls):
return Field('Deal_Category_Status')
@classmethod
def lead_source(cls):
return Field('Lead_Source')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
class Campaigns(object):
@classmethod
def status(cls):
return Field('Status')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def campaign_name(cls):
return Field('Campaign_Name')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def end_date(cls):
return Field('End_Date')
@classmethod
def type(cls):
return Field('Type')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def num_sent(cls):
return Field('Num_sent')
@classmethod
def expected_revenue(cls):
return Field('Expected_Revenue')
@classmethod
def actual_cost(cls):
return Field('Actual_Cost')
@classmethod
def id(cls):
return Field('id')
@classmethod
def expected_response(cls):
return Field('Expected_Response')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def parent_campaign(cls):
return Field('Parent_Campaign')
@classmethod
def start_date(cls):
return Field('Start_Date')
@classmethod
def budgeted_cost(cls):
return Field('Budgeted_Cost')
class Quotes(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def discount(cls):
return Field('Discount')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def shipping_state(cls):
return Field('Shipping_State')
@classmethod
def tax(cls):
return Field('Tax')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def deal_name(cls):
return Field('Deal_Name')
@classmethod
def valid_till(cls):
return Field('Valid_Till')
@classmethod
def billing_country(cls):
return Field('Billing_Country')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def team(cls):
return Field('Team')
@classmethod
def id(cls):
return Field('id')
@classmethod
def carrier(cls):
return Field('Carrier')
@classmethod
def quote_stage(cls):
return Field('Quote_Stage')
@classmethod
def grand_total(cls):
return Field('Grand_Total')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def billing_street(cls):
return Field('Billing_Street')
@classmethod
def adjustment(cls):
return Field('Adjustment')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def terms_and_conditions(cls):
return Field('Terms_and_Conditions')
@classmethod
def sub_total(cls):
return Field('Sub_Total')
@classmethod
def billing_code(cls):
return Field('Billing_Code')
@classmethod
def product_details(cls):
return Field('Product_Details')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def contact_name(cls):
return Field('Contact_Name')
@classmethod
def shipping_city(cls):
return Field('Shipping_City')
@classmethod
def shipping_country(cls):
return Field('Shipping_Country')
@classmethod
def shipping_code(cls):
return Field('Shipping_Code')
@classmethod
def billing_city(cls):
return Field('Billing_City')
@classmethod
def quote_number(cls):
return Field('Quote_Number')
@classmethod
def billing_state(cls):
return Field('Billing_State')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def shipping_street(cls):
return Field('Shipping_Street')
class Invoices(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def discount(cls):
return Field('Discount')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def shipping_state(cls):
return Field('Shipping_State')
@classmethod
def tax(cls):
return Field('Tax')
@classmethod
def invoice_date(cls):
return Field('Invoice_Date')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def billing_country(cls):
return Field('Billing_Country')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def sales_order(cls):
return Field('Sales_Order')
@classmethod
def status(cls):
return Field('Status')
@classmethod
def grand_total(cls):
return Field('Grand_Total')
@classmethod
def sales_commission(cls):
return Field('Sales_Commission')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def due_date(cls):
return Field('Due_Date')
@classmethod
def billing_street(cls):
return Field('Billing_Street')
@classmethod
def adjustment(cls):
return Field('Adjustment')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def terms_and_conditions(cls):
return Field('Terms_and_Conditions')
@classmethod
def sub_total(cls):
return Field('Sub_Total')
@classmethod
def invoice_number(cls):
return Field('Invoice_Number')
@classmethod
def billing_code(cls):
return Field('Billing_Code')
@classmethod
def product_details(cls):
return Field('Product_Details')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def contact_name(cls):
return Field('Contact_Name')
@classmethod
def excise_duty(cls):
return Field('Excise_Duty')
@classmethod
def shipping_city(cls):
return Field('Shipping_City')
@classmethod
def shipping_country(cls):
return Field('Shipping_Country')
@classmethod
def shipping_code(cls):
return Field('Shipping_Code')
@classmethod
def billing_city(cls):
return Field('Billing_City')
@classmethod
def purchase_order(cls):
return Field('Purchase_Order')
@classmethod
def billing_state(cls):
return Field('Billing_State')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def shipping_street(cls):
return Field('Shipping_Street')
class Attachments(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def file_name(cls):
return Field('File_Name')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def size(cls):
return Field('Size')
@classmethod
def parent_id(cls):
return Field('Parent_Id')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
class Price_Books(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def active(cls):
return Field('Active')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def pricing_details(cls):
return Field('Pricing_Details')
@classmethod
def pricing_model(cls):
return Field('Pricing_Model')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def price_book_name(cls):
return Field('Price_Book_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
class Sales_Orders(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def discount(cls):
return Field('Discount')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def customer_no(cls):
return Field('Customer_No')
@classmethod
def shipping_state(cls):
return Field('Shipping_State')
@classmethod
def tax(cls):
return Field('Tax')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def deal_name(cls):
return Field('Deal_Name')
@classmethod
def billing_country(cls):
return Field('Billing_Country')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def carrier(cls):
return Field('Carrier')
@classmethod
def quote_name(cls):
return Field('Quote_Name')
@classmethod
def status(cls):
return Field('Status')
@classmethod
def sales_commission(cls):
return Field('Sales_Commission')
@classmethod
def grand_total(cls):
return Field('Grand_Total')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def due_date(cls):
return Field('Due_Date')
@classmethod
def billing_street(cls):
return Field('Billing_Street')
@classmethod
def adjustment(cls):
return Field('Adjustment')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def terms_and_conditions(cls):
return Field('Terms_and_Conditions')
@classmethod
def sub_total(cls):
return Field('Sub_Total')
@classmethod
def billing_code(cls):
return Field('Billing_Code')
@classmethod
def product_details(cls):
return Field('Product_Details')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def contact_name(cls):
return Field('Contact_Name')
@classmethod
def excise_duty(cls):
return Field('Excise_Duty')
@classmethod
def shipping_city(cls):
return Field('Shipping_City')
@classmethod
def shipping_country(cls):
return Field('Shipping_Country')
@classmethod
def shipping_code(cls):
return Field('Shipping_Code')
@classmethod
def billing_city(cls):
return Field('Billing_City')
@classmethod
def so_number(cls):
return Field('SO_Number')
@classmethod
def purchase_order(cls):
return Field('Purchase_Order')
@classmethod
def billing_state(cls):
return Field('Billing_State')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def pending(cls):
return Field('Pending')
@classmethod
def shipping_street(cls):
return Field('Shipping_Street')
class Contacts(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def email(cls):
return Field('Email')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def vendor_name(cls):
return Field('Vendor_Name')
@classmethod
def mailing_zip(cls):
return Field('Mailing_Zip')
@classmethod
def reports_to(cls):
return Field('Reports_To')
@classmethod
def other_phone(cls):
return Field('Other_Phone')
@classmethod
def mailing_state(cls):
return Field('Mailing_State')
@classmethod
def twitter(cls):
return Field('Twitter')
@classmethod
def other_zip(cls):
return Field('Other_Zip')
@classmethod
def mailing_street(cls):
return Field('Mailing_Street')
@classmethod
def other_state(cls):
return Field('Other_State')
@classmethod
def salutation(cls):
return Field('Salutation')
@classmethod
def other_country(cls):
return Field('Other_Country')
@classmethod
def last_activity_time(cls):
return Field('Last_Activity_Time')
@classmethod
def first_name(cls):
return Field('First_Name')
@classmethod
def full_name(cls):
return Field('Full_Name')
@classmethod
def asst_phone(cls):
return Field('Asst_Phone')
@classmethod
def record_image(cls):
return Field('Record_Image')
@classmethod
def department(cls):
return Field('Department')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def skype_id(cls):
return Field('Skype_ID')
@classmethod
def assistant(cls):
return Field('Assistant')
@classmethod
def phone(cls):
return Field('Phone')
@classmethod
def mailing_country(cls):
return Field('Mailing_Country')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def email_opt_out(cls):
return Field('Email_Opt_Out')
@classmethod
def reporting_to(cls):
return Field('Reporting_To')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def date_of_birth(cls):
return Field('Date_of_Birth')
@classmethod
def mailing_city(cls):
return Field('Mailing_City')
@classmethod
def other_city(cls):
return Field('Other_City')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def title(cls):
return Field('Title')
@classmethod
def other_street(cls):
return Field('Other_Street')
@classmethod
def mobile(cls):
return Field('Mobile')
@classmethod
def territories(cls):
return Field('Territories')
@classmethod
def home_phone(cls):
return Field('Home_Phone')
@classmethod
def last_name(cls):
return Field('Last_Name')
@classmethod
def lead_source(cls):
return Field('Lead_Source')
@classmethod
def is_record_duplicate(cls):
return Field('Is_Record_Duplicate')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def fax(cls):
return Field('Fax')
@classmethod
def secondary_email(cls):
return Field('Secondary_Email')
class Solutions(object):
@classmethod
def status(cls):
return Field('Status')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def comments(cls):
return Field('Comments')
@classmethod
def no_of_comments(cls):
return Field('No_of_comments')
@classmethod
def product_name(cls):
return Field('Product_Name')
@classmethod
def add_comment(cls):
return Field('Add_Comment')
@classmethod
def solution_number(cls):
return Field('Solution_Number')
@classmethod
def answer(cls):
return Field('Answer')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def solution_title(cls):
return Field('Solution_Title')
@classmethod
def published(cls):
return Field('Published')
@classmethod
def question(cls):
return Field('Question')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
class Events(object):
@classmethod
def all_day(cls):
return Field('All_day')
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def check_in_state(cls):
return Field('Check_In_State')
@classmethod
def check_in_address(cls):
return Field('Check_In_Address')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def start_datetime(cls):
return Field('Start_DateTime')
@classmethod
def latitude(cls):
return Field('Latitude')
@classmethod
def participants(cls):
return Field('Participants')
@classmethod
def event_title(cls):
return Field('Event_Title')
@classmethod
def end_datetime(cls):
return Field('End_DateTime')
@classmethod
def check_in_by(cls):
return Field('Check_In_By')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def check_in_city(cls):
return Field('Check_In_City')
@classmethod
def id(cls):
return Field('id')
@classmethod
def check_in_comment(cls):
return Field('Check_In_Comment')
@classmethod
def remind_at(cls):
return Field('Remind_At')
@classmethod
def who_id(cls):
return Field('Who_Id')
@classmethod
def check_in_status(cls):
return Field('Check_In_Status')
@classmethod
def check_in_country(cls):
return Field('Check_In_Country')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def venue(cls):
return Field('Venue')
@classmethod
def zip_code(cls):
return Field('ZIP_Code')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def longitude(cls):
return Field('Longitude')
@classmethod
def check_in_time(cls):
return Field('Check_In_Time')
@classmethod
def recurring_activity(cls):
return Field('Recurring_Activity')
@classmethod
def what_id(cls):
return Field('What_Id')
@classmethod
def check_in_sub_locality(cls):
return Field('Check_In_Sub_Locality')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
class Purchase_Orders(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def discount(cls):
return Field('Discount')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def vendor_name(cls):
return Field('Vendor_Name')
@classmethod
def shipping_state(cls):
return Field('Shipping_State')
@classmethod
def tax(cls):
return Field('Tax')
@classmethod
def po_date(cls):
return Field('PO_Date')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def billing_country(cls):
return Field('Billing_Country')
@classmethod
def id(cls):
return Field('id')
@classmethod
def carrier(cls):
return Field('Carrier')
@classmethod
def status(cls):
return Field('Status')
@classmethod
def grand_total(cls):
return Field('Grand_Total')
@classmethod
def sales_commission(cls):
return Field('Sales_Commission')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def po_number(cls):
return Field('PO_Number')
@classmethod
def due_date(cls):
return Field('Due_Date')
@classmethod
def billing_street(cls):
return Field('Billing_Street')
@classmethod
def adjustment(cls):
return Field('Adjustment')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def terms_and_conditions(cls):
return Field('Terms_and_Conditions')
@classmethod
def sub_total(cls):
return Field('Sub_Total')
@classmethod
def billing_code(cls):
return Field('Billing_Code')
@classmethod
def product_details(cls):
return Field('Product_Details')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def tracking_number(cls):
return Field('Tracking_Number')
@classmethod
def contact_name(cls):
return Field('Contact_Name')
@classmethod
def excise_duty(cls):
return Field('Excise_Duty')
@classmethod
def shipping_city(cls):
return Field('Shipping_City')
@classmethod
def shipping_country(cls):
return Field('Shipping_Country')
@classmethod
def shipping_code(cls):
return Field('Shipping_Code')
@classmethod
def billing_city(cls):
return Field('Billing_City')
@classmethod
def requisition_no(cls):
return Field('Requisition_No')
@classmethod
def billing_state(cls):
return Field('Billing_State')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def shipping_street(cls):
return Field('Shipping_Street')
class Accounts(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def ownership(cls):
return Field('Ownership')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def account_type(cls):
return Field('Account_Type')
@classmethod
def rating(cls):
return Field('Rating')
@classmethod
def sic_code(cls):
return Field('SIC_Code')
@classmethod
def shipping_state(cls):
return Field('Shipping_State')
@classmethod
def website(cls):
return Field('Website')
@classmethod
def employees(cls):
return Field('Employees')
@classmethod
def last_activity_time(cls):
return Field('Last_Activity_Time')
@classmethod
def industry(cls):
return Field('Industry')
@classmethod
def record_image(cls):
return Field('Record_Image')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def account_site(cls):
return Field('Account_Site')
@classmethod
def phone(cls):
return Field('Phone')
@classmethod
def billing_country(cls):
return Field('Billing_Country')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def account_number(cls):
return Field('Account_Number')
@classmethod
def ticker_symbol(cls):
return Field('Ticker_Symbol')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def billing_street(cls):
return Field('Billing_Street')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def billing_code(cls):
return Field('Billing_Code')
@classmethod
def territories(cls):
return Field('Territories')
@classmethod
def parent_account(cls):
return Field('Parent_Account')
@classmethod
def shipping_city(cls):
return Field('Shipping_City')
@classmethod
def shipping_country(cls):
return Field('Shipping_Country')
@classmethod
def shipping_code(cls):
return Field('Shipping_Code')
@classmethod
def billing_city(cls):
return Field('Billing_City')
@classmethod
def billing_state(cls):
return Field('Billing_State')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def fax(cls):
return Field('Fax')
@classmethod
def annual_revenue(cls):
return Field('Annual_Revenue')
@classmethod
def shipping_street(cls):
return Field('Shipping_Street')
class Cases(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def email(cls):
return Field('Email')
@classmethod
def description(cls):
return Field('Description')
@classmethod
def internal_comments(cls):
return Field('Internal_Comments')
@classmethod
def no_of_comments(cls):
return Field('No_of_comments')
@classmethod
def reported_by(cls):
return Field('Reported_By')
@classmethod
def case_number(cls):
return Field('Case_Number')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def deal_name(cls):
return Field('Deal_Name')
@classmethod
def phone(cls):
return Field('Phone')
@classmethod
def account_name(cls):
return Field('Account_Name')
@classmethod
def id(cls):
return Field('id')
@classmethod
def solution(cls):
return Field('Solution')
@classmethod
def status(cls):
return Field('Status')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def priority(cls):
return Field('Priority')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def comments(cls):
return Field('Comments')
@classmethod
def product_name(cls):
return Field('Product_Name')
@classmethod
def add_comment(cls):
return Field('Add_Comment')
@classmethod
def case_origin(cls):
return Field('Case_Origin')
@classmethod
def subject(cls):
return Field('Subject')
@classmethod
def case_reason(cls):
return Field('Case_Reason')
@classmethod
def type(cls):
return Field('Type')
@classmethod
def is_record_duplicate(cls):
return Field('Is_Record_Duplicate')
@classmethod
def tag(cls):
return Field('Tag')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def related_to(cls):
return Field('Related_To')
class Notes(object):
@classmethod
def owner(cls):
return Field('Owner')
@classmethod
def modified_by(cls):
return Field('Modified_By')
@classmethod
def modified_time(cls):
return Field('Modified_Time')
@classmethod
def created_time(cls):
return Field('Created_Time')
@classmethod
def parent_id(cls):
return Field('Parent_Id')
@classmethod
def id(cls):
return Field('id')
@classmethod
def created_by(cls):
return Field('Created_By')
@classmethod
def note_title(cls):
return Field('Note_Title')
@classmethod
def note_content(cls):
return Field('Note_Content') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/field.py | field.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__data = None
self.__info = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_info(self):
"""
The method to get the info
Returns:
Info: An instance of Info
"""
return self.__info
def set_info(self, info):
"""
The method to set the value to info
Parameters:
info (Info) : An instance of Info
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.info import Info
except Exception:
from .info import Info
if info is not None and not isinstance(info, Info):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: info EXPECTED TYPE: Info', None, None)
self.__info = info
self.__key_modified['info'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.deleted_records_handler import DeletedRecordsHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .deleted_records_handler import DeletedRecordsHandler
class DeletedRecordsWrapper(DeletedRecordsHandler):
def __init__(self):
"""Creates an instance of DeletedRecordsWrapper"""
super().__init__()
self.__data = None
self.__info = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_info(self):
"""
The method to get the info
Returns:
Info: An instance of Info
"""
return self.__info
def set_info(self, info):
"""
The method to set the value to info
Parameters:
info (Info) : An instance of Info
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.info import Info
except Exception:
from .info import Info
if info is not None and not isinstance(info, Info):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: info EXPECTED TYPE: Info', None, None)
self.__info = info
self.__key_modified['info'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/deleted_records_wrapper.py | deleted_records_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class CarryOverTags(object):
def __init__(self):
"""Creates an instance of CarryOverTags"""
self.__contacts = None
self.__accounts = None
self.__deals = None
self.__key_modified = dict()
def get_contacts(self):
"""
The method to get the contacts
Returns:
list: An instance of list
"""
return self.__contacts
def set_contacts(self, contacts):
"""
The method to set the value to contacts
Parameters:
contacts (list) : An instance of list
"""
if contacts is not None and not isinstance(contacts, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contacts EXPECTED TYPE: list', None, None)
self.__contacts = contacts
self.__key_modified['Contacts'] = 1
def get_accounts(self):
"""
The method to get the accounts
Returns:
list: An instance of list
"""
return self.__accounts
def set_accounts(self, accounts):
"""
The method to set the value to accounts
Parameters:
accounts (list) : An instance of list
"""
if accounts is not None and not isinstance(accounts, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: accounts EXPECTED TYPE: list', None, None)
self.__accounts = accounts
self.__key_modified['Accounts'] = 1
def get_deals(self):
"""
The method to get the deals
Returns:
list: An instance of list
"""
return self.__deals
def set_deals(self, deals):
"""
The method to set the value to deals
Parameters:
deals (list) : An instance of list
"""
if deals is not None and not isinstance(deals, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deals EXPECTED TYPE: list', None, None)
self.__deals = deals
self.__key_modified['Deals'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/carry_over_tags.py | carry_over_tags.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class LineTax(object):
def __init__(self):
"""Creates an instance of LineTax"""
self.__percentage = None
self.__name = None
self.__id = None
self.__value = None
self.__key_modified = dict()
def get_percentage(self):
"""
The method to get the percentage
Returns:
float: A float representing the percentage
"""
return self.__percentage
def set_percentage(self, percentage):
"""
The method to set the value to percentage
Parameters:
percentage (float) : A float representing the percentage
"""
if percentage is not None and not isinstance(percentage, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: percentage EXPECTED TYPE: float', None, None)
self.__percentage = percentage
self.__key_modified['percentage'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_value(self):
"""
The method to get the value
Returns:
float: A float representing the value
"""
return self.__value
def set_value(self, value):
"""
The method to set the value to value
Parameters:
value (float) : A float representing the value
"""
if value is not None and not isinstance(value, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: value EXPECTED TYPE: float', None, None)
self.__value = value
self.__key_modified['value'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/line_tax.py | line_tax.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from .record import Record
class InventoryLineItems(Record):
def __init__(self):
"""Creates an instance of InventoryLineItems"""
super().__init__()
def get_product(self):
"""
The method to get the product
Returns:
LineItemProduct: An instance of LineItemProduct
"""
return self.get_key_value('product')
def set_product(self, product):
"""
The method to set the value to product
Parameters:
product (LineItemProduct) : An instance of LineItemProduct
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.line_item_product import LineItemProduct
except Exception:
from .line_item_product import LineItemProduct
if product is not None and not isinstance(product, LineItemProduct):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: product EXPECTED TYPE: LineItemProduct', None, None)
self.add_key_value('product', product)
def get_quantity(self):
"""
The method to get the quantity
Returns:
float: A float representing the quantity
"""
return self.get_key_value('quantity')
def set_quantity(self, quantity):
"""
The method to set the value to quantity
Parameters:
quantity (float) : A float representing the quantity
"""
if quantity is not None and not isinstance(quantity, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: quantity EXPECTED TYPE: float', None, None)
self.add_key_value('quantity', quantity)
def get_discount(self):
"""
The method to get the discount
Returns:
string: A string representing the discount
"""
return self.get_key_value('Discount')
def set_discount(self, discount):
"""
The method to set the value to discount
Parameters:
discount (string) : A string representing the discount
"""
if discount is not None and not isinstance(discount, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: discount EXPECTED TYPE: str', None, None)
self.add_key_value('Discount', discount)
def get_total_after_discount(self):
"""
The method to get the total_after_discount
Returns:
float: A float representing the total_after_discount
"""
return self.get_key_value('total_after_discount')
def set_total_after_discount(self, total_after_discount):
"""
The method to set the value to total_after_discount
Parameters:
total_after_discount (float) : A float representing the total_after_discount
"""
if total_after_discount is not None and not isinstance(total_after_discount, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: total_after_discount EXPECTED TYPE: float', None, None)
self.add_key_value('total_after_discount', total_after_discount)
def get_net_total(self):
"""
The method to get the net_total
Returns:
float: A float representing the net_total
"""
return self.get_key_value('net_total')
def set_net_total(self, net_total):
"""
The method to set the value to net_total
Parameters:
net_total (float) : A float representing the net_total
"""
if net_total is not None and not isinstance(net_total, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: net_total EXPECTED TYPE: float', None, None)
self.add_key_value('net_total', net_total)
def get_book(self):
"""
The method to get the book
Returns:
float: A float representing the book
"""
return self.get_key_value('book')
def set_book(self, book):
"""
The method to set the value to book
Parameters:
book (float) : A float representing the book
"""
if book is not None and not isinstance(book, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: book EXPECTED TYPE: float', None, None)
self.add_key_value('book', book)
def get_tax(self):
"""
The method to get the tax
Returns:
float: A float representing the tax
"""
return self.get_key_value('Tax')
def set_tax(self, tax):
"""
The method to set the value to tax
Parameters:
tax (float) : A float representing the tax
"""
if tax is not None and not isinstance(tax, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: tax EXPECTED TYPE: float', None, None)
self.add_key_value('Tax', tax)
def get_list_price(self):
"""
The method to get the list_price
Returns:
float: A float representing the list_price
"""
return self.get_key_value('list_price')
def set_list_price(self, list_price):
"""
The method to set the value to list_price
Parameters:
list_price (float) : A float representing the list_price
"""
if list_price is not None and not isinstance(list_price, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: list_price EXPECTED TYPE: float', None, None)
self.add_key_value('list_price', list_price)
def get_unit_price(self):
"""
The method to get the unit_price
Returns:
float: A float representing the unit_price
"""
return self.get_key_value('unit_price')
def set_unit_price(self, unit_price):
"""
The method to set the value to unit_price
Parameters:
unit_price (float) : A float representing the unit_price
"""
if unit_price is not None and not isinstance(unit_price, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: unit_price EXPECTED TYPE: float', None, None)
self.add_key_value('unit_price', unit_price)
def get_quantity_in_stock(self):
"""
The method to get the quantity_in_stock
Returns:
float: A float representing the quantity_in_stock
"""
return self.get_key_value('quantity_in_stock')
def set_quantity_in_stock(self, quantity_in_stock):
"""
The method to set the value to quantity_in_stock
Parameters:
quantity_in_stock (float) : A float representing the quantity_in_stock
"""
if quantity_in_stock is not None and not isinstance(quantity_in_stock, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: quantity_in_stock EXPECTED TYPE: float', None, None)
self.add_key_value('quantity_in_stock', quantity_in_stock)
def get_total(self):
"""
The method to get the total
Returns:
float: A float representing the total
"""
return self.get_key_value('total')
def set_total(self, total):
"""
The method to set the value to total
Parameters:
total (float) : A float representing the total
"""
if total is not None and not isinstance(total, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: total EXPECTED TYPE: float', None, None)
self.add_key_value('total', total)
def get_product_description(self):
"""
The method to get the product_description
Returns:
string: A string representing the product_description
"""
return self.get_key_value('product_description')
def set_product_description(self, product_description):
"""
The method to set the value to product_description
Parameters:
product_description (string) : A string representing the product_description
"""
if product_description is not None and not isinstance(product_description, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: product_description EXPECTED TYPE: str', None, None)
self.add_key_value('product_description', product_description)
def get_line_tax(self):
"""
The method to get the line_tax
Returns:
list: An instance of list
"""
return self.get_key_value('line_tax')
def set_line_tax(self, line_tax):
"""
The method to set the value to line_tax
Parameters:
line_tax (list) : An instance of list
"""
if line_tax is not None and not isinstance(line_tax, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: line_tax EXPECTED TYPE: list', None, None)
self.add_key_value('line_tax', line_tax) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/inventory_line_items.py | inventory_line_items.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Territory(object):
def __init__(self):
"""Creates an instance of Territory"""
self.__id = None
self.__include_child = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_include_child(self):
"""
The method to get the include_child
Returns:
bool: A bool representing the include_child
"""
return self.__include_child
def set_include_child(self, include_child):
"""
The method to set the value to include_child
Parameters:
include_child (bool) : A bool representing the include_child
"""
if include_child is not None and not isinstance(include_child, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: include_child EXPECTED TYPE: bool', None, None)
self.__include_child = include_child
self.__key_modified['include_child'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/territory.py | territory.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_action_handler import MassUpdateActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .mass_update_action_handler import MassUpdateActionHandler
class MassUpdateActionWrapper(MassUpdateActionHandler):
def __init__(self):
"""Creates an instance of MassUpdateActionWrapper"""
super().__init__()
self.__data = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/mass_update_action_wrapper.py | mass_update_action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Comment(object):
def __init__(self):
"""Creates an instance of Comment"""
self.__commented_by = None
self.__commented_time = None
self.__comment_content = None
self.__id = None
self.__key_modified = dict()
def get_commented_by(self):
"""
The method to get the commented_by
Returns:
string: A string representing the commented_by
"""
return self.__commented_by
def set_commented_by(self, commented_by):
"""
The method to set the value to commented_by
Parameters:
commented_by (string) : A string representing the commented_by
"""
if commented_by is not None and not isinstance(commented_by, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: commented_by EXPECTED TYPE: str', None, None)
self.__commented_by = commented_by
self.__key_modified['commented_by'] = 1
def get_commented_time(self):
"""
The method to get the commented_time
Returns:
datetime: An instance of datetime
"""
return self.__commented_time
def set_commented_time(self, commented_time):
"""
The method to set the value to commented_time
Parameters:
commented_time (datetime) : An instance of datetime
"""
from datetime import datetime
if commented_time is not None and not isinstance(commented_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: commented_time EXPECTED TYPE: datetime', None, None)
self.__commented_time = commented_time
self.__key_modified['commented_time'] = 1
def get_comment_content(self):
"""
The method to get the comment_content
Returns:
string: A string representing the comment_content
"""
return self.__comment_content
def set_comment_content(self, comment_content):
"""
The method to set the value to comment_content
Parameters:
comment_content (string) : A string representing the comment_content
"""
if comment_content is not None and not isinstance(comment_content, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: comment_content EXPECTED TYPE: str', None, None)
self.__comment_content = comment_content
self.__key_modified['comment_content'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/comment.py | comment.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.record.convert_action_response import ConvertActionResponse
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_response_handler import MassUpdateResponseHandler
from zcrmsdk.src.com.zoho.crm.api.record.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.record.response_handler import ResponseHandler
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_action_handler import MassUpdateActionHandler
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_response import MassUpdateResponse
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
from zcrmsdk.src.com.zoho.crm.api.record.download_handler import DownloadHandler
from zcrmsdk.src.com.zoho.crm.api.record.file_handler import FileHandler
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_action_response import MassUpdateActionResponse
from zcrmsdk.src.com.zoho.crm.api.record.convert_action_handler import ConvertActionHandler
from zcrmsdk.src.com.zoho.crm.api.record.deleted_records_handler import DeletedRecordsHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .convert_action_response import ConvertActionResponse
from .mass_update_response_handler import MassUpdateResponseHandler
from .action_response import ActionResponse
from .response_handler import ResponseHandler
from .mass_update_action_handler import MassUpdateActionHandler
from .mass_update_response import MassUpdateResponse
from .action_handler import ActionHandler
from .download_handler import DownloadHandler
from .file_handler import FileHandler
from .mass_update_action_response import MassUpdateActionResponse
from .convert_action_handler import ConvertActionHandler
from .deleted_records_handler import DeletedRecordsHandler
class APIException(ResponseHandler, ActionResponse, ActionHandler, DeletedRecordsHandler, ConvertActionResponse, ConvertActionHandler, DownloadHandler, FileHandler, MassUpdateActionResponse, MassUpdateActionHandler, MassUpdateResponse, MassUpdateResponseHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Info(object):
def __init__(self):
"""Creates an instance of Info"""
self.__per_page = None
self.__count = None
self.__page = None
self.__more_records = None
self.__key_modified = dict()
def get_per_page(self):
"""
The method to get the per_page
Returns:
int: An int representing the per_page
"""
return self.__per_page
def set_per_page(self, per_page):
"""
The method to set the value to per_page
Parameters:
per_page (int) : An int representing the per_page
"""
if per_page is not None and not isinstance(per_page, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: per_page EXPECTED TYPE: int', None, None)
self.__per_page = per_page
self.__key_modified['per_page'] = 1
def get_count(self):
"""
The method to get the count
Returns:
int: An int representing the count
"""
return self.__count
def set_count(self, count):
"""
The method to set the value to count
Parameters:
count (int) : An int representing the count
"""
if count is not None and not isinstance(count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: count EXPECTED TYPE: int', None, None)
self.__count = count
self.__key_modified['count'] = 1
def get_page(self):
"""
The method to get the page
Returns:
int: An int representing the page
"""
return self.__page
def set_page(self, page):
"""
The method to set the value to page
Parameters:
page (int) : An int representing the page
"""
if page is not None and not isinstance(page, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: page EXPECTED TYPE: int', None, None)
self.__page = page
self.__key_modified['page'] = 1
def get_more_records(self):
"""
The method to get the more_records
Returns:
bool: A bool representing the more_records
"""
return self.__more_records
def set_more_records(self, more_records):
"""
The method to set the value to more_records
Parameters:
more_records (bool) : A bool representing the more_records
"""
if more_records is not None and not isinstance(more_records, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: more_records EXPECTED TYPE: bool', None, None)
self.__more_records = more_records
self.__key_modified['more_records'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/info.py | info.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.convert_action_response import ConvertActionResponse
except Exception:
from ..exception import SDKException
from ..util import Constants
from .convert_action_response import ConvertActionResponse
class SuccessfulConvert(ConvertActionResponse):
def __init__(self):
"""Creates an instance of SuccessfulConvert"""
super().__init__()
self.__contacts = None
self.__deals = None
self.__accounts = None
self.__key_modified = dict()
def get_contacts(self):
"""
The method to get the contacts
Returns:
string: A string representing the contacts
"""
return self.__contacts
def set_contacts(self, contacts):
"""
The method to set the value to contacts
Parameters:
contacts (string) : A string representing the contacts
"""
if contacts is not None and not isinstance(contacts, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contacts EXPECTED TYPE: str', None, None)
self.__contacts = contacts
self.__key_modified['Contacts'] = 1
def get_deals(self):
"""
The method to get the deals
Returns:
string: A string representing the deals
"""
return self.__deals
def set_deals(self, deals):
"""
The method to set the value to deals
Parameters:
deals (string) : A string representing the deals
"""
if deals is not None and not isinstance(deals, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deals EXPECTED TYPE: str', None, None)
self.__deals = deals
self.__key_modified['Deals'] = 1
def get_accounts(self):
"""
The method to get the accounts
Returns:
string: A string representing the accounts
"""
return self.__accounts
def set_accounts(self, accounts):
"""
The method to set the value to accounts
Parameters:
accounts (string) : A string representing the accounts
"""
if accounts is not None and not isinstance(accounts, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: accounts EXPECTED TYPE: str', None, None)
self.__accounts = accounts
self.__key_modified['Accounts'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/successful_convert.py | successful_convert.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Reminder(object):
def __init__(self):
"""Creates an instance of Reminder"""
self.__period = None
self.__unit = None
self.__key_modified = dict()
def get_period(self):
"""
The method to get the period
Returns:
string: A string representing the period
"""
return self.__period
def set_period(self, period):
"""
The method to set the value to period
Parameters:
period (string) : A string representing the period
"""
if period is not None and not isinstance(period, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: period EXPECTED TYPE: str', None, None)
self.__period = period
self.__key_modified['period'] = 1
def get_unit(self):
"""
The method to get the unit
Returns:
string: A string representing the unit
"""
return self.__unit
def set_unit(self, unit):
"""
The method to set the value to unit
Parameters:
unit (string) : A string representing the unit
"""
if unit is not None and not isinstance(unit, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: unit EXPECTED TYPE: str', None, None)
self.__unit = unit
self.__key_modified['unit'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/reminder.py | reminder.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_response_handler import MassUpdateResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .mass_update_response_handler import MassUpdateResponseHandler
class MassUpdateResponseWrapper(MassUpdateResponseHandler):
def __init__(self):
"""Creates an instance of MassUpdateResponseWrapper"""
super().__init__()
self.__data = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/mass_update_response_wrapper.py | mass_update_response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
class Criteria(object):
def __init__(self):
"""Creates an instance of Criteria"""
self.__comparator = None
self.__field = None
self.__value = None
self.__group_operator = None
self.__group = None
self.__key_modified = dict()
def get_comparator(self):
"""
The method to get the comparator
Returns:
Choice: An instance of Choice
"""
return self.__comparator
def set_comparator(self, comparator):
"""
The method to set the value to comparator
Parameters:
comparator (Choice) : An instance of Choice
"""
if comparator is not None and not isinstance(comparator, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: comparator EXPECTED TYPE: Choice', None, None)
self.__comparator = comparator
self.__key_modified['comparator'] = 1
def get_field(self):
"""
The method to get the field
Returns:
string: A string representing the field
"""
return self.__field
def set_field(self, field):
"""
The method to set the value to field
Parameters:
field (string) : A string representing the field
"""
if field is not None and not isinstance(field, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field EXPECTED TYPE: str', None, None)
self.__field = field
self.__key_modified['field'] = 1
def get_value(self):
"""
The method to get the value
Returns:
Object: A Object representing the value
"""
return self.__value
def set_value(self, value):
"""
The method to set the value to value
Parameters:
value (Object) : A Object representing the value
"""
self.__value = value
self.__key_modified['value'] = 1
def get_group_operator(self):
"""
The method to get the group_operator
Returns:
Choice: An instance of Choice
"""
return self.__group_operator
def set_group_operator(self, group_operator):
"""
The method to set the value to group_operator
Parameters:
group_operator (Choice) : An instance of Choice
"""
if group_operator is not None and not isinstance(group_operator, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: group_operator EXPECTED TYPE: Choice', None, None)
self.__group_operator = group_operator
self.__key_modified['group_operator'] = 1
def get_group(self):
"""
The method to get the group
Returns:
list: An instance of list
"""
return self.__group
def set_group(self, group):
"""
The method to set the value to group
Parameters:
group (list) : An instance of list
"""
if group is not None and not isinstance(group, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: group EXPECTED TYPE: list', None, None)
self.__group = group
self.__key_modified['group'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/criteria.py | criteria.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_action_response import MassUpdateActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .mass_update_action_response import MassUpdateActionResponse
class MassUpdateSuccessResponse(MassUpdateActionResponse):
def __init__(self):
"""Creates an instance of MassUpdateSuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/mass_update_success_response.py | mass_update_success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from .record import Record
class Consent(Record):
def __init__(self):
"""Creates an instance of Consent"""
super().__init__()
def get_owner(self):
"""
The method to get the owner
Returns:
User: An instance of User
"""
return self.get_key_value('Owner')
def set_owner(self, owner):
"""
The method to set the value to owner
Parameters:
owner (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if owner is not None and not isinstance(owner, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: owner EXPECTED TYPE: User', None, None)
self.add_key_value('Owner', owner)
def get_contact_through_email(self):
"""
The method to get the contact_through_email
Returns:
bool: A bool representing the contact_through_email
"""
return self.get_key_value('Contact_Through_Email')
def set_contact_through_email(self, contact_through_email):
"""
The method to set the value to contact_through_email
Parameters:
contact_through_email (bool) : A bool representing the contact_through_email
"""
if contact_through_email is not None and not isinstance(contact_through_email, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contact_through_email EXPECTED TYPE: bool', None, None)
self.add_key_value('Contact_Through_Email', contact_through_email)
def get_contact_through_social(self):
"""
The method to get the contact_through_social
Returns:
bool: A bool representing the contact_through_social
"""
return self.get_key_value('Contact_Through_Social')
def set_contact_through_social(self, contact_through_social):
"""
The method to set the value to contact_through_social
Parameters:
contact_through_social (bool) : A bool representing the contact_through_social
"""
if contact_through_social is not None and not isinstance(contact_through_social, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contact_through_social EXPECTED TYPE: bool', None, None)
self.add_key_value('Contact_Through_Social', contact_through_social)
def get_contact_through_survey(self):
"""
The method to get the contact_through_survey
Returns:
bool: A bool representing the contact_through_survey
"""
return self.get_key_value('Contact_Through_Survey')
def set_contact_through_survey(self, contact_through_survey):
"""
The method to set the value to contact_through_survey
Parameters:
contact_through_survey (bool) : A bool representing the contact_through_survey
"""
if contact_through_survey is not None and not isinstance(contact_through_survey, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contact_through_survey EXPECTED TYPE: bool', None, None)
self.add_key_value('Contact_Through_Survey', contact_through_survey)
def get_contact_through_phone(self):
"""
The method to get the contact_through_phone
Returns:
bool: A bool representing the contact_through_phone
"""
return self.get_key_value('Contact_Through_Phone')
def set_contact_through_phone(self, contact_through_phone):
"""
The method to set the value to contact_through_phone
Parameters:
contact_through_phone (bool) : A bool representing the contact_through_phone
"""
if contact_through_phone is not None and not isinstance(contact_through_phone, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contact_through_phone EXPECTED TYPE: bool', None, None)
self.add_key_value('Contact_Through_Phone', contact_through_phone)
def get_mail_sent_time(self):
"""
The method to get the mail_sent_time
Returns:
datetime: An instance of datetime
"""
return self.get_key_value('Mail_Sent_Time')
def set_mail_sent_time(self, mail_sent_time):
"""
The method to set the value to mail_sent_time
Parameters:
mail_sent_time (datetime) : An instance of datetime
"""
from datetime import datetime
if mail_sent_time is not None and not isinstance(mail_sent_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: mail_sent_time EXPECTED TYPE: datetime', None, None)
self.add_key_value('Mail_Sent_Time', mail_sent_time)
def get_consent_date(self):
"""
The method to get the consent_date
Returns:
date: An instance of date
"""
return self.get_key_value('Consent_Date')
def set_consent_date(self, consent_date):
"""
The method to set the value to consent_date
Parameters:
consent_date (date) : An instance of date
"""
if consent_date is not None and not isinstance(consent_date, date):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: consent_date EXPECTED TYPE: date', None, None)
self.add_key_value('Consent_Date', consent_date)
def get_consent_remarks(self):
"""
The method to get the consent_remarks
Returns:
string: A string representing the consent_remarks
"""
return self.get_key_value('Consent_Remarks')
def set_consent_remarks(self, consent_remarks):
"""
The method to set the value to consent_remarks
Parameters:
consent_remarks (string) : A string representing the consent_remarks
"""
if consent_remarks is not None and not isinstance(consent_remarks, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: consent_remarks EXPECTED TYPE: str', None, None)
self.add_key_value('Consent_Remarks', consent_remarks)
def get_consent_through(self):
"""
The method to get the consent_through
Returns:
string: A string representing the consent_through
"""
return self.get_key_value('Consent_Through')
def set_consent_through(self, consent_through):
"""
The method to set the value to consent_through
Parameters:
consent_through (string) : A string representing the consent_through
"""
if consent_through is not None and not isinstance(consent_through, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: consent_through EXPECTED TYPE: str', None, None)
self.add_key_value('Consent_Through', consent_through)
def get_data_processing_basis(self):
"""
The method to get the data_processing_basis
Returns:
string: A string representing the data_processing_basis
"""
return self.get_key_value('Data_Processing_Basis')
def set_data_processing_basis(self, data_processing_basis):
"""
The method to set the value to data_processing_basis
Parameters:
data_processing_basis (string) : A string representing the data_processing_basis
"""
if data_processing_basis is not None and not isinstance(data_processing_basis, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data_processing_basis EXPECTED TYPE: str', None, None)
self.add_key_value('Data_Processing_Basis', data_processing_basis) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/consent.py | consent.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Record(object):
def __init__(self):
"""Creates an instance of Record"""
self.__key_values = dict()
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.get_key_value('id')
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.add_key_value('id', id)
def get_created_by(self):
"""
The method to get the created_by
Returns:
User: An instance of User
"""
return self.get_key_value('Created_By')
def set_created_by(self, created_by):
"""
The method to set the value to created_by
Parameters:
created_by (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if created_by is not None and not isinstance(created_by, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: created_by EXPECTED TYPE: User', None, None)
self.add_key_value('Created_By', created_by)
def get_created_time(self):
"""
The method to get the created_time
Returns:
datetime: An instance of datetime
"""
return self.get_key_value('Created_Time')
def set_created_time(self, created_time):
"""
The method to set the value to created_time
Parameters:
created_time (datetime) : An instance of datetime
"""
from datetime import datetime
if created_time is not None and not isinstance(created_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: created_time EXPECTED TYPE: datetime', None, None)
self.add_key_value('Created_Time', created_time)
def get_modified_by(self):
"""
The method to get the modified_by
Returns:
User: An instance of User
"""
return self.get_key_value('Modified_By')
def set_modified_by(self, modified_by):
"""
The method to set the value to modified_by
Parameters:
modified_by (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if modified_by is not None and not isinstance(modified_by, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modified_by EXPECTED TYPE: User', None, None)
self.add_key_value('Modified_By', modified_by)
def get_modified_time(self):
"""
The method to get the modified_time
Returns:
datetime: An instance of datetime
"""
return self.get_key_value('Modified_Time')
def set_modified_time(self, modified_time):
"""
The method to set the value to modified_time
Parameters:
modified_time (datetime) : An instance of datetime
"""
from datetime import datetime
if modified_time is not None and not isinstance(modified_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modified_time EXPECTED TYPE: datetime', None, None)
self.add_key_value('Modified_Time', modified_time)
def get_tag(self):
"""
The method to get the tag
Returns:
list: An instance of list
"""
return self.get_key_value('Tag')
def set_tag(self, tag):
"""
The method to set the value to tag
Parameters:
tag (list) : An instance of list
"""
if tag is not None and not isinstance(tag, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: tag EXPECTED TYPE: list', None, None)
self.add_key_value('Tag', tag)
def add_field_value(self, field, value):
"""
The method to add field value
Parameters:
field (Field) : An instance of Field
value (object) : An object
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.field import Field
except Exception:
from .field import Field
if field is not None and not isinstance(field, Field):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field EXPECTED TYPE: Field', None, None)
self.add_key_value(field.get_api_name(), value)
def add_key_value(self, api_name, value):
"""
The method to add key value
Parameters:
api_name (string) : A string representing the api_name
value (Object) : A Object representing the value
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__key_values[api_name] = value
self.__key_modified[api_name] = 1
def get_key_value(self, api_name):
"""
The method to get key value
Parameters:
api_name (string) : A string representing the api_name
Returns:
Object: A Object representing the key_value
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
if api_name in self.__key_values:
return self.__key_values.get(api_name)
return None
def get_key_values(self):
"""
The method to get key values
Returns:
dict: An instance of dict
"""
return self.__key_values
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/record.py | record.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class DeletedRecord(object):
def __init__(self):
"""Creates an instance of DeletedRecord"""
self.__deleted_by = None
self.__id = None
self.__display_name = None
self.__type = None
self.__created_by = None
self.__deleted_time = None
self.__key_modified = dict()
def get_deleted_by(self):
"""
The method to get the deleted_by
Returns:
User: An instance of User
"""
return self.__deleted_by
def set_deleted_by(self, deleted_by):
"""
The method to set the value to deleted_by
Parameters:
deleted_by (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if deleted_by is not None and not isinstance(deleted_by, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deleted_by EXPECTED TYPE: User', None, None)
self.__deleted_by = deleted_by
self.__key_modified['deleted_by'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_display_name(self):
"""
The method to get the display_name
Returns:
string: A string representing the display_name
"""
return self.__display_name
def set_display_name(self, display_name):
"""
The method to set the value to display_name
Parameters:
display_name (string) : A string representing the display_name
"""
if display_name is not None and not isinstance(display_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: display_name EXPECTED TYPE: str', None, None)
self.__display_name = display_name
self.__key_modified['display_name'] = 1
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.__type
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.__type = type
self.__key_modified['type'] = 1
def get_created_by(self):
"""
The method to get the created_by
Returns:
User: An instance of User
"""
return self.__created_by
def set_created_by(self, created_by):
"""
The method to set the value to created_by
Parameters:
created_by (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users import User
except Exception:
from ..users import User
if created_by is not None and not isinstance(created_by, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: created_by EXPECTED TYPE: User', None, None)
self.__created_by = created_by
self.__key_modified['created_by'] = 1
def get_deleted_time(self):
"""
The method to get the deleted_time
Returns:
datetime: An instance of datetime
"""
return self.__deleted_time
def set_deleted_time(self, deleted_time):
"""
The method to set the value to deleted_time
Parameters:
deleted_time (datetime) : An instance of datetime
"""
from datetime import datetime
if deleted_time is not None and not isinstance(deleted_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deleted_time EXPECTED TYPE: datetime', None, None)
self.__deleted_time = deleted_time
self.__key_modified['deleted_time'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/deleted_record.py | deleted_record.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class LeadConverter(object):
def __init__(self):
"""Creates an instance of LeadConverter"""
self.__overwrite = None
self.__notify_lead_owner = None
self.__notify_new_entity_owner = None
self.__accounts = None
self.__contacts = None
self.__assign_to = None
self.__deals = None
self.__carry_over_tags = None
self.__key_modified = dict()
def get_overwrite(self):
"""
The method to get the overwrite
Returns:
bool: A bool representing the overwrite
"""
return self.__overwrite
def set_overwrite(self, overwrite):
"""
The method to set the value to overwrite
Parameters:
overwrite (bool) : A bool representing the overwrite
"""
if overwrite is not None and not isinstance(overwrite, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: overwrite EXPECTED TYPE: bool', None, None)
self.__overwrite = overwrite
self.__key_modified['overwrite'] = 1
def get_notify_lead_owner(self):
"""
The method to get the notify_lead_owner
Returns:
bool: A bool representing the notify_lead_owner
"""
return self.__notify_lead_owner
def set_notify_lead_owner(self, notify_lead_owner):
"""
The method to set the value to notify_lead_owner
Parameters:
notify_lead_owner (bool) : A bool representing the notify_lead_owner
"""
if notify_lead_owner is not None and not isinstance(notify_lead_owner, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: notify_lead_owner EXPECTED TYPE: bool', None, None)
self.__notify_lead_owner = notify_lead_owner
self.__key_modified['notify_lead_owner'] = 1
def get_notify_new_entity_owner(self):
"""
The method to get the notify_new_entity_owner
Returns:
bool: A bool representing the notify_new_entity_owner
"""
return self.__notify_new_entity_owner
def set_notify_new_entity_owner(self, notify_new_entity_owner):
"""
The method to set the value to notify_new_entity_owner
Parameters:
notify_new_entity_owner (bool) : A bool representing the notify_new_entity_owner
"""
if notify_new_entity_owner is not None and not isinstance(notify_new_entity_owner, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: notify_new_entity_owner EXPECTED TYPE: bool', None, None)
self.__notify_new_entity_owner = notify_new_entity_owner
self.__key_modified['notify_new_entity_owner'] = 1
def get_accounts(self):
"""
The method to get the accounts
Returns:
string: A string representing the accounts
"""
return self.__accounts
def set_accounts(self, accounts):
"""
The method to set the value to accounts
Parameters:
accounts (string) : A string representing the accounts
"""
if accounts is not None and not isinstance(accounts, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: accounts EXPECTED TYPE: str', None, None)
self.__accounts = accounts
self.__key_modified['Accounts'] = 1
def get_contacts(self):
"""
The method to get the contacts
Returns:
string: A string representing the contacts
"""
return self.__contacts
def set_contacts(self, contacts):
"""
The method to set the value to contacts
Parameters:
contacts (string) : A string representing the contacts
"""
if contacts is not None and not isinstance(contacts, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: contacts EXPECTED TYPE: str', None, None)
self.__contacts = contacts
self.__key_modified['Contacts'] = 1
def get_assign_to(self):
"""
The method to get the assign_to
Returns:
string: A string representing the assign_to
"""
return self.__assign_to
def set_assign_to(self, assign_to):
"""
The method to set the value to assign_to
Parameters:
assign_to (string) : A string representing the assign_to
"""
if assign_to is not None and not isinstance(assign_to, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: assign_to EXPECTED TYPE: str', None, None)
self.__assign_to = assign_to
self.__key_modified['assign_to'] = 1
def get_deals(self):
"""
The method to get the deals
Returns:
Record: An instance of Record
"""
return self.__deals
def set_deals(self, deals):
"""
The method to set the value to deals
Parameters:
deals (Record) : An instance of Record
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from .record import Record
if deals is not None and not isinstance(deals, Record):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: deals EXPECTED TYPE: Record', None, None)
self.__deals = deals
self.__key_modified['Deals'] = 1
def get_carry_over_tags(self):
"""
The method to get the carry_over_tags
Returns:
CarryOverTags: An instance of CarryOverTags
"""
return self.__carry_over_tags
def set_carry_over_tags(self, carry_over_tags):
"""
The method to set the value to carry_over_tags
Parameters:
carry_over_tags (CarryOverTags) : An instance of CarryOverTags
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.carry_over_tags import CarryOverTags
except Exception:
from .carry_over_tags import CarryOverTags
if carry_over_tags is not None and not isinstance(carry_over_tags, CarryOverTags):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: carry_over_tags EXPECTED TYPE: CarryOverTags', None, None)
self.__carry_over_tags = carry_over_tags
self.__key_modified['carry_over_tags'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/lead_converter.py | lead_converter.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from .record import Record
class LineItemProduct(Record):
def __init__(self):
"""Creates an instance of LineItemProduct"""
super().__init__()
def get_product_code(self):
"""
The method to get the product_code
Returns:
string: A string representing the product_code
"""
return self.get_key_value('Product_Code')
def set_product_code(self, product_code):
"""
The method to set the value to product_code
Parameters:
product_code (string) : A string representing the product_code
"""
if product_code is not None and not isinstance(product_code, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: product_code EXPECTED TYPE: str', None, None)
self.add_key_value('Product_Code', product_code)
def get_currency(self):
"""
The method to get the currency
Returns:
string: A string representing the currency
"""
return self.get_key_value('Currency')
def set_currency(self, currency):
"""
The method to set the value to currency
Parameters:
currency (string) : A string representing the currency
"""
if currency is not None and not isinstance(currency, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: currency EXPECTED TYPE: str', None, None)
self.add_key_value('Currency', currency)
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.get_key_value('name')
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.add_key_value('name', name) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/line_item_product.py | line_item_product.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import StreamWrapper, Constants
from zcrmsdk.src.com.zoho.crm.api.record.response_handler import ResponseHandler
from zcrmsdk.src.com.zoho.crm.api.record.download_handler import DownloadHandler
except Exception:
from ..exception import SDKException
from ..util import StreamWrapper, Constants
from .response_handler import ResponseHandler
from .download_handler import DownloadHandler
class FileBodyWrapper(ResponseHandler, DownloadHandler):
def __init__(self):
"""Creates an instance of FileBodyWrapper"""
super().__init__()
self.__file = None
self.__key_modified = dict()
def get_file(self):
"""
The method to get the file
Returns:
StreamWrapper: An instance of StreamWrapper
"""
return self.__file
def set_file(self, file):
"""
The method to set the value to file
Parameters:
file (StreamWrapper) : An instance of StreamWrapper
"""
if file is not None and not isinstance(file, StreamWrapper):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: file EXPECTED TYPE: StreamWrapper', None, None)
self.__file = file
self.__key_modified['file'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/file_body_wrapper.py | file_body_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.convert_action_handler import ConvertActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .convert_action_handler import ConvertActionHandler
class ConvertActionWrapper(ConvertActionHandler):
def __init__(self):
"""Creates an instance of ConvertActionWrapper"""
super().__init__()
self.__data = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/convert_action_wrapper.py | convert_action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.parameter_map import ParameterMap
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Utility, Constants
from zcrmsdk.src.com.zoho.crm.api.param import Param
from zcrmsdk.src.com.zoho.crm.api.header import Header
from zcrmsdk.src.com.zoho.crm.api.header_map import HeaderMap
except Exception:
from ..exception import SDKException
from ..parameter_map import ParameterMap
from ..util import APIResponse, CommonAPIHandler, Utility, Constants
from ..param import Param
from ..header import Header
from ..header_map import HeaderMap
class RecordOperations(object):
def __init__(self):
"""Creates an instance of RecordOperations"""
pass
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
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')
def update_record(self, id, module_api_name, request, header_instance=None):
"""
The method to update record
Parameters:
id (int) : An int representing the id
module_api_name (string) : A string representing the module_api_name
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.record.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
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 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(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_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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_record(self, id, module_api_name, param_instance=None, header_instance=None):
"""
The method to delete 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_DELETE)
handler_instance.set_category_method(Constants.REQUEST_METHOD_DELETE)
handler_instance.set_param(param_instance)
handler_instance.set_header(header_instance)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def get_records(self, module_api_name, param_instance=None, header_instance=None):
"""
The method to get records
Parameters:
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(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)
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
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')
def create_records(self, module_api_name, request, header_instance=None):
"""
The method to create records
Parameters:
module_api_name (string) : A string representing the module_api_name
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.record.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(module_api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', 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(module_api_name)
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_header(header_instance)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def update_records(self, module_api_name, request, header_instance=None):
"""
The method to update records
Parameters:
module_api_name (string) : A string representing the module_api_name
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.record.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(module_api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', 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(module_api_name)
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_records(self, module_api_name, param_instance=None, header_instance=None):
"""
The method to delete records
Parameters:
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(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)
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)
handler_instance.set_param(param_instance)
handler_instance.set_header(header_instance)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def upsert_records(self, module_api_name, request, header_instance=None):
"""
The method to upsert records
Parameters:
module_api_name (string) : A string representing the module_api_name
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.record.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(module_api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', 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(module_api_name)
api_path = api_path + '/upsert'
handler_instance.set_api_path(api_path)
handler_instance.set_http_method(Constants.REQUEST_METHOD_POST)
handler_instance.set_category_method(Constants.REQUEST_CATEGORY_ACTION)
handler_instance.set_content_type('application/json')
handler_instance.set_request(request)
handler_instance.set_header(header_instance)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def get_deleted_records(self, module_api_name, param_instance=None, header_instance=None):
"""
The method to get deleted records
Parameters:
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(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 + '/deleted'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.record.deleted_records_handler import DeletedRecordsHandler
except Exception:
from .deleted_records_handler import DeletedRecordsHandler
return handler_instance.api_call(DeletedRecordsHandler.__module__, 'application/json')
def search_records(self, module_api_name, param_instance=None, header_instance=None):
"""
The method to search records
Parameters:
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(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 + '/search'
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
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')
def convert_lead(self, id, request):
"""
The method to convert lead
Parameters:
id (int) : An int representing the id
request (ConvertBodyWrapper) : An instance of ConvertBodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.convert_body_wrapper import ConvertBodyWrapper
except Exception:
from .convert_body_wrapper import ConvertBodyWrapper
if not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
if request is not None and not isinstance(request, ConvertBodyWrapper):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: ConvertBodyWrapper', None, None)
handler_instance = CommonAPIHandler()
api_path = ''
api_path = api_path + '/crm/v2/Leads/'
api_path = api_path + str(id)
api_path = api_path + '/actions/convert'
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)
Utility.get_fields("Deals", handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.convert_action_handler import ConvertActionHandler
except Exception:
from .convert_action_handler import ConvertActionHandler
return handler_instance.api_call(ConvertActionHandler.__module__, 'application/json')
def get_photo(self, id, module_api_name):
"""
The method to get 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_GET)
handler_instance.set_category_method(Constants.REQUEST_CATEGORY_READ)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.download_handler import DownloadHandler
except Exception:
from .download_handler import DownloadHandler
return handler_instance.api_call(DownloadHandler.__module__, 'application/x-download')
def upload_photo(self, id, module_api_name, request):
"""
The method to upload photo
Parameters:
id (int) : An int representing the id
module_api_name (string) : A string representing the module_api_name
request (FileBodyWrapper) : An instance of FileBodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.file_body_wrapper import FileBodyWrapper
except Exception:
from .file_body_wrapper import FileBodyWrapper
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 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/'
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_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)
Utility.get_fields(module_api_name, handler_instance)
Utility.verify_photo_support(module_api_name)
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')
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)
Utility.get_fields(module_api_name, handler_instance)
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')
def mass_update_records(self, module_api_name, request):
"""
The method to mass update records
Parameters:
module_api_name (string) : A string representing the module_api_name
request (MassUpdateBodyWrapper) : An instance of MassUpdateBodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_body_wrapper import MassUpdateBodyWrapper
except Exception:
from .mass_update_body_wrapper import MassUpdateBodyWrapper
if not isinstance(module_api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: str', None, None)
if request is not None and not isinstance(request, MassUpdateBodyWrapper):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: MassUpdateBodyWrapper', 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 + '/actions/mass_update'
handler_instance.set_api_path(api_path)
handler_instance.set_http_method(Constants.REQUEST_METHOD_POST)
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_action_handler import MassUpdateActionHandler
except Exception:
from .mass_update_action_handler import MassUpdateActionHandler
return handler_instance.api_call(MassUpdateActionHandler.__module__, 'application/json')
def get_mass_update_status(self, module_api_name, param_instance=None):
"""
The method to get mass update status
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/'
api_path = api_path + str(module_api_name)
api_path = api_path + '/actions/mass_update'
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)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_response_handler import MassUpdateResponseHandler
except Exception:
from .mass_update_response_handler import MassUpdateResponseHandler
return handler_instance.api_call(MassUpdateResponseHandler.__module__, 'application/json')
def get_record_using_external_id(self, external_field_value, module_api_name, param_instance=None, header_instance=None):
"""
The method to get record using external id
Parameters:
external_field_value (string) : A string representing the external_field_value
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(external_field_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: str', 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(external_field_value)
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
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')
def update_record_using_external_id(self, external_field_value, module_api_name, request, header_instance=None):
"""
The method to update record using external id
Parameters:
external_field_value (string) : A string representing the external_field_value
module_api_name (string) : A string representing the module_api_name
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.record.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(external_field_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: str', 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 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(module_api_name)
api_path = api_path + '/'
api_path = api_path + str(external_field_value)
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)
handler_instance.set_module_api_name(module_api_name)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_record_using_external_id(self, external_field_value, module_api_name, param_instance=None, header_instance=None):
"""
The method to delete record using external id
Parameters:
external_field_value (string) : A string representing the external_field_value
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(external_field_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: str', 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(external_field_value)
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)
handler_instance.set_param(param_instance)
handler_instance.set_header(header_instance)
Utility.get_fields(module_api_name, handler_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.record.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
class GetRecordParam(object):
approved = Param('approved', 'com.zoho.crm.api.Record.GetRecordParam')
converted = Param('converted', 'com.zoho.crm.api.Record.GetRecordParam')
cvid = Param('cvid', 'com.zoho.crm.api.Record.GetRecordParam')
uid = Param('uid', 'com.zoho.crm.api.Record.GetRecordParam')
fields = Param('fields', 'com.zoho.crm.api.Record.GetRecordParam')
startdatetime = Param('startDateTime', 'com.zoho.crm.api.Record.GetRecordParam')
enddatetime = Param('endDateTime', 'com.zoho.crm.api.Record.GetRecordParam')
territory_id = Param('territory_id', 'com.zoho.crm.api.Record.GetRecordParam')
include_child = Param('include_child', 'com.zoho.crm.api.Record.GetRecordParam')
class GetRecordHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Record.GetRecordHeader')
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.GetRecordHeader')
class UpdateRecordHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.UpdateRecordHeader')
class DeleteRecordParam(object):
wf_trigger = Param('wf_trigger', 'com.zoho.crm.api.Record.DeleteRecordParam')
class DeleteRecordHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.DeleteRecordHeader')
class GetRecordsParam(object):
approved = Param('approved', 'com.zoho.crm.api.Record.GetRecordsParam')
converted = Param('converted', 'com.zoho.crm.api.Record.GetRecordsParam')
cvid = Param('cvid', 'com.zoho.crm.api.Record.GetRecordsParam')
ids = Param('ids', 'com.zoho.crm.api.Record.GetRecordsParam')
uid = Param('uid', 'com.zoho.crm.api.Record.GetRecordsParam')
fields = Param('fields', 'com.zoho.crm.api.Record.GetRecordsParam')
sort_by = Param('sort_by', 'com.zoho.crm.api.Record.GetRecordsParam')
sort_order = Param('sort_order', 'com.zoho.crm.api.Record.GetRecordsParam')
page = Param('page', 'com.zoho.crm.api.Record.GetRecordsParam')
per_page = Param('per_page', 'com.zoho.crm.api.Record.GetRecordsParam')
startdatetime = Param('startDateTime', 'com.zoho.crm.api.Record.GetRecordsParam')
enddatetime = Param('endDateTime', 'com.zoho.crm.api.Record.GetRecordsParam')
territory_id = Param('territory_id', 'com.zoho.crm.api.Record.GetRecordsParam')
include_child = Param('include_child', 'com.zoho.crm.api.Record.GetRecordsParam')
class GetRecordsHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Record.GetRecordsHeader')
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.GetRecordsHeader')
class CreateRecordsHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.CreateRecordsHeader')
class UpdateRecordsHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.UpdateRecordsHeader')
class DeleteRecordsParam(object):
ids = Param('ids', 'com.zoho.crm.api.Record.DeleteRecordsParam')
wf_trigger = Param('wf_trigger', 'com.zoho.crm.api.Record.DeleteRecordsParam')
class DeleteRecordsHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.DeleteRecordsHeader')
class UpsertRecordsHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.UpsertRecordsHeader')
class GetDeletedRecordsParam(object):
type = Param('type', 'com.zoho.crm.api.Record.GetDeletedRecordsParam')
page = Param('page', 'com.zoho.crm.api.Record.GetDeletedRecordsParam')
per_page = Param('per_page', 'com.zoho.crm.api.Record.GetDeletedRecordsParam')
class GetDeletedRecordsHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Record.GetDeletedRecordsHeader')
class SearchRecordsParam(object):
criteria = Param('criteria', 'com.zoho.crm.api.Record.SearchRecordsParam')
email = Param('email', 'com.zoho.crm.api.Record.SearchRecordsParam')
phone = Param('phone', 'com.zoho.crm.api.Record.SearchRecordsParam')
word = Param('word', 'com.zoho.crm.api.Record.SearchRecordsParam')
converted = Param('converted', 'com.zoho.crm.api.Record.SearchRecordsParam')
approved = Param('approved', 'com.zoho.crm.api.Record.SearchRecordsParam')
page = Param('page', 'com.zoho.crm.api.Record.SearchRecordsParam')
per_page = Param('per_page', 'com.zoho.crm.api.Record.SearchRecordsParam')
fields = Param('fields', 'com.zoho.crm.api.Record.SearchRecordsParam')
class SearchRecordsHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.SearchRecordsHeader')
class GetMassUpdateStatusParam(object):
job_id = Param('job_id', 'com.zoho.crm.api.Record.GetMassUpdateStatusParam')
class GetRecordUsingExternalIDParam(object):
approved = Param('approved', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
converted = Param('converted', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
cvid = Param('cvid', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
uid = Param('uid', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
fields = Param('fields', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
startdatetime = Param('startDateTime', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
enddatetime = Param('endDateTime', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
territory_id = Param('territory_id', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
include_child = Param('include_child', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDParam')
class GetRecordUsingExternalIDHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDHeader')
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.GetRecordUsingExternalIDHeader')
class UpdateRecordUsingExternalIDHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.UpdateRecordUsingExternalIDHeader')
class DeleteRecordUsingExternalIDParam(object):
wf_trigger = Param('wf_trigger', 'com.zoho.crm.api.Record.DeleteRecordUsingExternalIDParam')
class DeleteRecordUsingExternalIDHeader(object):
x_external = Header('X-EXTERNAL', 'com.zoho.crm.api.Record.DeleteRecordUsingExternalIDHeader') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/record_operations.py | record_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.record.mass_update_response import MassUpdateResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .mass_update_response import MassUpdateResponse
class MassUpdate(MassUpdateResponse):
def __init__(self):
"""Creates an instance of MassUpdate"""
super().__init__()
self.__status = None
self.__failed_count = None
self.__updated_count = None
self.__not_updated_count = None
self.__total_count = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['Status'] = 1
def get_failed_count(self):
"""
The method to get the failed_count
Returns:
int: An int representing the failed_count
"""
return self.__failed_count
def set_failed_count(self, failed_count):
"""
The method to set the value to failed_count
Parameters:
failed_count (int) : An int representing the failed_count
"""
if failed_count is not None and not isinstance(failed_count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: failed_count EXPECTED TYPE: int', None, None)
self.__failed_count = failed_count
self.__key_modified['Failed_Count'] = 1
def get_updated_count(self):
"""
The method to get the updated_count
Returns:
int: An int representing the updated_count
"""
return self.__updated_count
def set_updated_count(self, updated_count):
"""
The method to set the value to updated_count
Parameters:
updated_count (int) : An int representing the updated_count
"""
if updated_count is not None and not isinstance(updated_count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: updated_count EXPECTED TYPE: int', None, None)
self.__updated_count = updated_count
self.__key_modified['Updated_Count'] = 1
def get_not_updated_count(self):
"""
The method to get the not_updated_count
Returns:
int: An int representing the not_updated_count
"""
return self.__not_updated_count
def set_not_updated_count(self, not_updated_count):
"""
The method to set the value to not_updated_count
Parameters:
not_updated_count (int) : An int representing the not_updated_count
"""
if not_updated_count is not None and not isinstance(not_updated_count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: not_updated_count EXPECTED TYPE: int', None, None)
self.__not_updated_count = not_updated_count
self.__key_modified['Not_Updated_Count'] = 1
def get_total_count(self):
"""
The method to get the total_count
Returns:
int: An int representing the total_count
"""
return self.__total_count
def set_total_count(self, total_count):
"""
The method to set the value to total_count
Parameters:
total_count (int) : An int representing the total_count
"""
if total_count is not None and not isinstance(total_count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: total_count EXPECTED TYPE: int', None, None)
self.__total_count = total_count
self.__key_modified['Total_Count'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/mass_update.py | mass_update.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class FileDetails(object):
def __init__(self):
"""Creates an instance of FileDetails"""
self.__extn = None
self.__is_preview_available = None
self.__download_url = None
self.__delete_url = None
self.__entity_id = None
self.__mode = None
self.__original_size_byte = None
self.__preview_url = None
self.__file_name = None
self.__file_id = None
self.__attachment_id = None
self.__file_size = None
self.__creator_id = None
self.__link_docs = None
self.__delete = None
self.__key_modified = dict()
def get_extn(self):
"""
The method to get the extn
Returns:
string: A string representing the extn
"""
return self.__extn
def set_extn(self, extn):
"""
The method to set the value to extn
Parameters:
extn (string) : A string representing the extn
"""
if extn is not None and not isinstance(extn, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: extn EXPECTED TYPE: str', None, None)
self.__extn = extn
self.__key_modified['extn'] = 1
def get_is_preview_available(self):
"""
The method to get the is_preview_available
Returns:
bool: A bool representing the is_preview_available
"""
return self.__is_preview_available
def set_is_preview_available(self, is_preview_available):
"""
The method to set the value to is_preview_available
Parameters:
is_preview_available (bool) : A bool representing the is_preview_available
"""
if is_preview_available is not None and not isinstance(is_preview_available, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: is_preview_available EXPECTED TYPE: bool', None, None)
self.__is_preview_available = is_preview_available
self.__key_modified['is_Preview_Available'] = 1
def get_download_url(self):
"""
The method to get the download_url
Returns:
string: A string representing the download_url
"""
return self.__download_url
def set_download_url(self, download_url):
"""
The method to set the value to download_url
Parameters:
download_url (string) : A string representing the download_url
"""
if download_url is not None and not isinstance(download_url, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: download_url EXPECTED TYPE: str', None, None)
self.__download_url = download_url
self.__key_modified['download_Url'] = 1
def get_delete_url(self):
"""
The method to get the delete_url
Returns:
string: A string representing the delete_url
"""
return self.__delete_url
def set_delete_url(self, delete_url):
"""
The method to set the value to delete_url
Parameters:
delete_url (string) : A string representing the delete_url
"""
if delete_url is not None and not isinstance(delete_url, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: delete_url EXPECTED TYPE: str', None, None)
self.__delete_url = delete_url
self.__key_modified['delete_Url'] = 1
def get_entity_id(self):
"""
The method to get the entity_id
Returns:
string: A string representing the entity_id
"""
return self.__entity_id
def set_entity_id(self, entity_id):
"""
The method to set the value to entity_id
Parameters:
entity_id (string) : A string representing the entity_id
"""
if entity_id is not None and not isinstance(entity_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: entity_id EXPECTED TYPE: str', None, None)
self.__entity_id = entity_id
self.__key_modified['entity_Id'] = 1
def get_mode(self):
"""
The method to get the mode
Returns:
string: A string representing the mode
"""
return self.__mode
def set_mode(self, mode):
"""
The method to set the value to mode
Parameters:
mode (string) : A string representing the mode
"""
if mode is not None and not isinstance(mode, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: mode EXPECTED TYPE: str', None, None)
self.__mode = mode
self.__key_modified['mode'] = 1
def get_original_size_byte(self):
"""
The method to get the original_size_byte
Returns:
string: A string representing the original_size_byte
"""
return self.__original_size_byte
def set_original_size_byte(self, original_size_byte):
"""
The method to set the value to original_size_byte
Parameters:
original_size_byte (string) : A string representing the original_size_byte
"""
if original_size_byte is not None and not isinstance(original_size_byte, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: original_size_byte EXPECTED TYPE: str', None, None)
self.__original_size_byte = original_size_byte
self.__key_modified['original_Size_Byte'] = 1
def get_preview_url(self):
"""
The method to get the preview_url
Returns:
string: A string representing the preview_url
"""
return self.__preview_url
def set_preview_url(self, preview_url):
"""
The method to set the value to preview_url
Parameters:
preview_url (string) : A string representing the preview_url
"""
if preview_url is not None and not isinstance(preview_url, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: preview_url EXPECTED TYPE: str', None, None)
self.__preview_url = preview_url
self.__key_modified['preview_Url'] = 1
def get_file_name(self):
"""
The method to get the file_name
Returns:
string: A string representing the file_name
"""
return self.__file_name
def set_file_name(self, file_name):
"""
The method to set the value to file_name
Parameters:
file_name (string) : A string representing the file_name
"""
if file_name is not None and not isinstance(file_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: file_name EXPECTED TYPE: str', None, None)
self.__file_name = file_name
self.__key_modified['file_Name'] = 1
def get_file_id(self):
"""
The method to get the file_id
Returns:
string: A string representing the file_id
"""
return self.__file_id
def set_file_id(self, file_id):
"""
The method to set the value to file_id
Parameters:
file_id (string) : A string representing the file_id
"""
if file_id is not None and not isinstance(file_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: file_id EXPECTED TYPE: str', None, None)
self.__file_id = file_id
self.__key_modified['file_Id'] = 1
def get_attachment_id(self):
"""
The method to get the attachment_id
Returns:
string: A string representing the attachment_id
"""
return self.__attachment_id
def set_attachment_id(self, attachment_id):
"""
The method to set the value to attachment_id
Parameters:
attachment_id (string) : A string representing the attachment_id
"""
if attachment_id is not None and not isinstance(attachment_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: attachment_id EXPECTED TYPE: str', None, None)
self.__attachment_id = attachment_id
self.__key_modified['attachment_Id'] = 1
def get_file_size(self):
"""
The method to get the file_size
Returns:
string: A string representing the file_size
"""
return self.__file_size
def set_file_size(self, file_size):
"""
The method to set the value to file_size
Parameters:
file_size (string) : A string representing the file_size
"""
if file_size is not None and not isinstance(file_size, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: file_size EXPECTED TYPE: str', None, None)
self.__file_size = file_size
self.__key_modified['file_Size'] = 1
def get_creator_id(self):
"""
The method to get the creator_id
Returns:
string: A string representing the creator_id
"""
return self.__creator_id
def set_creator_id(self, creator_id):
"""
The method to set the value to creator_id
Parameters:
creator_id (string) : A string representing the creator_id
"""
if creator_id is not None and not isinstance(creator_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: creator_id EXPECTED TYPE: str', None, None)
self.__creator_id = creator_id
self.__key_modified['creator_Id'] = 1
def get_link_docs(self):
"""
The method to get the link_docs
Returns:
int: An int representing the link_docs
"""
return self.__link_docs
def set_link_docs(self, link_docs):
"""
The method to set the value to link_docs
Parameters:
link_docs (int) : An int representing the link_docs
"""
if link_docs is not None and not isinstance(link_docs, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: link_docs EXPECTED TYPE: int', None, None)
self.__link_docs = link_docs
self.__key_modified['link_Docs'] = 1
def get_delete(self):
"""
The method to get the delete
Returns:
string: A string representing the delete
"""
return self.__delete
def set_delete(self, delete):
"""
The method to set the value to delete
Parameters:
delete (string) : A string representing the delete
"""
if delete is not None and not isinstance(delete, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: delete EXPECTED TYPE: str', None, None)
self.__delete = delete
self.__key_modified['_delete'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/file_details.py | file_details.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class MassUpdateBodyWrapper(object):
def __init__(self):
"""Creates an instance of MassUpdateBodyWrapper"""
self.__data = None
self.__cvid = None
self.__ids = None
self.__territory = None
self.__over_write = None
self.__criteria = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_cvid(self):
"""
The method to get the cvid
Returns:
string: A string representing the cvid
"""
return self.__cvid
def set_cvid(self, cvid):
"""
The method to set the value to cvid
Parameters:
cvid (string) : A string representing the cvid
"""
if cvid is not None and not isinstance(cvid, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: cvid EXPECTED TYPE: str', None, None)
self.__cvid = cvid
self.__key_modified['cvid'] = 1
def get_ids(self):
"""
The method to get the ids
Returns:
list: An instance of list
"""
return self.__ids
def set_ids(self, ids):
"""
The method to set the value to ids
Parameters:
ids (list) : An instance of list
"""
if ids is not None and not isinstance(ids, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: ids EXPECTED TYPE: list', None, None)
self.__ids = ids
self.__key_modified['ids'] = 1
def get_territory(self):
"""
The method to get the territory
Returns:
Territory: An instance of Territory
"""
return self.__territory
def set_territory(self, territory):
"""
The method to set the value to territory
Parameters:
territory (Territory) : An instance of Territory
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record.territory import Territory
except Exception:
from .territory import Territory
if territory is not None and not isinstance(territory, Territory):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: territory EXPECTED TYPE: Territory', None, None)
self.__territory = territory
self.__key_modified['territory'] = 1
def get_over_write(self):
"""
The method to get the over_write
Returns:
bool: A bool representing the over_write
"""
return self.__over_write
def set_over_write(self, over_write):
"""
The method to set the value to over_write
Parameters:
over_write (bool) : A bool representing the over_write
"""
if over_write is not None and not isinstance(over_write, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: over_write EXPECTED TYPE: bool', None, None)
self.__over_write = over_write
self.__key_modified['over_write'] = 1
def get_criteria(self):
"""
The method to get the criteria
Returns:
list: An instance of list
"""
return self.__criteria
def set_criteria(self, criteria):
"""
The method to set the value to criteria
Parameters:
criteria (list) : An instance of list
"""
if criteria is not None and not isinstance(criteria, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: criteria EXPECTED TYPE: list', None, None)
self.__criteria = criteria
self.__key_modified['criteria'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/mass_update_body_wrapper.py | mass_update_body_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from .record import Record
class Participants(Record):
def __init__(self):
"""Creates an instance of Participants"""
super().__init__()
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.get_key_value('name')
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.add_key_value('name', name)
def get_email(self):
"""
The method to get the email
Returns:
string: A string representing the email
"""
return self.get_key_value('Email')
def set_email(self, email):
"""
The method to set the value to email
Parameters:
email (string) : A string representing the email
"""
if email is not None and not isinstance(email, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: email EXPECTED TYPE: str', None, None)
self.add_key_value('Email', email)
def get_invited(self):
"""
The method to get the invited
Returns:
bool: A bool representing the invited
"""
return self.get_key_value('invited')
def set_invited(self, invited):
"""
The method to set the value to invited
Parameters:
invited (bool) : A bool representing the invited
"""
if invited is not None and not isinstance(invited, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: invited EXPECTED TYPE: bool', None, None)
self.add_key_value('invited', invited)
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.get_key_value('type')
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.add_key_value('type', type)
def get_participant(self):
"""
The method to get the participant
Returns:
string: A string representing the participant
"""
return self.get_key_value('participant')
def set_participant(self, participant):
"""
The method to set the value to participant
Parameters:
participant (string) : A string representing the participant
"""
if participant is not None and not isinstance(participant, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: participant EXPECTED TYPE: str', None, None)
self.add_key_value('participant', participant)
def get_status(self):
"""
The method to get the status
Returns:
string: A string representing the status
"""
return self.get_key_value('status')
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (string) : A string representing the status
"""
if status is not None and not isinstance(status, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: str', None, None)
self.add_key_value('status', status) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/participants.py | participants.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class BodyWrapper(object):
def __init__(self):
"""Creates an instance of BodyWrapper"""
self.__data = None
self.__apply_feature_execution = None
self.__trigger = None
self.__process = None
self.__duplicate_check_fields = None
self.__wf_trigger = None
self.__lar_id = None
self.__key_modified = dict()
def get_data(self):
"""
The method to get the data
Returns:
list: An instance of list
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (list) : An instance of list
"""
if data is not None and not isinstance(data, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: list', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_apply_feature_execution(self):
"""
The method to get the apply_feature_execution
Returns:
list: An instance of list
"""
return self.__apply_feature_execution
def set_apply_feature_execution(self, apply_feature_execution):
"""
The method to set the value to apply_feature_execution
Parameters:
apply_feature_execution (list) : An instance of list
"""
if apply_feature_execution is not None and not isinstance(apply_feature_execution, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: apply_feature_execution EXPECTED TYPE: list', None, None)
self.__apply_feature_execution = apply_feature_execution
self.__key_modified['apply_feature_execution'] = 1
def get_trigger(self):
"""
The method to get the trigger
Returns:
list: An instance of list
"""
return self.__trigger
def set_trigger(self, trigger):
"""
The method to set the value to trigger
Parameters:
trigger (list) : An instance of list
"""
if trigger is not None and not isinstance(trigger, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: trigger EXPECTED TYPE: list', None, None)
self.__trigger = trigger
self.__key_modified['trigger'] = 1
def get_process(self):
"""
The method to get the process
Returns:
list: An instance of list
"""
return self.__process
def set_process(self, process):
"""
The method to set the value to process
Parameters:
process (list) : An instance of list
"""
if process is not None and not isinstance(process, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: process EXPECTED TYPE: list', None, None)
self.__process = process
self.__key_modified['process'] = 1
def get_duplicate_check_fields(self):
"""
The method to get the duplicate_check_fields
Returns:
list: An instance of list
"""
return self.__duplicate_check_fields
def set_duplicate_check_fields(self, duplicate_check_fields):
"""
The method to set the value to duplicate_check_fields
Parameters:
duplicate_check_fields (list) : An instance of list
"""
if duplicate_check_fields is not None and not isinstance(duplicate_check_fields, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: duplicate_check_fields EXPECTED TYPE: list', None, None)
self.__duplicate_check_fields = duplicate_check_fields
self.__key_modified['duplicate_check_fields'] = 1
def get_wf_trigger(self):
"""
The method to get the wf_trigger
Returns:
string: A string representing the wf_trigger
"""
return self.__wf_trigger
def set_wf_trigger(self, wf_trigger):
"""
The method to set the value to wf_trigger
Parameters:
wf_trigger (string) : A string representing the wf_trigger
"""
if wf_trigger is not None and not isinstance(wf_trigger, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: wf_trigger EXPECTED TYPE: str', None, None)
self.__wf_trigger = wf_trigger
self.__key_modified['wf_trigger'] = 1
def get_lar_id(self):
"""
The method to get the lar_id
Returns:
string: A string representing the lar_id
"""
return self.__lar_id
def set_lar_id(self, lar_id):
"""
The method to set the value to lar_id
Parameters:
lar_id (string) : A string representing the lar_id
"""
if lar_id is not None and not isinstance(lar_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: lar_id EXPECTED TYPE: str', None, None)
self.__lar_id = lar_id
self.__key_modified['lar_id'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/body_wrapper.py | body_wrapper.py |
from .criteria import Criteria
from .file_details import FileDetails
from .apply_feature_execution import ApplyFeatureExecution
from .record_operations import RecordOperations, GetRecordParam, GetRecordHeader, UpdateRecordHeader, DeleteRecordParam, DeleteRecordHeader, GetRecordsParam, GetRecordsHeader, CreateRecordsHeader, UpdateRecordsHeader, DeleteRecordsParam, DeleteRecordsHeader, UpsertRecordsHeader, GetDeletedRecordsParam, GetDeletedRecordsHeader, SearchRecordsParam, SearchRecordsHeader, GetMassUpdateStatusParam, GetRecordUsingExternalIDParam, GetRecordUsingExternalIDHeader, UpdateRecordUsingExternalIDHeader, DeleteRecordUsingExternalIDParam, DeleteRecordUsingExternalIDHeader
from .mass_update_response_wrapper import MassUpdateResponseWrapper
from .recurring_activity import RecurringActivity
from .record import Record
from .options import Options
from .download_handler import DownloadHandler
from .info import Info
from .convert_action_response import ConvertActionResponse
from .convert_action_wrapper import ConvertActionWrapper
from .body_wrapper import BodyWrapper
from .consent import Consent
from .lead_converter import LeadConverter
from .convert_body_wrapper import ConvertBodyWrapper
from .line_item_product import LineItemProduct
from .field import Field
from .mass_update_success_response import MassUpdateSuccessResponse
from .convert_action_handler import ConvertActionHandler
from .line_tax import LineTax
from .deleted_record import DeletedRecord
from .pricing_details import PricingDetails
from .api_exception import APIException
from .response_handler import ResponseHandler
from .action_response import ActionResponse
from .success_response import SuccessResponse
from .file_body_wrapper import FileBodyWrapper
from .mass_update_response import MassUpdateResponse
from .action_handler import ActionHandler
from .participants import Participants
from .successful_convert import SuccessfulConvert
from .action_wrapper import ActionWrapper
from .mass_update_action_wrapper import MassUpdateActionWrapper
from .reminder import Reminder
from .mass_update_action_handler import MassUpdateActionHandler
from .mass_update_body_wrapper import MassUpdateBodyWrapper
from .deleted_records_wrapper import DeletedRecordsWrapper
from .remind_at import RemindAt
from .mass_update_action_response import MassUpdateActionResponse
from .file_handler import FileHandler
from .deleted_records_handler import DeletedRecordsHandler
from .mass_update_response_handler import MassUpdateResponseHandler
from .inventory_line_items import InventoryLineItems
from .carry_over_tags import CarryOverTags
from .response_wrapper import ResponseWrapper
from .comment import Comment
from .mass_update import MassUpdate
from .territory import Territory | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/__init__.py | __init__.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.record.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.record.file_handler import FileHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .file_handler import FileHandler
class SuccessResponse(ActionResponse, FileHandler):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__duplicate_field = None
self.__action = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_duplicate_field(self):
"""
The method to get the duplicate_field
Returns:
string: A string representing the duplicate_field
"""
return self.__duplicate_field
def set_duplicate_field(self, duplicate_field):
"""
The method to set the value to duplicate_field
Parameters:
duplicate_field (string) : A string representing the duplicate_field
"""
if duplicate_field is not None and not isinstance(duplicate_field, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: duplicate_field EXPECTED TYPE: str', None, None)
self.__duplicate_field = duplicate_field
self.__key_modified['duplicate_field'] = 1
def get_action(self):
"""
The method to get the action
Returns:
Choice: An instance of Choice
"""
return self.__action
def set_action(self, action):
"""
The method to set the value to action
Parameters:
action (Choice) : An instance of Choice
"""
if action is not None and not isinstance(action, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: action EXPECTED TYPE: Choice', None, None)
self.__action = action
self.__key_modified['action'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from .record import Record
class PricingDetails(Record):
def __init__(self):
"""Creates an instance of PricingDetails"""
super().__init__()
def get_to_range(self):
"""
The method to get the to_range
Returns:
float: A float representing the to_range
"""
return self.get_key_value('to_range')
def set_to_range(self, to_range):
"""
The method to set the value to to_range
Parameters:
to_range (float) : A float representing the to_range
"""
if to_range is not None and not isinstance(to_range, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: to_range EXPECTED TYPE: float', None, None)
self.add_key_value('to_range', to_range)
def get_discount(self):
"""
The method to get the discount
Returns:
float: A float representing the discount
"""
return self.get_key_value('discount')
def set_discount(self, discount):
"""
The method to set the value to discount
Parameters:
discount (float) : A float representing the discount
"""
if discount is not None and not isinstance(discount, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: discount EXPECTED TYPE: float', None, None)
self.add_key_value('discount', discount)
def get_from_range(self):
"""
The method to get the from_range
Returns:
float: A float representing the from_range
"""
return self.get_key_value('from_range')
def set_from_range(self, from_range):
"""
The method to set the value to from_range
Parameters:
from_range (float) : A float representing the from_range
"""
if from_range is not None and not isinstance(from_range, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: from_range EXPECTED TYPE: float', None, None)
self.add_key_value('from_range', from_range) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/record/pricing_details.py | pricing_details.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.related_lists.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__related_lists = None
self.__key_modified = dict()
def get_related_lists(self):
"""
The method to get the related_lists
Returns:
list: An instance of list
"""
return self.__related_lists
def set_related_lists(self, related_lists):
"""
The method to set the value to related_lists
Parameters:
related_lists (list) : An instance of list
"""
if related_lists is not None and not isinstance(related_lists, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: related_lists EXPECTED TYPE: list', None, None)
self.__related_lists = related_lists
self.__key_modified['related_lists'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/related_lists/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.related_lists.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .response_handler import ResponseHandler
class APIException(ResponseHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/related_lists/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class RelatedList(object):
def __init__(self):
"""Creates an instance of RelatedList"""
self.__id = None
self.__sequence_number = None
self.__display_label = None
self.__api_name = None
self.__module = None
self.__name = None
self.__action = None
self.__href = None
self.__type = None
self.__connectedmodule = None
self.__linkingmodule = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_sequence_number(self):
"""
The method to get the sequence_number
Returns:
string: A string representing the sequence_number
"""
return self.__sequence_number
def set_sequence_number(self, sequence_number):
"""
The method to set the value to sequence_number
Parameters:
sequence_number (string) : A string representing the sequence_number
"""
if sequence_number is not None and not isinstance(sequence_number, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sequence_number EXPECTED TYPE: str', None, None)
self.__sequence_number = sequence_number
self.__key_modified['sequence_number'] = 1
def get_display_label(self):
"""
The method to get the display_label
Returns:
string: A string representing the display_label
"""
return self.__display_label
def set_display_label(self, display_label):
"""
The method to set the value to display_label
Parameters:
display_label (string) : A string representing the display_label
"""
if display_label is not None and not isinstance(display_label, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: display_label EXPECTED TYPE: str', None, None)
self.__display_label = display_label
self.__key_modified['display_label'] = 1
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
def set_api_name(self, api_name):
"""
The method to set the value to api_name
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
self.__key_modified['api_name'] = 1
def get_module(self):
"""
The method to get the module
Returns:
string: A string representing the module
"""
return self.__module
def set_module(self, module):
"""
The method to set the value to module
Parameters:
module (string) : A string representing the module
"""
if module is not None and not isinstance(module, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module EXPECTED TYPE: str', None, None)
self.__module = module
self.__key_modified['module'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_action(self):
"""
The method to get the action
Returns:
string: A string representing the action
"""
return self.__action
def set_action(self, action):
"""
The method to set the value to action
Parameters:
action (string) : A string representing the action
"""
if action is not None and not isinstance(action, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: action EXPECTED TYPE: str', None, None)
self.__action = action
self.__key_modified['action'] = 1
def get_href(self):
"""
The method to get the href
Returns:
string: A string representing the href
"""
return self.__href
def set_href(self, href):
"""
The method to set the value to href
Parameters:
href (string) : A string representing the href
"""
if href is not None and not isinstance(href, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: href EXPECTED TYPE: str', None, None)
self.__href = href
self.__key_modified['href'] = 1
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.__type
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.__type = type
self.__key_modified['type'] = 1
def get_connectedmodule(self):
"""
The method to get the connectedmodule
Returns:
string: A string representing the connectedmodule
"""
return self.__connectedmodule
def set_connectedmodule(self, connectedmodule):
"""
The method to set the value to connectedmodule
Parameters:
connectedmodule (string) : A string representing the connectedmodule
"""
if connectedmodule is not None and not isinstance(connectedmodule, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: connectedmodule EXPECTED TYPE: str', None, None)
self.__connectedmodule = connectedmodule
self.__key_modified['connectedmodule'] = 1
def get_linkingmodule(self):
"""
The method to get the linkingmodule
Returns:
string: A string representing the linkingmodule
"""
return self.__linkingmodule
def set_linkingmodule(self, linkingmodule):
"""
The method to set the value to linkingmodule
Parameters:
linkingmodule (string) : A string representing the linkingmodule
"""
if linkingmodule is not None and not isinstance(linkingmodule, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: linkingmodule EXPECTED TYPE: str', None, None)
self.__linkingmodule = linkingmodule
self.__key_modified['linkingmodule'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/related_lists/related_list.py | related_list.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
from zcrmsdk.src.com.zoho.crm.api.param import Param
except Exception:
from ..exception import SDKException
from ..util import APIResponse, CommonAPIHandler, Constants
from ..param import Param
class RelatedListsOperations(object):
def __init__(self, module=None):
"""
Creates an instance of RelatedListsOperations with the given parameters
Parameters:
module (string) : A string representing the module
"""
if module is not None and not isinstance(module, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module EXPECTED TYPE: str', None, None)
self.__module = module
def get_related_lists(self):
"""
The method to get related lists
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
handler_instance = CommonAPIHandler()
api_path = ''
api_path = api_path + '/crm/v2/settings/related_lists'
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.RelatedLists.GetRelatedListsParam'), self.__module)
try:
from zcrmsdk.src.com.zoho.crm.api.related_lists.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def get_related_list(self, id):
"""
The method to get related list
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/settings/related_lists/'
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.RelatedLists.GetRelatedListParam'), self.__module)
try:
from zcrmsdk.src.com.zoho.crm.api.related_lists.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
class GetRelatedListsParam(object):
pass
class GetRelatedListParam(object):
pass | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/related_lists/related_lists_operations.py | related_lists_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.blue_print.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__blueprint = None
self.__key_modified = dict()
def get_blueprint(self):
"""
The method to get the blueprint
Returns:
BluePrint: An instance of BluePrint
"""
return self.__blueprint
def set_blueprint(self, blueprint):
"""
The method to set the value to blueprint
Parameters:
blueprint (BluePrint) : An instance of BluePrint
"""
try:
from zcrmsdk.src.com.zoho.crm.api.blue_print.blue_print import BluePrint
except Exception:
from .blue_print import BluePrint
if blueprint is not None and not isinstance(blueprint, BluePrint):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: blueprint EXPECTED TYPE: BluePrint', None, None)
self.__blueprint = blueprint
self.__key_modified['blueprint'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class NextTransition(object):
def __init__(self):
"""Creates an instance of NextTransition"""
self.__id = None
self.__name = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/next_transition.py | next_transition.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class ProcessInfo(object):
def __init__(self):
"""Creates an instance of ProcessInfo"""
self.__field_id = None
self.__is_continuous = None
self.__api_name = None
self.__continuous = None
self.__field_label = None
self.__name = None
self.__column_name = None
self.__field_value = None
self.__id = None
self.__field_name = None
self.__escalation = None
self.__key_modified = dict()
def get_field_id(self):
"""
The method to get the field_id
Returns:
string: A string representing the field_id
"""
return self.__field_id
def set_field_id(self, field_id):
"""
The method to set the value to field_id
Parameters:
field_id (string) : A string representing the field_id
"""
if field_id is not None and not isinstance(field_id, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field_id EXPECTED TYPE: str', None, None)
self.__field_id = field_id
self.__key_modified['field_id'] = 1
def get_is_continuous(self):
"""
The method to get the is_continuous
Returns:
bool: A bool representing the is_continuous
"""
return self.__is_continuous
def set_is_continuous(self, is_continuous):
"""
The method to set the value to is_continuous
Parameters:
is_continuous (bool) : A bool representing the is_continuous
"""
if is_continuous is not None and not isinstance(is_continuous, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: is_continuous EXPECTED TYPE: bool', None, None)
self.__is_continuous = is_continuous
self.__key_modified['is_continuous'] = 1
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
def set_api_name(self, api_name):
"""
The method to set the value to api_name
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
self.__key_modified['api_name'] = 1
def get_continuous(self):
"""
The method to get the continuous
Returns:
bool: A bool representing the continuous
"""
return self.__continuous
def set_continuous(self, continuous):
"""
The method to set the value to continuous
Parameters:
continuous (bool) : A bool representing the continuous
"""
if continuous is not None and not isinstance(continuous, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: continuous EXPECTED TYPE: bool', None, None)
self.__continuous = continuous
self.__key_modified['continuous'] = 1
def get_field_label(self):
"""
The method to get the field_label
Returns:
string: A string representing the field_label
"""
return self.__field_label
def set_field_label(self, field_label):
"""
The method to set the value to field_label
Parameters:
field_label (string) : A string representing the field_label
"""
if field_label is not None and not isinstance(field_label, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field_label EXPECTED TYPE: str', None, None)
self.__field_label = field_label
self.__key_modified['field_label'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_column_name(self):
"""
The method to get the column_name
Returns:
string: A string representing the column_name
"""
return self.__column_name
def set_column_name(self, column_name):
"""
The method to set the value to column_name
Parameters:
column_name (string) : A string representing the column_name
"""
if column_name is not None and not isinstance(column_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: column_name EXPECTED TYPE: str', None, None)
self.__column_name = column_name
self.__key_modified['column_name'] = 1
def get_field_value(self):
"""
The method to get the field_value
Returns:
string: A string representing the field_value
"""
return self.__field_value
def set_field_value(self, field_value):
"""
The method to set the value to field_value
Parameters:
field_value (string) : A string representing the field_value
"""
if field_value is not None and not isinstance(field_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field_value EXPECTED TYPE: str', None, None)
self.__field_value = field_value
self.__key_modified['field_value'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_field_name(self):
"""
The method to get the field_name
Returns:
string: A string representing the field_name
"""
return self.__field_name
def set_field_name(self, field_name):
"""
The method to set the value to field_name
Parameters:
field_name (string) : A string representing the field_name
"""
if field_name is not None and not isinstance(field_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: field_name EXPECTED TYPE: str', None, None)
self.__field_name = field_name
self.__key_modified['field_name'] = 1
def get_escalation(self):
"""
The method to get the escalation
Returns:
string: A string representing the escalation
"""
return self.__escalation
def set_escalation(self, escalation):
"""
The method to set the value to escalation
Parameters:
escalation (string) : A string representing the escalation
"""
if escalation is not None and not isinstance(escalation, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: escalation EXPECTED TYPE: str', None, None)
self.__escalation = escalation
self.__key_modified['escalation'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/process_info.py | process_info.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class BluePrint(object):
def __init__(self):
"""Creates an instance of BluePrint"""
self.__transition_id = None
self.__data = None
self.__process_info = None
self.__transitions = None
self.__key_modified = dict()
def get_transition_id(self):
"""
The method to get the transition_id
Returns:
int: An int representing the transition_id
"""
return self.__transition_id
def set_transition_id(self, transition_id):
"""
The method to set the value to transition_id
Parameters:
transition_id (int) : An int representing the transition_id
"""
if transition_id is not None and not isinstance(transition_id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: transition_id EXPECTED TYPE: int', None, None)
self.__transition_id = transition_id
self.__key_modified['transition_id'] = 1
def get_data(self):
"""
The method to get the data
Returns:
Record: An instance of Record
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (Record) : An instance of Record
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record import Record
except Exception:
from ..record import Record
if data is not None and not isinstance(data, Record):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: Record', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_process_info(self):
"""
The method to get the process_info
Returns:
ProcessInfo: An instance of ProcessInfo
"""
return self.__process_info
def set_process_info(self, process_info):
"""
The method to set the value to process_info
Parameters:
process_info (ProcessInfo) : An instance of ProcessInfo
"""
try:
from zcrmsdk.src.com.zoho.crm.api.blue_print.process_info import ProcessInfo
except Exception:
from .process_info import ProcessInfo
if process_info is not None and not isinstance(process_info, ProcessInfo):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: process_info EXPECTED TYPE: ProcessInfo', None, None)
self.__process_info = process_info
self.__key_modified['process_info'] = 1
def get_transitions(self):
"""
The method to get the transitions
Returns:
list: An instance of list
"""
return self.__transitions
def set_transitions(self, transitions):
"""
The method to set the value to transitions
Parameters:
transitions (list) : An instance of list
"""
if transitions is not None and not isinstance(transitions, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: transitions EXPECTED TYPE: list', None, None)
self.__transitions = transitions
self.__key_modified['transitions'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/blue_print.py | blue_print.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.blue_print.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.blue_print.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .response_handler import ResponseHandler
class APIException(ResponseHandler, ActionResponse):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Transition(object):
def __init__(self):
"""Creates an instance of Transition"""
self.__next_transitions = None
self.__percent_partial_save = None
self.__data = None
self.__next_field_value = None
self.__name = None
self.__criteria_matched = None
self.__id = None
self.__fields = None
self.__criteria_message = None
self.__type = None
self.__execution_time = None
self.__key_modified = dict()
def get_next_transitions(self):
"""
The method to get the next_transitions
Returns:
list: An instance of list
"""
return self.__next_transitions
def set_next_transitions(self, next_transitions):
"""
The method to set the value to next_transitions
Parameters:
next_transitions (list) : An instance of list
"""
if next_transitions is not None and not isinstance(next_transitions, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: next_transitions EXPECTED TYPE: list', None, None)
self.__next_transitions = next_transitions
self.__key_modified['next_transitions'] = 1
def get_percent_partial_save(self):
"""
The method to get the percent_partial_save
Returns:
float: A float representing the percent_partial_save
"""
return self.__percent_partial_save
def set_percent_partial_save(self, percent_partial_save):
"""
The method to set the value to percent_partial_save
Parameters:
percent_partial_save (float) : A float representing the percent_partial_save
"""
if percent_partial_save is not None and not isinstance(percent_partial_save, float):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: percent_partial_save EXPECTED TYPE: float', None, None)
self.__percent_partial_save = percent_partial_save
self.__key_modified['percent_partial_save'] = 1
def get_data(self):
"""
The method to get the data
Returns:
Record: An instance of Record
"""
return self.__data
def set_data(self, data):
"""
The method to set the value to data
Parameters:
data (Record) : An instance of Record
"""
try:
from zcrmsdk.src.com.zoho.crm.api.record import Record
except Exception:
from ..record import Record
if data is not None and not isinstance(data, Record):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: data EXPECTED TYPE: Record', None, None)
self.__data = data
self.__key_modified['data'] = 1
def get_next_field_value(self):
"""
The method to get the next_field_value
Returns:
string: A string representing the next_field_value
"""
return self.__next_field_value
def set_next_field_value(self, next_field_value):
"""
The method to set the value to next_field_value
Parameters:
next_field_value (string) : A string representing the next_field_value
"""
if next_field_value is not None and not isinstance(next_field_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: next_field_value EXPECTED TYPE: str', None, None)
self.__next_field_value = next_field_value
self.__key_modified['next_field_value'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_criteria_matched(self):
"""
The method to get the criteria_matched
Returns:
bool: A bool representing the criteria_matched
"""
return self.__criteria_matched
def set_criteria_matched(self, criteria_matched):
"""
The method to set the value to criteria_matched
Parameters:
criteria_matched (bool) : A bool representing the criteria_matched
"""
if criteria_matched is not None and not isinstance(criteria_matched, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: criteria_matched EXPECTED TYPE: bool', None, None)
self.__criteria_matched = criteria_matched
self.__key_modified['criteria_matched'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_fields(self):
"""
The method to get the fields
Returns:
list: An instance of list
"""
return self.__fields
def set_fields(self, fields):
"""
The method to set the value to fields
Parameters:
fields (list) : An instance of list
"""
if fields is not None and not isinstance(fields, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: fields EXPECTED TYPE: list', None, None)
self.__fields = fields
self.__key_modified['fields'] = 1
def get_criteria_message(self):
"""
The method to get the criteria_message
Returns:
string: A string representing the criteria_message
"""
return self.__criteria_message
def set_criteria_message(self, criteria_message):
"""
The method to set the value to criteria_message
Parameters:
criteria_message (string) : A string representing the criteria_message
"""
if criteria_message is not None and not isinstance(criteria_message, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: criteria_message EXPECTED TYPE: str', None, None)
self.__criteria_message = criteria_message
self.__key_modified['criteria_message'] = 1
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.__type
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.__type = type
self.__key_modified['type'] = 1
def get_execution_time(self):
"""
The method to get the execution_time
Returns:
datetime: An instance of datetime
"""
return self.__execution_time
def set_execution_time(self, execution_time):
"""
The method to set the value to execution_time
Parameters:
execution_time (datetime) : An instance of datetime
"""
from datetime import datetime
if execution_time is not None and not isinstance(execution_time, datetime):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: execution_time EXPECTED TYPE: datetime', None, None)
self.__execution_time = execution_time
self.__key_modified['execution_time'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/transition.py | transition.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class ValidationError(object):
def __init__(self):
"""Creates an instance of ValidationError"""
self.__api_name = None
self.__message = None
self.__key_modified = dict()
def get_api_name(self):
"""
The method to get the api_name
Returns:
string: A string representing the api_name
"""
return self.__api_name
def set_api_name(self, api_name):
"""
The method to set the value to api_name
Parameters:
api_name (string) : A string representing the api_name
"""
if api_name is not None and not isinstance(api_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: api_name EXPECTED TYPE: str', None, None)
self.__api_name = api_name
self.__key_modified['api_name'] = 1
def get_message(self):
"""
The method to get the message
Returns:
string: A string representing the message
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (string) : A string representing the message
"""
if message is not None and not isinstance(message, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: str', None, None)
self.__message = message
self.__key_modified['message'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/validation_error.py | validation_error.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.blue_print.action_response import ActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
class SuccessResponse(ActionResponse):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
except Exception:
from ..exception import SDKException
from ..util import APIResponse, CommonAPIHandler, Constants
class BluePrintOperations(object):
def __init__(self, record_id, module_api_name):
"""
Creates an instance of BluePrintOperations with the given parameters
Parameters:
record_id (int) : An int representing the record_id
module_api_name (string) : A string representing the module_api_name
"""
if not isinstance(record_id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: record_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)
self.__record_id = record_id
self.__module_api_name = module_api_name
def get_blueprint(self):
"""
The method to get blueprint
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
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 + '/actions/blueprint'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.blue_print.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def update_blueprint(self, request):
"""
The method to update blueprint
Parameters:
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.blue_print.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/'
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/blueprint'
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.blue_print.action_response import ActionResponse
except Exception:
from .action_response import ActionResponse
return handler_instance.api_call(ActionResponse.__module__, 'application/json') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/blue_print/blue_print_operations.py | blue_print_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.users.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .action_handler import ActionHandler
class ActionWrapper(ActionHandler):
def __init__(self):
"""Creates an instance of ActionWrapper"""
super().__init__()
self.__users = None
self.__key_modified = dict()
def get_users(self):
"""
The method to get the users
Returns:
list: An instance of list
"""
return self.__users
def set_users(self, users):
"""
The method to set the value to users
Parameters:
users (list) : An instance of list
"""
if users is not None and not isinstance(users, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: users EXPECTED TYPE: list', None, None)
self.__users = users
self.__key_modified['users'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/action_wrapper.py | action_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.users.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__users = None
self.__info = None
self.__key_modified = dict()
def get_users(self):
"""
The method to get the users
Returns:
list: An instance of list
"""
return self.__users
def set_users(self, users):
"""
The method to set the value to users
Parameters:
users (list) : An instance of list
"""
if users is not None and not isinstance(users, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: users EXPECTED TYPE: list', None, None)
self.__users = users
self.__key_modified['users'] = 1
def get_info(self):
"""
The method to get the info
Returns:
Info: An instance of Info
"""
return self.__info
def set_info(self, info):
"""
The method to set the value to info
Parameters:
info (Info) : An instance of Info
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.info import Info
except Exception:
from .info import Info
if info is not None and not isinstance(info, Info):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: info EXPECTED TYPE: Info', None, None)
self.__info = info
self.__key_modified['info'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Territory(object):
def __init__(self):
"""Creates an instance of Territory"""
self.__manager = None
self.__name = None
self.__id = None
self.__key_modified = dict()
def get_manager(self):
"""
The method to get the manager
Returns:
bool: A bool representing the manager
"""
return self.__manager
def set_manager(self, manager):
"""
The method to set the value to manager
Parameters:
manager (bool) : A bool representing the manager
"""
if manager is not None and not isinstance(manager, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: manager EXPECTED TYPE: bool', None, None)
self.__manager = manager
self.__key_modified['manager'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/territory.py | territory.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.users.action_response import ActionResponse
from zcrmsdk.src.com.zoho.crm.api.users.response_handler import ResponseHandler
from zcrmsdk.src.com.zoho.crm.api.users.action_handler import ActionHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
from .response_handler import ResponseHandler
from .action_handler import ActionHandler
class APIException(ResponseHandler, ActionResponse, ActionHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/api_exception.py | api_exception.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Info(object):
def __init__(self):
"""Creates an instance of Info"""
self.__per_page = None
self.__count = None
self.__page = None
self.__more_records = None
self.__key_modified = dict()
def get_per_page(self):
"""
The method to get the per_page
Returns:
int: An int representing the per_page
"""
return self.__per_page
def set_per_page(self, per_page):
"""
The method to set the value to per_page
Parameters:
per_page (int) : An int representing the per_page
"""
if per_page is not None and not isinstance(per_page, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: per_page EXPECTED TYPE: int', None, None)
self.__per_page = per_page
self.__key_modified['per_page'] = 1
def get_count(self):
"""
The method to get the count
Returns:
int: An int representing the count
"""
return self.__count
def set_count(self, count):
"""
The method to set the value to count
Parameters:
count (int) : An int representing the count
"""
if count is not None and not isinstance(count, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: count EXPECTED TYPE: int', None, None)
self.__count = count
self.__key_modified['count'] = 1
def get_page(self):
"""
The method to get the page
Returns:
int: An int representing the page
"""
return self.__page
def set_page(self, page):
"""
The method to set the value to page
Parameters:
page (int) : An int representing the page
"""
if page is not None and not isinstance(page, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: page EXPECTED TYPE: int', None, None)
self.__page = page
self.__key_modified['page'] = 1
def get_more_records(self):
"""
The method to get the more_records
Returns:
bool: A bool representing the more_records
"""
return self.__more_records
def set_more_records(self, more_records):
"""
The method to set the value to more_records
Parameters:
more_records (bool) : A bool representing the more_records
"""
if more_records is not None and not isinstance(more_records, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: more_records EXPECTED TYPE: bool', None, None)
self.__more_records = more_records
self.__key_modified['more_records'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/info.py | info.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Theme(object):
def __init__(self):
"""Creates an instance of Theme"""
self.__normal_tab = None
self.__selected_tab = None
self.__new_background = None
self.__background = None
self.__screen = None
self.__type = None
self.__key_modified = dict()
def get_normal_tab(self):
"""
The method to get the normal_tab
Returns:
TabTheme: An instance of TabTheme
"""
return self.__normal_tab
def set_normal_tab(self, normal_tab):
"""
The method to set the value to normal_tab
Parameters:
normal_tab (TabTheme) : An instance of TabTheme
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.tab_theme import TabTheme
except Exception:
from .tab_theme import TabTheme
if normal_tab is not None and not isinstance(normal_tab, TabTheme):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: normal_tab EXPECTED TYPE: TabTheme', None, None)
self.__normal_tab = normal_tab
self.__key_modified['normal_tab'] = 1
def get_selected_tab(self):
"""
The method to get the selected_tab
Returns:
TabTheme: An instance of TabTheme
"""
return self.__selected_tab
def set_selected_tab(self, selected_tab):
"""
The method to set the value to selected_tab
Parameters:
selected_tab (TabTheme) : An instance of TabTheme
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.tab_theme import TabTheme
except Exception:
from .tab_theme import TabTheme
if selected_tab is not None and not isinstance(selected_tab, TabTheme):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: selected_tab EXPECTED TYPE: TabTheme', None, None)
self.__selected_tab = selected_tab
self.__key_modified['selected_tab'] = 1
def get_new_background(self):
"""
The method to get the new_background
Returns:
string: A string representing the new_background
"""
return self.__new_background
def set_new_background(self, new_background):
"""
The method to set the value to new_background
Parameters:
new_background (string) : A string representing the new_background
"""
if new_background is not None and not isinstance(new_background, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: new_background EXPECTED TYPE: str', None, None)
self.__new_background = new_background
self.__key_modified['new_background'] = 1
def get_background(self):
"""
The method to get the background
Returns:
string: A string representing the background
"""
return self.__background
def set_background(self, background):
"""
The method to set the value to background
Parameters:
background (string) : A string representing the background
"""
if background is not None and not isinstance(background, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: background EXPECTED TYPE: str', None, None)
self.__background = background
self.__key_modified['background'] = 1
def get_screen(self):
"""
The method to get the screen
Returns:
string: A string representing the screen
"""
return self.__screen
def set_screen(self, screen):
"""
The method to set the value to screen
Parameters:
screen (string) : A string representing the screen
"""
if screen is not None and not isinstance(screen, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: screen EXPECTED TYPE: str', None, None)
self.__screen = screen
self.__key_modified['screen'] = 1
def get_type(self):
"""
The method to get the type
Returns:
string: A string representing the type
"""
return self.__type
def set_type(self, type):
"""
The method to set the value to type
Parameters:
type (string) : A string representing the type
"""
if type is not None and not isinstance(type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: str', None, None)
self.__type = type
self.__key_modified['type'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/theme.py | theme.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.parameter_map import ParameterMap
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
from zcrmsdk.src.com.zoho.crm.api.param import Param
from zcrmsdk.src.com.zoho.crm.api.header import Header
from zcrmsdk.src.com.zoho.crm.api.header_map import HeaderMap
except Exception:
from ..exception import SDKException
from ..parameter_map import ParameterMap
from ..util import APIResponse, CommonAPIHandler, Constants
from ..param import Param
from ..header import Header
from ..header_map import HeaderMap
class UsersOperations(object):
def __init__(self):
"""Creates an instance of UsersOperations"""
pass
def get_users(self, param_instance=None, header_instance=None):
"""
The method to get users
Parameters:
param_instance (ParameterMap) : An instance of ParameterMap
header_instance (HeaderMap) : An instance of HeaderMap
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)
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/users'
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)
try:
from zcrmsdk.src.com.zoho.crm.api.users.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def create_user(self, request):
"""
The method to create user
Parameters:
request (RequestWrapper) : An instance of RequestWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.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/v2/users'
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.users.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def update_users(self, request):
"""
The method to update users
Parameters:
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.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/users'
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.users.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def get_user(self, id, header_instance=None):
"""
The method to get user
Parameters:
id (int) : An int representing the id
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 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/users/'
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_header(header_instance)
try:
from zcrmsdk.src.com.zoho.crm.api.users.response_handler import ResponseHandler
except Exception:
from .response_handler import ResponseHandler
return handler_instance.api_call(ResponseHandler.__module__, 'application/json')
def update_user(self, id, request):
"""
The method to update user
Parameters:
id (int) : An int representing the id
request (BodyWrapper) : An instance of BodyWrapper
Returns:
APIResponse: An instance of APIResponse
Raises:
SDKException
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.body_wrapper import BodyWrapper
except Exception:
from .body_wrapper import BodyWrapper
if not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: 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/users/'
api_path = api_path + str(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)
try:
from zcrmsdk.src.com.zoho.crm.api.users.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
def delete_user(self, id):
"""
The method to delete user
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/users/'
api_path = api_path + str(id)
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.users.action_handler import ActionHandler
except Exception:
from .action_handler import ActionHandler
return handler_instance.api_call(ActionHandler.__module__, 'application/json')
class GetUsersParam(object):
type = Param('type', 'com.zoho.crm.api.Users.GetUsersParam')
page = Param('page', 'com.zoho.crm.api.Users.GetUsersParam')
per_page = Param('per_page', 'com.zoho.crm.api.Users.GetUsersParam')
class GetUsersHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Users.GetUsersHeader')
class GetUserHeader(object):
if_modified_since = Header('If-Modified-Since', 'com.zoho.crm.api.Users.GetUserHeader') | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/users_operations.py | users_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.record import Record
except Exception:
from ..exception import SDKException
from ..util import Constants
from ..record import Record
class User(Record):
def __init__(self):
"""Creates an instance of User"""
super().__init__()
def get_country(self):
"""
The method to get the country
Returns:
string: A string representing the country
"""
return self.get_key_value('country')
def set_country(self, country):
"""
The method to set the value to country
Parameters:
country (string) : A string representing the country
"""
if country is not None and not isinstance(country, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: country EXPECTED TYPE: str', None, None)
self.add_key_value('country', country)
def get_customize_info(self):
"""
The method to get the customize_info
Returns:
CustomizeInfo: An instance of CustomizeInfo
"""
return self.get_key_value('customize_info')
def set_customize_info(self, customize_info):
"""
The method to set the value to customize_info
Parameters:
customize_info (CustomizeInfo) : An instance of CustomizeInfo
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.customize_info import CustomizeInfo
except Exception:
from .customize_info import CustomizeInfo
if customize_info is not None and not isinstance(customize_info, CustomizeInfo):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: customize_info EXPECTED TYPE: CustomizeInfo', None, None)
self.add_key_value('customize_info', customize_info)
def get_role(self):
"""
The method to get the role
Returns:
Role: An instance of Role
"""
return self.get_key_value('role')
def set_role(self, role):
"""
The method to set the value to role
Parameters:
role (Role) : An instance of Role
"""
try:
from zcrmsdk.src.com.zoho.crm.api.roles import Role
except Exception:
from ..roles import Role
if role is not None and not isinstance(role, Role):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: role EXPECTED TYPE: Role', None, None)
self.add_key_value('role', role)
def get_signature(self):
"""
The method to get the signature
Returns:
string: A string representing the signature
"""
return self.get_key_value('signature')
def set_signature(self, signature):
"""
The method to set the value to signature
Parameters:
signature (string) : A string representing the signature
"""
if signature is not None and not isinstance(signature, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: signature EXPECTED TYPE: str', None, None)
self.add_key_value('signature', signature)
def get_city(self):
"""
The method to get the city
Returns:
string: A string representing the city
"""
return self.get_key_value('city')
def set_city(self, city):
"""
The method to set the value to city
Parameters:
city (string) : A string representing the city
"""
if city is not None and not isinstance(city, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: city EXPECTED TYPE: str', None, None)
self.add_key_value('city', city)
def get_name_format(self):
"""
The method to get the name_format
Returns:
string: A string representing the name_format
"""
return self.get_key_value('name_format')
def set_name_format(self, name_format):
"""
The method to set the value to name_format
Parameters:
name_format (string) : A string representing the name_format
"""
if name_format is not None and not isinstance(name_format, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name_format EXPECTED TYPE: str', None, None)
self.add_key_value('name_format', name_format)
def get_personal_account(self):
"""
The method to get the personal_account
Returns:
bool: A bool representing the personal_account
"""
return self.get_key_value('personal_account')
def set_personal_account(self, personal_account):
"""
The method to set the value to personal_account
Parameters:
personal_account (bool) : A bool representing the personal_account
"""
if personal_account is not None and not isinstance(personal_account, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: personal_account EXPECTED TYPE: bool', None, None)
self.add_key_value('personal_account', personal_account)
def get_default_tab_group(self):
"""
The method to get the default_tab_group
Returns:
string: A string representing the default_tab_group
"""
return self.get_key_value('default_tab_group')
def set_default_tab_group(self, default_tab_group):
"""
The method to set the value to default_tab_group
Parameters:
default_tab_group (string) : A string representing the default_tab_group
"""
if default_tab_group is not None and not isinstance(default_tab_group, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: default_tab_group EXPECTED TYPE: str', None, None)
self.add_key_value('default_tab_group', default_tab_group)
def get_language(self):
"""
The method to get the language
Returns:
string: A string representing the language
"""
return self.get_key_value('language')
def set_language(self, language):
"""
The method to set the value to language
Parameters:
language (string) : A string representing the language
"""
if language is not None and not isinstance(language, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: language EXPECTED TYPE: str', None, None)
self.add_key_value('language', language)
def get_locale(self):
"""
The method to get the locale
Returns:
string: A string representing the locale
"""
return self.get_key_value('locale')
def set_locale(self, locale):
"""
The method to set the value to locale
Parameters:
locale (string) : A string representing the locale
"""
if locale is not None and not isinstance(locale, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: locale EXPECTED TYPE: str', None, None)
self.add_key_value('locale', locale)
def get_microsoft(self):
"""
The method to get the microsoft
Returns:
bool: A bool representing the microsoft
"""
return self.get_key_value('microsoft')
def set_microsoft(self, microsoft):
"""
The method to set the value to microsoft
Parameters:
microsoft (bool) : A bool representing the microsoft
"""
if microsoft is not None and not isinstance(microsoft, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: microsoft EXPECTED TYPE: bool', None, None)
self.add_key_value('microsoft', microsoft)
def get_isonline(self):
"""
The method to get the isonline
Returns:
bool: A bool representing the isonline
"""
return self.get_key_value('Isonline')
def set_isonline(self, isonline):
"""
The method to set the value to isonline
Parameters:
isonline (bool) : A bool representing the isonline
"""
if isonline is not None and not isinstance(isonline, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: isonline EXPECTED TYPE: bool', None, None)
self.add_key_value('Isonline', isonline)
def get_street(self):
"""
The method to get the street
Returns:
string: A string representing the street
"""
return self.get_key_value('street')
def set_street(self, street):
"""
The method to set the value to street
Parameters:
street (string) : A string representing the street
"""
if street is not None and not isinstance(street, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: street EXPECTED TYPE: str', None, None)
self.add_key_value('street', street)
def get_currency(self):
"""
The method to get the currency
Returns:
string: A string representing the currency
"""
return self.get_key_value('Currency')
def set_currency(self, currency):
"""
The method to set the value to currency
Parameters:
currency (string) : A string representing the currency
"""
if currency is not None and not isinstance(currency, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: currency EXPECTED TYPE: str', None, None)
self.add_key_value('Currency', currency)
def get_alias(self):
"""
The method to get the alias
Returns:
string: A string representing the alias
"""
return self.get_key_value('alias')
def set_alias(self, alias):
"""
The method to set the value to alias
Parameters:
alias (string) : A string representing the alias
"""
if alias is not None and not isinstance(alias, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: alias EXPECTED TYPE: str', None, None)
self.add_key_value('alias', alias)
def get_theme(self):
"""
The method to get the theme
Returns:
Theme: An instance of Theme
"""
return self.get_key_value('theme')
def set_theme(self, theme):
"""
The method to set the value to theme
Parameters:
theme (Theme) : An instance of Theme
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.theme import Theme
except Exception:
from .theme import Theme
if theme is not None and not isinstance(theme, Theme):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: theme EXPECTED TYPE: Theme', None, None)
self.add_key_value('theme', theme)
def get_state(self):
"""
The method to get the state
Returns:
string: A string representing the state
"""
return self.get_key_value('state')
def set_state(self, state):
"""
The method to set the value to state
Parameters:
state (string) : A string representing the state
"""
if state is not None and not isinstance(state, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: state EXPECTED TYPE: str', None, None)
self.add_key_value('state', state)
def get_fax(self):
"""
The method to get the fax
Returns:
string: A string representing the fax
"""
return self.get_key_value('fax')
def set_fax(self, fax):
"""
The method to set the value to fax
Parameters:
fax (string) : A string representing the fax
"""
if fax is not None and not isinstance(fax, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: fax EXPECTED TYPE: str', None, None)
self.add_key_value('fax', fax)
def get_country_locale(self):
"""
The method to get the country_locale
Returns:
string: A string representing the country_locale
"""
return self.get_key_value('country_locale')
def set_country_locale(self, country_locale):
"""
The method to set the value to country_locale
Parameters:
country_locale (string) : A string representing the country_locale
"""
if country_locale is not None and not isinstance(country_locale, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: country_locale EXPECTED TYPE: str', None, None)
self.add_key_value('country_locale', country_locale)
def get_first_name(self):
"""
The method to get the first_name
Returns:
string: A string representing the first_name
"""
return self.get_key_value('first_name')
def set_first_name(self, first_name):
"""
The method to set the value to first_name
Parameters:
first_name (string) : A string representing the first_name
"""
if first_name is not None and not isinstance(first_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: first_name EXPECTED TYPE: str', None, None)
self.add_key_value('first_name', first_name)
def get_email(self):
"""
The method to get the email
Returns:
string: A string representing the email
"""
return self.get_key_value('email')
def set_email(self, email):
"""
The method to set the value to email
Parameters:
email (string) : A string representing the email
"""
if email is not None and not isinstance(email, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: email EXPECTED TYPE: str', None, None)
self.add_key_value('email', email)
def get_reporting_to(self):
"""
The method to get the reporting_to
Returns:
User: An instance of User
"""
return self.get_key_value('Reporting_To')
def set_reporting_to(self, reporting_to):
"""
The method to set the value to reporting_to
Parameters:
reporting_to (User) : An instance of User
"""
try:
from zcrmsdk.src.com.zoho.crm.api.users.user import User
except Exception:
from .user import User
if reporting_to is not None and not isinstance(reporting_to, User):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: reporting_to EXPECTED TYPE: User', None, None)
self.add_key_value('Reporting_To', reporting_to)
def get_decimal_separator(self):
"""
The method to get the decimal_separator
Returns:
string: A string representing the decimal_separator
"""
return self.get_key_value('decimal_separator')
def set_decimal_separator(self, decimal_separator):
"""
The method to set the value to decimal_separator
Parameters:
decimal_separator (string) : A string representing the decimal_separator
"""
if decimal_separator is not None and not isinstance(decimal_separator, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: decimal_separator EXPECTED TYPE: str', None, None)
self.add_key_value('decimal_separator', decimal_separator)
def get_zip(self):
"""
The method to get the zip
Returns:
string: A string representing the zip
"""
return self.get_key_value('zip')
def set_zip(self, zip):
"""
The method to set the value to zip
Parameters:
zip (string) : A string representing the zip
"""
if zip is not None and not isinstance(zip, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: zip EXPECTED TYPE: str', None, None)
self.add_key_value('zip', zip)
def get_website(self):
"""
The method to get the website
Returns:
string: A string representing the website
"""
return self.get_key_value('website')
def set_website(self, website):
"""
The method to set the value to website
Parameters:
website (string) : A string representing the website
"""
if website is not None and not isinstance(website, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: website EXPECTED TYPE: str', None, None)
self.add_key_value('website', website)
def get_time_format(self):
"""
The method to get the time_format
Returns:
string: A string representing the time_format
"""
return self.get_key_value('time_format')
def set_time_format(self, time_format):
"""
The method to set the value to time_format
Parameters:
time_format (string) : A string representing the time_format
"""
if time_format is not None and not isinstance(time_format, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: time_format EXPECTED TYPE: str', None, None)
self.add_key_value('time_format', time_format)
def get_offset(self):
"""
The method to get the offset
Returns:
int: An int representing the offset
"""
return self.get_key_value('offset')
def set_offset(self, offset):
"""
The method to set the value to offset
Parameters:
offset (int) : An int representing the offset
"""
if offset is not None and not isinstance(offset, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: offset EXPECTED TYPE: int', None, None)
self.add_key_value('offset', offset)
def get_profile(self):
"""
The method to get the profile
Returns:
Profile: An instance of Profile
"""
return self.get_key_value('profile')
def set_profile(self, profile):
"""
The method to set the value to profile
Parameters:
profile (Profile) : An instance of Profile
"""
try:
from zcrmsdk.src.com.zoho.crm.api.profiles import Profile
except Exception:
from ..profiles import Profile
if profile is not None and not isinstance(profile, Profile):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: profile EXPECTED TYPE: Profile', None, None)
self.add_key_value('profile', profile)
def get_mobile(self):
"""
The method to get the mobile
Returns:
string: A string representing the mobile
"""
return self.get_key_value('mobile')
def set_mobile(self, mobile):
"""
The method to set the value to mobile
Parameters:
mobile (string) : A string representing the mobile
"""
if mobile is not None and not isinstance(mobile, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: mobile EXPECTED TYPE: str', None, None)
self.add_key_value('mobile', mobile)
def get_last_name(self):
"""
The method to get the last_name
Returns:
string: A string representing the last_name
"""
return self.get_key_value('last_name')
def set_last_name(self, last_name):
"""
The method to set the value to last_name
Parameters:
last_name (string) : A string representing the last_name
"""
if last_name is not None and not isinstance(last_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: last_name EXPECTED TYPE: str', None, None)
self.add_key_value('last_name', last_name)
def get_time_zone(self):
"""
The method to get the time_zone
Returns:
string: A string representing the time_zone
"""
return self.get_key_value('time_zone')
def set_time_zone(self, time_zone):
"""
The method to set the value to time_zone
Parameters:
time_zone (string) : A string representing the time_zone
"""
if time_zone is not None and not isinstance(time_zone, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: time_zone EXPECTED TYPE: str', None, None)
self.add_key_value('time_zone', time_zone)
def get_zuid(self):
"""
The method to get the zuid
Returns:
string: A string representing the zuid
"""
return self.get_key_value('zuid')
def set_zuid(self, zuid):
"""
The method to set the value to zuid
Parameters:
zuid (string) : A string representing the zuid
"""
if zuid is not None and not isinstance(zuid, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: zuid EXPECTED TYPE: str', None, None)
self.add_key_value('zuid', zuid)
def get_confirm(self):
"""
The method to get the confirm
Returns:
bool: A bool representing the confirm
"""
return self.get_key_value('confirm')
def set_confirm(self, confirm):
"""
The method to set the value to confirm
Parameters:
confirm (bool) : A bool representing the confirm
"""
if confirm is not None and not isinstance(confirm, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: confirm EXPECTED TYPE: bool', None, None)
self.add_key_value('confirm', confirm)
def get_full_name(self):
"""
The method to get the full_name
Returns:
string: A string representing the full_name
"""
return self.get_key_value('full_name')
def set_full_name(self, full_name):
"""
The method to set the value to full_name
Parameters:
full_name (string) : A string representing the full_name
"""
if full_name is not None and not isinstance(full_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: full_name EXPECTED TYPE: str', None, None)
self.add_key_value('full_name', full_name)
def get_territories(self):
"""
The method to get the territories
Returns:
list: An instance of list
"""
return self.get_key_value('territories')
def set_territories(self, territories):
"""
The method to set the value to territories
Parameters:
territories (list) : An instance of list
"""
if territories is not None and not isinstance(territories, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: territories EXPECTED TYPE: list', None, None)
self.add_key_value('territories', territories)
def get_phone(self):
"""
The method to get the phone
Returns:
string: A string representing the phone
"""
return self.get_key_value('phone')
def set_phone(self, phone):
"""
The method to set the value to phone
Parameters:
phone (string) : A string representing the phone
"""
if phone is not None and not isinstance(phone, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: phone EXPECTED TYPE: str', None, None)
self.add_key_value('phone', phone)
def get_dob(self):
"""
The method to get the dob
Returns:
string: A string representing the dob
"""
return self.get_key_value('dob')
def set_dob(self, dob):
"""
The method to set the value to dob
Parameters:
dob (string) : A string representing the dob
"""
if dob is not None and not isinstance(dob, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: dob EXPECTED TYPE: str', None, None)
self.add_key_value('dob', dob)
def get_date_format(self):
"""
The method to get the date_format
Returns:
string: A string representing the date_format
"""
return self.get_key_value('date_format')
def set_date_format(self, date_format):
"""
The method to set the value to date_format
Parameters:
date_format (string) : A string representing the date_format
"""
if date_format is not None and not isinstance(date_format, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: date_format EXPECTED TYPE: str', None, None)
self.add_key_value('date_format', date_format)
def get_status(self):
"""
The method to get the status
Returns:
string: A string representing the status
"""
return self.get_key_value('status')
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (string) : A string representing the status
"""
if status is not None and not isinstance(status, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: str', None, None)
self.add_key_value('status', status)
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.get_key_value('name')
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.add_key_value('name', name) | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/user.py | user.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Shift(object):
def __init__(self):
"""Creates an instance of Shift"""
self.__id = None
self.__name = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/shift.py | shift.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.users.action_response import ActionResponse
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .action_response import ActionResponse
class SuccessResponse(ActionResponse):
def __init__(self):
"""Creates an instance of SuccessResponse"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/success_response.py | success_response.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class TabTheme(object):
def __init__(self):
"""Creates an instance of TabTheme"""
self.__font_color = None
self.__background = None
self.__key_modified = dict()
def get_font_color(self):
"""
The method to get the font_color
Returns:
string: A string representing the font_color
"""
return self.__font_color
def set_font_color(self, font_color):
"""
The method to set the value to font_color
Parameters:
font_color (string) : A string representing the font_color
"""
if font_color is not None and not isinstance(font_color, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: font_color EXPECTED TYPE: str', None, None)
self.__font_color = font_color
self.__key_modified['font_color'] = 1
def get_background(self):
"""
The method to get the background
Returns:
string: A string representing the background
"""
return self.__background
def set_background(self, background):
"""
The method to set the value to background
Parameters:
background (string) : A string representing the background
"""
if background is not None and not isinstance(background, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: background EXPECTED TYPE: str', None, None)
self.__background = background
self.__key_modified['background'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/tab_theme.py | tab_theme.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class CustomizeInfo(object):
def __init__(self):
"""Creates an instance of CustomizeInfo"""
self.__notes_desc = None
self.__show_right_panel = None
self.__bc_view = None
self.__show_home = None
self.__show_detail_view = None
self.__unpin_recent_item = None
self.__key_modified = dict()
def get_notes_desc(self):
"""
The method to get the notes_desc
Returns:
bool: A bool representing the notes_desc
"""
return self.__notes_desc
def set_notes_desc(self, notes_desc):
"""
The method to set the value to notes_desc
Parameters:
notes_desc (bool) : A bool representing the notes_desc
"""
if notes_desc is not None and not isinstance(notes_desc, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: notes_desc EXPECTED TYPE: bool', None, None)
self.__notes_desc = notes_desc
self.__key_modified['notes_desc'] = 1
def get_show_right_panel(self):
"""
The method to get the show_right_panel
Returns:
string: A string representing the show_right_panel
"""
return self.__show_right_panel
def set_show_right_panel(self, show_right_panel):
"""
The method to set the value to show_right_panel
Parameters:
show_right_panel (string) : A string representing the show_right_panel
"""
if show_right_panel is not None and not isinstance(show_right_panel, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: show_right_panel EXPECTED TYPE: str', None, None)
self.__show_right_panel = show_right_panel
self.__key_modified['show_right_panel'] = 1
def get_bc_view(self):
"""
The method to get the bc_view
Returns:
string: A string representing the bc_view
"""
return self.__bc_view
def set_bc_view(self, bc_view):
"""
The method to set the value to bc_view
Parameters:
bc_view (string) : A string representing the bc_view
"""
if bc_view is not None and not isinstance(bc_view, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: bc_view EXPECTED TYPE: str', None, None)
self.__bc_view = bc_view
self.__key_modified['bc_view'] = 1
def get_show_home(self):
"""
The method to get the show_home
Returns:
bool: A bool representing the show_home
"""
return self.__show_home
def set_show_home(self, show_home):
"""
The method to set the value to show_home
Parameters:
show_home (bool) : A bool representing the show_home
"""
if show_home is not None and not isinstance(show_home, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: show_home EXPECTED TYPE: bool', None, None)
self.__show_home = show_home
self.__key_modified['show_home'] = 1
def get_show_detail_view(self):
"""
The method to get the show_detail_view
Returns:
bool: A bool representing the show_detail_view
"""
return self.__show_detail_view
def set_show_detail_view(self, show_detail_view):
"""
The method to set the value to show_detail_view
Parameters:
show_detail_view (bool) : A bool representing the show_detail_view
"""
if show_detail_view is not None and not isinstance(show_detail_view, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: show_detail_view EXPECTED TYPE: bool', None, None)
self.__show_detail_view = show_detail_view
self.__key_modified['show_detail_view'] = 1
def get_unpin_recent_item(self):
"""
The method to get the unpin_recent_item
Returns:
string: A string representing the unpin_recent_item
"""
return self.__unpin_recent_item
def set_unpin_recent_item(self, unpin_recent_item):
"""
The method to set the value to unpin_recent_item
Parameters:
unpin_recent_item (string) : A string representing the unpin_recent_item
"""
if unpin_recent_item is not None and not isinstance(unpin_recent_item, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: unpin_recent_item EXPECTED TYPE: str', None, None)
self.__unpin_recent_item = unpin_recent_item
self.__key_modified['unpin_recent_item'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/users/customize_info.py | customize_info.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
from zcrmsdk.src.com.zoho.crm.api.custom_views.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Constants
from .response_handler import ResponseHandler
class ResponseWrapper(ResponseHandler):
def __init__(self):
"""Creates an instance of ResponseWrapper"""
super().__init__()
self.__custom_views = None
self.__info = None
self.__key_modified = dict()
def get_custom_views(self):
"""
The method to get the custom_views
Returns:
list: An instance of list
"""
return self.__custom_views
def set_custom_views(self, custom_views):
"""
The method to set the value to custom_views
Parameters:
custom_views (list) : An instance of list
"""
if custom_views is not None and not isinstance(custom_views, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: custom_views EXPECTED TYPE: list', None, None)
self.__custom_views = custom_views
self.__key_modified['custom_views'] = 1
def get_info(self):
"""
The method to get the info
Returns:
Info: An instance of Info
"""
return self.__info
def set_info(self, info):
"""
The method to set the value to info
Parameters:
info (Info) : An instance of Info
"""
try:
from zcrmsdk.src.com.zoho.crm.api.custom_views.info import Info
except Exception:
from .info import Info
if info is not None and not isinstance(info, Info):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: info EXPECTED TYPE: Info', None, None)
self.__info = info
self.__key_modified['info'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/custom_views/response_wrapper.py | response_wrapper.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.parameter_map import ParameterMap
from zcrmsdk.src.com.zoho.crm.api.util import APIResponse, CommonAPIHandler, Constants
from zcrmsdk.src.com.zoho.crm.api.param import Param
except Exception:
from ..exception import SDKException
from ..parameter_map import ParameterMap
from ..util import APIResponse, CommonAPIHandler, Constants
from ..param import Param
class CustomViewsOperations(object):
def __init__(self, module=None):
"""
Creates an instance of CustomViewsOperations with the given parameters
Parameters:
module (string) : A string representing the module
"""
if module is not None and not isinstance(module, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: module EXPECTED TYPE: str', None, None)
self.__module = module
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/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')
def get_custom_view(self, id):
"""
The method to get custom view
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/settings/custom_views/'
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.CustomViews.GetCustomViewParam'), self.__module)
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')
class GetCustomViewsParam(object):
page = Param('page', 'com.zoho.crm.api.CustomViews.GetCustomViewsParam')
per_page = Param('per_page', 'com.zoho.crm.api.CustomViews.GetCustomViewsParam')
class GetCustomViewParam(object):
pass | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/custom_views/custom_views_operations.py | custom_views_operations.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class CustomView(object):
def __init__(self):
"""Creates an instance of CustomView"""
self.__id = None
self.__name = None
self.__system_name = None
self.__display_value = None
self.__shared_type = None
self.__category = None
self.__sort_by = None
self.__sort_order = None
self.__favorite = None
self.__offline = None
self.__default = None
self.__system_defined = None
self.__criteria = None
self.__shared_details = None
self.__fields = None
self.__key_modified = dict()
def get_id(self):
"""
The method to get the id
Returns:
int: An int representing the id
"""
return self.__id
def set_id(self, id):
"""
The method to set the value to id
Parameters:
id (int) : An int representing the id
"""
if id is not None and not isinstance(id, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)
self.__id = id
self.__key_modified['id'] = 1
def get_name(self):
"""
The method to get the name
Returns:
string: A string representing the name
"""
return self.__name
def set_name(self, name):
"""
The method to set the value to name
Parameters:
name (string) : A string representing the name
"""
if name is not None and not isinstance(name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: str', None, None)
self.__name = name
self.__key_modified['name'] = 1
def get_system_name(self):
"""
The method to get the system_name
Returns:
string: A string representing the system_name
"""
return self.__system_name
def set_system_name(self, system_name):
"""
The method to set the value to system_name
Parameters:
system_name (string) : A string representing the system_name
"""
if system_name is not None and not isinstance(system_name, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: system_name EXPECTED TYPE: str', None, None)
self.__system_name = system_name
self.__key_modified['system_name'] = 1
def get_display_value(self):
"""
The method to get the display_value
Returns:
string: A string representing the display_value
"""
return self.__display_value
def set_display_value(self, display_value):
"""
The method to set the value to display_value
Parameters:
display_value (string) : A string representing the display_value
"""
if display_value is not None and not isinstance(display_value, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: display_value EXPECTED TYPE: str', None, None)
self.__display_value = display_value
self.__key_modified['display_value'] = 1
def get_shared_type(self):
"""
The method to get the shared_type
Returns:
string: A string representing the shared_type
"""
return self.__shared_type
def set_shared_type(self, shared_type):
"""
The method to set the value to shared_type
Parameters:
shared_type (string) : A string representing the shared_type
"""
if shared_type is not None and not isinstance(shared_type, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: shared_type EXPECTED TYPE: str', None, None)
self.__shared_type = shared_type
self.__key_modified['shared_type'] = 1
def get_category(self):
"""
The method to get the category
Returns:
string: A string representing the category
"""
return self.__category
def set_category(self, category):
"""
The method to set the value to category
Parameters:
category (string) : A string representing the category
"""
if category is not None and not isinstance(category, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: category EXPECTED TYPE: str', None, None)
self.__category = category
self.__key_modified['category'] = 1
def get_sort_by(self):
"""
The method to get the sort_by
Returns:
string: A string representing the sort_by
"""
return self.__sort_by
def set_sort_by(self, sort_by):
"""
The method to set the value to sort_by
Parameters:
sort_by (string) : A string representing the sort_by
"""
if sort_by is not None and not isinstance(sort_by, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_by EXPECTED TYPE: str', None, None)
self.__sort_by = sort_by
self.__key_modified['sort_by'] = 1
def get_sort_order(self):
"""
The method to get the sort_order
Returns:
string: A string representing the sort_order
"""
return self.__sort_order
def set_sort_order(self, sort_order):
"""
The method to set the value to sort_order
Parameters:
sort_order (string) : A string representing the sort_order
"""
if sort_order is not None and not isinstance(sort_order, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: sort_order EXPECTED TYPE: str', None, None)
self.__sort_order = sort_order
self.__key_modified['sort_order'] = 1
def get_favorite(self):
"""
The method to get the favorite
Returns:
int: An int representing the favorite
"""
return self.__favorite
def set_favorite(self, favorite):
"""
The method to set the value to favorite
Parameters:
favorite (int) : An int representing the favorite
"""
if favorite is not None and not isinstance(favorite, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: favorite EXPECTED TYPE: int', None, None)
self.__favorite = favorite
self.__key_modified['favorite'] = 1
def get_offline(self):
"""
The method to get the offline
Returns:
bool: A bool representing the offline
"""
return self.__offline
def set_offline(self, offline):
"""
The method to set the value to offline
Parameters:
offline (bool) : A bool representing the offline
"""
if offline is not None and not isinstance(offline, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: offline EXPECTED TYPE: bool', None, None)
self.__offline = offline
self.__key_modified['offline'] = 1
def get_default(self):
"""
The method to get the default
Returns:
bool: A bool representing the default
"""
return self.__default
def set_default(self, default):
"""
The method to set the value to default
Parameters:
default (bool) : A bool representing the default
"""
if default is not None and not isinstance(default, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: default EXPECTED TYPE: bool', None, None)
self.__default = default
self.__key_modified['default'] = 1
def get_system_defined(self):
"""
The method to get the system_defined
Returns:
bool: A bool representing the system_defined
"""
return self.__system_defined
def set_system_defined(self, system_defined):
"""
The method to set the value to system_defined
Parameters:
system_defined (bool) : A bool representing the system_defined
"""
if system_defined is not None and not isinstance(system_defined, bool):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: system_defined EXPECTED TYPE: bool', None, None)
self.__system_defined = system_defined
self.__key_modified['system_defined'] = 1
def get_criteria(self):
"""
The method to get the criteria
Returns:
Criteria: An instance of Criteria
"""
return self.__criteria
def set_criteria(self, criteria):
"""
The method to set the value to criteria
Parameters:
criteria (Criteria) : An instance of Criteria
"""
try:
from zcrmsdk.src.com.zoho.crm.api.custom_views.criteria import Criteria
except Exception:
from .criteria import Criteria
if criteria is not None and not isinstance(criteria, Criteria):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: criteria EXPECTED TYPE: Criteria', None, None)
self.__criteria = criteria
self.__key_modified['criteria'] = 1
def get_shared_details(self):
"""
The method to get the shared_details
Returns:
list: An instance of list
"""
return self.__shared_details
def set_shared_details(self, shared_details):
"""
The method to set the value to shared_details
Parameters:
shared_details (list) : An instance of list
"""
if shared_details is not None and not isinstance(shared_details, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: shared_details EXPECTED TYPE: list', None, None)
self.__shared_details = shared_details
self.__key_modified['shared_details'] = 1
def get_fields(self):
"""
The method to get the fields
Returns:
list: An instance of list
"""
return self.__fields
def set_fields(self, fields):
"""
The method to set the value to fields
Parameters:
fields (list) : An instance of list
"""
if fields is not None and not isinstance(fields, list):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: fields EXPECTED TYPE: list', None, None)
self.__fields = fields
self.__key_modified['fields'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/custom_views/custom_view.py | custom_view.py |
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Choice, Constants
from zcrmsdk.src.com.zoho.crm.api.custom_views.response_handler import ResponseHandler
except Exception:
from ..exception import SDKException
from ..util import Choice, Constants
from .response_handler import ResponseHandler
class APIException(ResponseHandler):
def __init__(self):
"""Creates an instance of APIException"""
super().__init__()
self.__status = None
self.__code = None
self.__message = None
self.__details = None
self.__key_modified = dict()
def get_status(self):
"""
The method to get the status
Returns:
Choice: An instance of Choice
"""
return self.__status
def set_status(self, status):
"""
The method to set the value to status
Parameters:
status (Choice) : An instance of Choice
"""
if status is not None and not isinstance(status, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Choice', None, None)
self.__status = status
self.__key_modified['status'] = 1
def get_code(self):
"""
The method to get the code
Returns:
Choice: An instance of Choice
"""
return self.__code
def set_code(self, code):
"""
The method to set the value to code
Parameters:
code (Choice) : An instance of Choice
"""
if code is not None and not isinstance(code, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Choice', None, None)
self.__code = code
self.__key_modified['code'] = 1
def get_message(self):
"""
The method to get the message
Returns:
Choice: An instance of Choice
"""
return self.__message
def set_message(self, message):
"""
The method to set the value to message
Parameters:
message (Choice) : An instance of Choice
"""
if message is not None and not isinstance(message, Choice):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Choice', None, None)
self.__message = message
self.__key_modified['message'] = 1
def get_details(self):
"""
The method to get the details
Returns:
dict: An instance of dict
"""
return self.__details
def set_details(self, details):
"""
The method to set the value to details
Parameters:
details (dict) : An instance of dict
"""
if details is not None and not isinstance(details, dict):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: dict', None, None)
self.__details = details
self.__key_modified['details'] = 1
def is_key_modified(self, key):
"""
The method to check if the user has modified the given key
Parameters:
key (string) : A string representing the key
Returns:
int: An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if key in self.__key_modified:
return self.__key_modified.get(key)
return None
def set_key_modified(self, key, modification):
"""
The method to mark the given key as modified
Parameters:
key (string) : A string representing the key
modification (int) : An int representing the modification
"""
if key is not None and not isinstance(key, str):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: str', None, None)
if modification is not None and not isinstance(modification, int):
raise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: int', None, None)
self.__key_modified[key] = modification | zohocrmsdk2-0 | /zohocrmsdk2_0-5.1.0.tar.gz/zohocrmsdk2_0-5.1.0/zcrmsdk/src/com/zoho/crm/api/custom_views/api_exception.py | api_exception.py |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.