Skip to content

Commit

Permalink
Merge pull request #4 from zoho/beta
Browse files Browse the repository at this point in the history
3.0.0
  • Loading branch information
raja-7453 authored Dec 3, 2024
2 parents 75bef14 + de7eef4 commit cf17ccd
Show file tree
Hide file tree
Showing 1,570 changed files with 173,009 additions and 15 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ License

## Latest Version

- [3.0.0](/versions/3.0.0/README.md)

- Handle "text/plain" content type as file download.

- [2.0.0](/versions/2.0.0/README.md)

- Handled Error Structure in MassDeleteTags API.
Expand Down Expand Up @@ -63,15 +67,15 @@ You can include the SDK to your project using:
- Package Manager

```sh
Install-Package ZOHOCRMSDK-7.0 -Version 2.0.0
Install-Package ZOHOCRMSDK-7.0 -Version 3.0.0
Install-Package MySql.Data -Version 6.9.12
Install-Package Newtonsoft.Json -Version 13.0.1
```

- .NET CLI

```sh
dotnet add package ZOHOCRMSDK-7.0 --version 2.0.0
dotnet add package ZOHOCRMSDK-7.0 --version 3.0.0
dotnet add package Newtonsoft.Json --version 13.0.1
dotnet add package MySql.Data --version 6.9.12
```
Expand All @@ -82,7 +86,7 @@ You can include the SDK to your project using:

```sh
<ItemGroup>
<PackageReference Include="ZOHOCRMSDK-7.0" Version="2.0.0" />
<PackageReference Include="ZOHOCRMSDK-7.0" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="MySql.Data" Version="6.9.12" />
</ItemGroup>
Expand All @@ -102,4 +106,4 @@ For example, if you generate the tokens for your Sandbox environment in the CN d

---

For more details, kindly refer [here](/versions/2.0.0/ZohoCRM/README.md).
For more details, kindly refer [here](/versions/3.0.0/ZohoCRM/README.md).
3 changes: 1 addition & 2 deletions ZohoCRM/Com/Zoho/Crm/API/Util/CommonAPIHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,12 @@ public Converter GetConverterClassInstance(string encodeType)
case "application/json":
case "application/ld+json":
return new JSONConverter(this);
case "text/plain":
return new TextConverter(this);
case "application/xml":
case "text/xml":
return new XMLConverter(this);
case "multipart/form-data":
return new FormDataConverter(this);
case "text/plain":
case "image/png":
case "image/jpeg":
case "image/gif":
Expand Down
2 changes: 1 addition & 1 deletion ZohoCRM/Com/Zoho/Crm/API/Util/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static class Constants
public static readonly string LOG_FILE_NAME = "sdk_logs.log";
public static readonly string TOKEN_FILE = "sdk_tokens.txt";
public static readonly string ZOHO_SDK = "X-ZOHO-SDK";
public static readonly string SDK_VERSION = "2.0.0";
public static readonly string SDK_VERSION = "3.0.0";
public static readonly string MODULEPACKAGENAME = "modulePackageName";
public static readonly string MODULEDETAILS = "moduleDetails";
public static readonly string DATATYPECONVERTER = "Com.Zoho.Crm.API.Util.DataTypeConverter`1[[$type]], ZOHOCRMSDK-7.0";
Expand Down
2 changes: 1 addition & 1 deletion ZohoCRM/Com/Zoho/Crm/API/Util/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Utility
private static Dictionary<string, string> apiTypeVsDataType = new Dictionary<string, string>();
private static Dictionary<string, string> apiTypeVsStructureName = new Dictionary<string, string>();
private static bool newFile = false;
private static bool getModifiedModules = false;
private static bool getModifiedModules = false;
private static bool forceRefresh = false;
private static string moduleAPIName;
private static JObject apiSupportedModule = new JObject();
Expand Down
6 changes: 3 additions & 3 deletions ZohoCRM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ You can include the SDK to your project using:
- Package Manager

```sh
Install-Package ZOHOCRMSDK-7.0 -Version 2.0.0
Install-Package ZOHOCRMSDK-7.0 -Version 3.0.0
Install-Package MySql.Data -Version 6.9.12
Install-Package Newtonsoft.Json -Version 13.0.1
```

- .NET CLI

```sh
dotnet add package ZOHOCRMSDK-7.0 --version 2.0.0
dotnet add package ZOHOCRMSDK-7.0 --version 3.0.0
dotnet add package Newtonsoft.Json --version 13.0.1
dotnet add package MySql.Data --version 6.9.12
```
Expand All @@ -93,7 +93,7 @@ You can include the SDK to your project using:

```sh
<ItemGroup>
<PackageReference Include="ZOHOCRMSDK-7.0" Version="2.0.0" />
<PackageReference Include="ZOHOCRMSDK-7.0" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="MySql.Data" Version="6.9.12" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion ZohoCRM/ZOHOCRMSDK-7.0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<IsPackable>true</IsPackable>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageId>ZOHOCRMSDK-7.0</PackageId>
<PackageVersion>2.0.0</PackageVersion>
<PackageVersion>3.0.0</PackageVersion>
<Authors>Zoho CRM API Team</Authors>
<Owners>Zoho CRM API Team</Owners>
<Description>Provides C# SDK support for Zoho CRM APIs.</Description>
Expand Down
6 changes: 3 additions & 3 deletions ZohoCRM/readme.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
————————————————————————
Zoho CRM C# SDK 2.0.0
Zoho CRM C# SDK 3.0.0
————————————————————————

This is the readme file for Zoho CRM’s C# SDK version 2.0.0.
This is the readme file for Zoho CRM’s C# SDK version 3.0.0.

This file gives a brief of the enhancements and/or bug fixes in the latest version.

----------------
Enhancements
----------------
- Handled Error Structure in MassDeleteTags API.
- Handle "text/plain" content type as file download

You can also take a look at our GitHub page here (https://github.com/zoho/zohocrm-csharp-sdk-7.0/blob/master/README.md)
99 changes: 99 additions & 0 deletions versions/3.0.0/Samples/APIS/GetSupportedAPI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
using System;
using System.Reflection;
using System.Collections.Generic;
using Com.Zoho.API.Authenticator;
using Initializer = Com.Zoho.Crm.API.Initializer;
using Environment = Com.Zoho.Crm.API.Dc.DataCenter.Environment;
using Com.Zoho.Crm.API.Util;
using Com.Zoho.Crm.API.Dc;
using Newtonsoft.Json;
using Com.Zoho.Crm.API.APIs;

namespace Samples.APIS
{
public class GetSupportedAPI
{
public static void GetSupportedAPI_1()
{
String filters = null;
APIsOperations apisOperations = new APIsOperations(filters);
APIResponse<ResponseHandler> response = apisOperations.GetSupportedAPI();
if (response != null)
{
Console.WriteLine("Status Code: " + response.StatusCode);
if (new List<int>() { 204, 304 }.Contains(response.StatusCode))
{
Console.WriteLine(response.StatusCode == 204 ? "No Content" : "Not Modified");
return;
}
if (response.IsExpected)
{
ResponseHandler responseHandler = response.Object;
if (responseHandler is ResponseWrapper)
{
ResponseWrapper responseWrapper = (ResponseWrapper)responseHandler;
List<SupportedAPI> apis = responseWrapper.Apis;
foreach (SupportedAPI api in apis)
{
Console.WriteLine("API Path : " + api.Path);
List<OperationTypes> operationTypes = api.OperationTypes;
foreach (OperationTypes operationType in operationTypes)
{
Console.WriteLine("API Operation Method : " + operationType.Method);
Console.WriteLine("API Operation OAuthScope : " + operationType.OauthScope);
Console.WriteLine("API Operation MaxCredits : " + operationType.MaxCredits);
Console.WriteLine("API Operation MinCredits : " + operationType.MinCredits);
}
}
}
else if (responseHandler is APIException)
{
APIException exception = (APIException)responseHandler;
Console.WriteLine("Status: " + exception.Status.Value);
Console.WriteLine("Code: " + exception.Code.Value);
Console.WriteLine("Details: ");
foreach (KeyValuePair<string, object> entry in exception.Details)
{
Console.WriteLine(entry.Key + ": " + entry.Value);
}
Console.WriteLine("Message: " + exception.Message);
}
}
else
{
Model responseObject = response.Model;
System.Type type = responseObject.GetType();
Console.WriteLine("Type is : {0}", type.Name);
PropertyInfo[] props = type.GetProperties();
Console.WriteLine("Properties (N = {0}) :", props.Length);
foreach (var prop in props)
{
if (prop.GetIndexParameters().Length == 0)
{
Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
}
else
{
Console.WriteLine("{0} ({1}) in <Indexed>", prop.Name, prop.PropertyType.Name);
}
}
}
}
}
public static void Call()
{
try
{
Environment environment = USDataCenter.PRODUCTION;
IToken token = new OAuthToken.Builder().ClientId("Client_Id").ClientSecret("Client_Secret").RefreshToken("Refresh_Token").RedirectURL("Redirect_URL").Build();
new Initializer.Builder().Environment(environment).Token(token).Initialize();
GetSupportedAPI_1();
}
catch (Exception e)
{
Console.WriteLine(JsonConvert.SerializeObject(e));
}
}
}
}

125 changes: 125 additions & 0 deletions versions/3.0.0/Samples/AuditLogExport1/CreateAuditlogExport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Initializer = Com.Zoho.Crm.API.Initializer;
using Environment = Com.Zoho.Crm.API.Dc.DataCenter.Environment;
using Com.Zoho.API.Authenticator;
using Com.Zoho.Crm.API.AuditLogExport;
using Com.Zoho.Crm.API.Dc;
using Com.Zoho.Crm.API.Util;
using Newtonsoft.Json;

namespace Samples.AuditLogExport1
{
public class CreateAuditlogExport
{
public static void CreateAuditlogExport_1()
{
AuditLogExportOperations auditLogExportOperations = new AuditLogExportOperations();
BodyWrapper request = new BodyWrapper();
List<AuditLogExport> auditLogExport = new List<AuditLogExport>();
AuditLogExport auditLogExport1 = new AuditLogExport();
Criteria criteria = new Criteria();
criteria.Comparator = "between";
Field field = new Field();
field.APIName = "audited_time";
criteria.Field = field;
List<DateTimeOffset> values = new List<DateTimeOffset>();
values.Add(new DateTimeOffset(new DateTime(2020, 05, 15, 12, 0, 0, DateTimeKind.Local)));
values.Add(new DateTimeOffset(new DateTime(2020, 05, 15, 12, 0, 0, DateTimeKind.Local)));
criteria.Value = values;
auditLogExport1.Criteria = criteria;
auditLogExport.Add(auditLogExport1);
request.AuditLogExport = auditLogExport;
APIResponse<ActionHandler> response = auditLogExportOperations.CreateAuditlogExport(request);
if (response != null)
{
Console.WriteLine("Status Code: " + response.StatusCode);
if (response.IsExpected)
{
ActionHandler actionHandler = response.Object;
if (actionHandler is ActionWrapper)
{
ActionWrapper actionWrapper = (ActionWrapper)actionHandler;
List<ActionResponse> actionresponses = actionWrapper.AuditLogExport;
foreach (ActionResponse actionresponse in actionresponses)
{
if (actionresponse is SuccessResponse)
{
SuccessResponse successresponse = (SuccessResponse)actionresponse;
Console.WriteLine("Status: " + successresponse.Status.Value);
Console.WriteLine("Code: " + successresponse.Code.Value);
Console.WriteLine("Details: ");
foreach (KeyValuePair<string, object> entry in successresponse.Details)
{
Console.WriteLine(entry.Key + ": " + entry.Value);
}
Console.WriteLine("Message: " + successresponse.Message);
}
else if (actionresponse is APIException)
{
APIException exception = (APIException)actionresponse;
Console.WriteLine("Status: " + exception.Status.Value);
Console.WriteLine("Code: " + exception.Code.Value);
Console.WriteLine("Details: ");
foreach (KeyValuePair<string, object> entry in exception.Details)
{
Console.WriteLine(entry.Key + ": " + entry.Value);
}
Console.WriteLine("Message: " + exception.Message);
}
}

}
else if (actionHandler is APIException)
{
APIException exception = (APIException)actionHandler;
Console.WriteLine("Status: " + exception.Status.Value);
Console.WriteLine("Code: " + exception.Code.Value);
Console.WriteLine("Details: ");
foreach (KeyValuePair<string, object> entry in exception.Details)
{
Console.WriteLine(entry.Key + ": " + entry.Value);
}
Console.WriteLine("Message: " + exception.Message);
}
}
else
{
Model responseObject = response.Model;
System.Type type = responseObject.GetType();
Console.WriteLine("Type is : {0}", type.Name);
PropertyInfo[] props = type.GetProperties();
Console.WriteLine("Properties (N = {0}) :", props.Length);
foreach (var prop in props)
{
if (prop.GetIndexParameters().Length == 0)
{
Console.WriteLine("{0} ({1}) in {2}", prop.Name, prop.PropertyType.Name, prop.GetValue(responseObject));
}
else
{
Console.WriteLine("{0} ({1}) in <Indexed>", prop.Name, prop.PropertyType.Name);
}
}
}
}
}

public static void Call()
{
try
{
Environment environment = USDataCenter.PRODUCTION;
IToken token = new OAuthToken.Builder().ClientId("Client_Id").ClientSecret("Client_Secret").RefreshToken("Refresh_Token").RedirectURL("Redirect_URL").Build();
new Initializer.Builder().Environment(environment).Token(token).Initialize();
CreateAuditlogExport_1();
}
catch (Exception e)
{
Console.WriteLine(JsonConvert.SerializeObject(e));
}
}
}
}

Loading

0 comments on commit cf17ccd

Please sign in to comment.