Skip to content

Commit

Permalink
Merge pull request #7 from zoho/beta
Browse files Browse the repository at this point in the history
Update Fields sample code
  • Loading branch information
raja-7453 authored Sep 25, 2024
2 parents af1e986 + c44906f commit 876bc5f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
5 changes: 2 additions & 3 deletions samples/fields/CreateField.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class CreateField
{
public static void createField(Long layoutId, String module) throws Exception
public static void createField(String module) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
BodyWrapper bodyWrapper = new BodyWrapper();
Expand Down Expand Up @@ -185,8 +185,7 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 34799001l;
createField(layoutId, moduleAPIName);
createField(moduleAPIName);
}
catch (Exception e)
{
Expand Down
14 changes: 6 additions & 8 deletions samples/fields/DeleteField.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package samples.fields;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

import com.zoho.api.authenticator.OAuthToken;
import com.zoho.api.authenticator.Token;
import com.zoho.crm.api.Initializer;
import com.zoho.crm.api.ParameterMap;
import com.zoho.crm.api.dc.DataCenter.Environment;
import com.zoho.crm.api.dc.USDataCenter;
import com.zoho.crm.api.fields.APIException;
import com.zoho.crm.api.fields.ActionHandler;
Expand All @@ -16,13 +13,15 @@
import com.zoho.crm.api.fields.FieldsOperations;
import com.zoho.crm.api.fields.FieldsOperations.CreateFieldParam;
import com.zoho.crm.api.fields.SuccessResponse;
import com.zoho.crm.api.dc.DataCenter.Environment;
import com.zoho.crm.api.util.APIResponse;
import com.zoho.crm.api.util.Model;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

public class DeleteField
{
public static void deleteField(Long layoutId, String module, Long fieldId) throws Exception
public static void deleteField(String module, Long fieldId) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
ParameterMap paramInstance = new ParameterMap();
Expand Down Expand Up @@ -101,9 +100,8 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 349001l;
Long fieldId = 3491l;
deleteField(layoutId, moduleAPIName, fieldId);
deleteField(moduleAPIName, fieldId);
}
catch (Exception e)
{
Expand Down
5 changes: 2 additions & 3 deletions samples/fields/UpdateField.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class UpdateField
{
public static void updateField(Long layoutId, String module, Long fieldId) throws Exception
public static void updateField(String module, Long fieldId) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
BodyWrapper bodyWrapper = new BodyWrapper();
Expand Down Expand Up @@ -198,9 +198,8 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 7534770167l;
Long fieldId = 75347706070l;
updateField(layoutId, moduleAPIName, fieldId);
updateField(moduleAPIName, fieldId);
}
catch (Exception e)
{
Expand Down
5 changes: 2 additions & 3 deletions versions/4.0.0/samples/fields/CreateField.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class CreateField
{
public static void createField(Long layoutId, String module) throws Exception
public static void createField(String module) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
BodyWrapper bodyWrapper = new BodyWrapper();
Expand Down Expand Up @@ -185,8 +185,7 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 34799001l;
createField(layoutId, moduleAPIName);
createField(moduleAPIName);
}
catch (Exception e)
{
Expand Down
14 changes: 6 additions & 8 deletions versions/4.0.0/samples/fields/DeleteField.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package samples.fields;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

import com.zoho.api.authenticator.OAuthToken;
import com.zoho.api.authenticator.Token;
import com.zoho.crm.api.Initializer;
import com.zoho.crm.api.ParameterMap;
import com.zoho.crm.api.dc.DataCenter.Environment;
import com.zoho.crm.api.dc.USDataCenter;
import com.zoho.crm.api.fields.APIException;
import com.zoho.crm.api.fields.ActionHandler;
Expand All @@ -16,13 +13,15 @@
import com.zoho.crm.api.fields.FieldsOperations;
import com.zoho.crm.api.fields.FieldsOperations.CreateFieldParam;
import com.zoho.crm.api.fields.SuccessResponse;
import com.zoho.crm.api.dc.DataCenter.Environment;
import com.zoho.crm.api.util.APIResponse;
import com.zoho.crm.api.util.Model;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

public class DeleteField
{
public static void deleteField(Long layoutId, String module, Long fieldId) throws Exception
public static void deleteField(String module, Long fieldId) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
ParameterMap paramInstance = new ParameterMap();
Expand Down Expand Up @@ -101,9 +100,8 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 349001l;
Long fieldId = 3491l;
deleteField(layoutId, moduleAPIName, fieldId);
deleteField(moduleAPIName, fieldId);
}
catch (Exception e)
{
Expand Down
5 changes: 2 additions & 3 deletions versions/4.0.0/samples/fields/UpdateField.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public class UpdateField
{
public static void updateField(Long layoutId, String module, Long fieldId) throws Exception
public static void updateField(String module, Long fieldId) throws Exception
{
FieldsOperations fieldsOperations = new FieldsOperations();
BodyWrapper bodyWrapper = new BodyWrapper();
Expand Down Expand Up @@ -198,9 +198,8 @@ public static void main(String[] args)
Token token = new OAuthToken.Builder().clientID("Client_Id").clientSecret("Client_Secret").refreshToken("Refresh_Token").build();
new Initializer.Builder().environment(environment).token(token).initialize();
String moduleAPIName = "Leads";
Long layoutId = 7534770167l;
Long fieldId = 75347706070l;
updateField(layoutId, moduleAPIName, fieldId);
updateField(moduleAPIName, fieldId);
}
catch (Exception e)
{
Expand Down

0 comments on commit 876bc5f

Please sign in to comment.