-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from zoho/beta
2.0.0
- Loading branch information
Showing
1,701 changed files
with
201,476 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from zohocrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken | ||
from zohocrmsdk.src.com.zoho.crm.api.dc.us_data_center import USDataCenter | ||
from zohocrmsdk.src.com.zoho.crm.api.initializer import Initializer | ||
from zohocrmsdk.src.com.zoho.crm.api.apis.apis_operations import APIsOperations | ||
from zohocrmsdk.src.com.zoho.crm.api.apis.response_handler import ResponseHandler | ||
from zohocrmsdk.src.com.zoho.crm.api.apis.api_exception import APIException | ||
from zohocrmsdk.src.com.zoho.crm.api.util.api_response import APIResponse | ||
|
||
|
||
class GetSupportedAPI: | ||
|
||
@staticmethod | ||
def initialize(): | ||
environment = USDataCenter.PRODUCTION() | ||
token = OAuthToken(client_id='Client_Id', client_secret='Client_Secret', refresh_token='Refresh_Token') | ||
Initializer.initialize(environment, token) | ||
|
||
@staticmethod | ||
def get_supported_api(): | ||
filters = None | ||
apis_operations = APIsOperations(filters) | ||
response = apis_operations.get_supported_api() | ||
|
||
if response is not None: | ||
print("Status Code: " + str(response.get_status_code())) | ||
|
||
if response.get_status_code() == 204: | ||
print("No Content") | ||
return | ||
|
||
response_handler = response.get_object() | ||
|
||
if isinstance(response_handler, ResponseHandler): | ||
response_wrapper = response_handler | ||
|
||
if hasattr(response_wrapper, 'get_apis'): | ||
apis = response_wrapper.get_apis() | ||
|
||
if apis is not None: | ||
for api in apis: | ||
print("API Path: " + api.get_path()) | ||
operation_types = api.get_operation_types() | ||
|
||
for operation_type in operation_types: | ||
print("API Operation Method: " + operation_type.get_method()) | ||
print("API Operation OAuthScope: " + operation_type.get_oauth_scope()) | ||
print("API Operation MaxCredits: " + str(operation_type.get_max_credits())) | ||
print("API Operation MinCredits: " + str(operation_type.get_min_credits())) | ||
elif isinstance(response_handler, APIException): | ||
exception = response_handler | ||
print("Status: " + exception.get_status().get_value()) | ||
print("Code: " + exception.get_code().get_value()) | ||
print("Details: ") | ||
|
||
for key, value in exception.get_details().items(): | ||
print(key + ": " + str(value)) | ||
|
||
print("Message: " + exception.get_message()) | ||
|
||
|
||
|
||
GetSupportedAPI.initialize() | ||
GetSupportedAPI.get_supported_api() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .GetSupportedAPI import GetSupportedAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import json | ||
from datetime import datetime | ||
from zohocrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken | ||
from zohocrmsdk.src.com.zoho.crm.api.dc.us_data_center import USDataCenter | ||
from zohocrmsdk.src.com.zoho.crm.api.initializer import Initializer | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.audit_log_export_operations import AuditLogExportOperations | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.body_wrapper import BodyWrapper | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.criteria import Criteria | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.field import Field as AuditField | ||
from zohocrmsdk.src.com.zoho.crm.api.util.api_response import APIResponse | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.action_handler import ActionHandler | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.action_wrapper import ActionWrapper | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.success_response import SuccessResponse | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.api_exception import APIException | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export import AuditLogExport | ||
from zohocrmsdk.src.com.zoho.crm.api.dc import INDataCenter | ||
|
||
|
||
class CreateAuditlogExport: | ||
|
||
@staticmethod | ||
def initialize(): | ||
environment = USDataCenter.PRODUCTION() | ||
token = OAuthToken(client_id='Client_Id', client_secret='Client_Secret', refresh_token='Refresh_Token') | ||
Initializer.initialize(environment, token) | ||
|
||
@staticmethod | ||
def create_auditlog_export(): | ||
audit_log_export_operations = AuditLogExportOperations() | ||
request = BodyWrapper() | ||
audit_log_export = [] | ||
|
||
audit_log_export1 = AuditLogExport() | ||
criteria = Criteria() | ||
criteria.set_comparator("between") | ||
|
||
field = AuditField() | ||
field.set_api_name("audited_time") | ||
criteria.set_field(field) | ||
|
||
values = [ | ||
datetime(2024, 1, 2, 10, 0, 0, 0), | ||
datetime(2024, 1, 3, 10, 0, 0, 0) | ||
] | ||
criteria.set_value(values) | ||
|
||
audit_log_export1.set_criteria(criteria) | ||
audit_log_export.append(audit_log_export1) | ||
request.set_audit_log_export(audit_log_export) | ||
|
||
response = audit_log_export_operations.create_auditlog_export(request) | ||
|
||
if response is not None: | ||
print("Status Code: " + str(response.get_status_code())) | ||
|
||
action_handler = response.get_object() | ||
|
||
if isinstance(action_handler, ActionWrapper): | ||
action_wrapper = action_handler | ||
action_responses = action_wrapper.get_audit_log_export() | ||
|
||
for action_response in action_responses: | ||
if isinstance(action_response, SuccessResponse): | ||
success_response = action_response | ||
print("Status: " + success_response.get_status().get_value()) | ||
print("Code: " + success_response.get_code().get_value()) | ||
print("Details: ") | ||
for key, value in success_response.get_details().items(): | ||
print(f"{key}: {value}") | ||
print("Message: " + success_response.get_message()) | ||
elif isinstance(action_response, APIException): | ||
exception = action_response | ||
print("Status: " + exception.get_status().get_value()) | ||
print("Code: " + exception.get_code().get_value()) | ||
print("Details: ") | ||
for key, value in exception.get_details().items(): | ||
print(f"{key}: {value}") | ||
print("Message: " + exception.get_message()) | ||
elif isinstance(action_handler, APIException): | ||
exception = action_handler | ||
print("Status: " + exception.get_status().get_value()) | ||
print("Code: " + exception.get_code().get_value()) | ||
print("Details: ") | ||
for key, value in exception.get_details().items(): | ||
print(f"{key}: {value}") | ||
print("Message: " + exception.get_message()) | ||
else: | ||
response_object = response.get_model() | ||
response_dict = response_object.__dict__ | ||
|
||
for key, value in response_dict.items(): | ||
print(f"{key}: {value}") | ||
|
||
|
||
|
||
|
||
CreateAuditlogExport.initialize() | ||
CreateAuditlogExport.create_auditlog_export() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import os | ||
from zohocrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken | ||
from zohocrmsdk.src.com.zoho.crm.api.dc.us_data_center import USDataCenter | ||
from zohocrmsdk.src.com.zoho.crm.api.initializer import Initializer | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.api_exception import APIException | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.audit_log_export_operations import AuditLogExportOperations | ||
from zohocrmsdk.src.com.zoho.crm.api.util.api_response import APIResponse | ||
|
||
|
||
class GetExportedAuditLog: | ||
|
||
|
||
@staticmethod | ||
def initialize(): | ||
environment = USDataCenter.PRODUCTION() | ||
token = OAuthToken(client_id='Client_Id', client_secret='Client_Secret', refresh_token='Refresh_Token') | ||
Initializer.initialize(environment, token) | ||
|
||
@staticmethod | ||
def get_exported_auditlog(id1): | ||
audit_log_export_operations = AuditLogExportOperations() | ||
response = audit_log_export_operations.get_exported_auditlog(id1) | ||
|
||
if response is not None: | ||
print("Status Code: " + str(response.get_status_code())) | ||
|
||
if response.get_status_code() == 204: | ||
print("No Content") | ||
return | ||
|
||
response_handler = response.get_object() | ||
|
||
if hasattr(response_handler, 'get_audit_log_export'): | ||
response_wrapper = response_handler | ||
audit_log_export = response_wrapper.get_audit_log_export() | ||
|
||
if audit_log_export is not None: | ||
for audit_log_export1 in audit_log_export: | ||
criteria = audit_log_export1.get_criteria() | ||
if criteria is not None: | ||
GetExportedAuditLog.print_criteria(criteria) | ||
print("AuditLogExport Id : " + str(audit_log_export1.get_id())) | ||
print("AuditLogExport Status : " + str(audit_log_export1.get_status())) | ||
created_by = audit_log_export1.get_created_by() | ||
if created_by is not None: | ||
print("AuditLogExport User Id : " + str(created_by.get_id())) | ||
print("AuditLogExport User Name : " + str(created_by.get_name())) | ||
download_links = audit_log_export1.get_download_links() | ||
if download_links != None: | ||
for link in download_links: | ||
print("AuditLogExport DownloadLink : " + link) | ||
print("AuditLogExport JobStartTime : " + str(audit_log_export1.get_job_start_time())) | ||
print("AuditLogExport JobEndTime : " + str(audit_log_export1.get_job_end_time())) | ||
print("AuditLogExport ExpiryDate : " + str(audit_log_export1.get_expiry_date())) | ||
|
||
elif isinstance(response_handler, APIException): | ||
exception = response_handler | ||
print("Status: " + exception.get_status().get_value()) | ||
print("Code: " + exception.get_code().get_value()) | ||
print("Details: ") | ||
for key, value in exception.get_details().items(): | ||
print(key + ": " + str(value)) | ||
print("Message: " + exception.get_message()) | ||
|
||
|
||
@staticmethod | ||
def print_criteria(criteria): | ||
if criteria.get_comparator() is not None: | ||
print("ExportedAuditlogs Criteria Comparator: " + criteria.get_comparator()) | ||
if criteria.get_value() is not None: | ||
print("ExportedAuditlogs Criteria Value: " + str(criteria.get_value())) | ||
if criteria.get_field() is not None: | ||
print("ExportedAuditlogs Criteria field name: " + criteria.get_field().get_api_name()) | ||
criteria_group = criteria.get_group() | ||
if criteria_group is not None: | ||
for criteria1 in criteria_group: | ||
GetExportedAuditLog.print_criteria(criteria1) | ||
if criteria.get_group_operator() is not None: | ||
print("ExportedAuditlogs Criteria Group Operator: " + criteria.get_group_operator()) | ||
|
||
|
||
|
||
|
||
GetExportedAuditLog.initialize() | ||
id = 72722554001 | ||
GetExportedAuditLog.get_exported_auditlog(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import os | ||
from zohocrmsdk.src.com.zoho.api.authenticator.oauth_token import OAuthToken | ||
from zohocrmsdk.src.com.zoho.crm.api.dc.us_data_center import USDataCenter | ||
from zohocrmsdk.src.com.zoho.crm.api.initializer import Initializer | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.api_exception import APIException | ||
from zohocrmsdk.src.com.zoho.crm.api.audit_log_export.audit_log_export_operations import AuditLogExportOperations | ||
from zohocrmsdk.src.com.zoho.crm.api.util.api_response import APIResponse | ||
|
||
|
||
class GetExportedAuditlogs: | ||
|
||
|
||
@staticmethod | ||
def initialize(): | ||
environment = USDataCenter.PRODUCTION() | ||
token = OAuthToken(client_id='Client_Id', client_secret='Client_Secret', refresh_token='Refresh_Token') | ||
Initializer.initialize(environment, token) | ||
|
||
@staticmethod | ||
def get_exported_auditlogs(): | ||
audit_log_export_operations = AuditLogExportOperations() | ||
response = audit_log_export_operations.get_exported_auditlogs() | ||
|
||
if response is not None: | ||
print("Status Code: " + str(response.get_status_code())) | ||
|
||
if response.get_status_code() == 204: | ||
print("No Content") | ||
return | ||
|
||
response_handler = response.get_object() | ||
|
||
if hasattr(response_handler, 'get_audit_log_export'): | ||
response_wrapper = response_handler | ||
audit_log_export = response_wrapper.get_audit_log_export() | ||
|
||
if audit_log_export is not None: | ||
for audit_log_export1 in audit_log_export: | ||
criteria = audit_log_export1.get_criteria() | ||
if criteria is not None: | ||
GetExportedAuditlogs.print_criteria(criteria) | ||
print("AuditLogExport Id : " + str(audit_log_export1.get_id())) | ||
print("AuditLogExport Status : " + str(audit_log_export1.get_status())) | ||
created_by = audit_log_export1.get_created_by() | ||
if created_by is not None: | ||
print("AuditLogExport User Id : " + str(created_by.get_id())) | ||
print("AuditLogExport User Name : " + str(created_by.get_name())) | ||
download_links = audit_log_export1.get_download_links() | ||
if download_links != None: | ||
for link in download_links: | ||
print("AuditLogExport DownloadLink : " + link) | ||
print("AuditLogExport JobStartTime : " + str(audit_log_export1.get_job_start_time())) | ||
print("AuditLogExport JobEndTime : " + str(audit_log_export1.get_job_end_time())) | ||
print("AuditLogExport ExpiryDate : " + str(audit_log_export1.get_expiry_date())) | ||
|
||
elif isinstance(response_handler, APIException): | ||
exception = response_handler | ||
print("Status: " + exception.get_status().get_value()) | ||
print("Code: " + exception.get_code().get_value()) | ||
print("Details: ") | ||
for key, value in exception.get_details().items(): | ||
print(key + ": " + str(value)) | ||
print("Message: " + exception.get_message()) | ||
else: | ||
if response.get_status_code() != 204: | ||
response_object = response.get_model() | ||
response_dict = response_object.__dict__ | ||
|
||
for key, value in response_dict.items(): | ||
print(key + ": " + str(value)) | ||
|
||
|
||
@staticmethod | ||
def print_criteria(criteria): | ||
if criteria.get_comparator() is not None: | ||
print("ExportedAuditlogs Criteria Comparator: " + criteria.get_comparator()) | ||
if criteria.get_value() is not None: | ||
print("ExportedAuditlogs Criteria Value: " + str(criteria.get_value())) | ||
if criteria.get_field() is not None: | ||
print("ExportedAuditlogs Criteria field name: " + criteria.get_field().get_api_name()) | ||
criteria_group = criteria.get_group() | ||
if criteria_group is not None: | ||
for criteria1 in criteria_group: | ||
GetExportedAuditlogs.print_criteria(criteria1) | ||
if criteria.get_group_operator() is not None: | ||
print("ExportedAuditlogs Criteria Group Operator: " + criteria.get_group_operator()) | ||
|
||
|
||
GetExportedAuditlogs.initialize() | ||
GetExportedAuditlogs.get_exported_auditlogs() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .GetExportedAuditlogs import GetExportedAuditlogs | ||
from .CreateAuditlogExport import CreateAuditlogExport | ||
from .GetExportedAuditlog import GetExportedAuditLog |
Oops, something went wrong.