public ZohoClient(Uri endpoint, string clientId, string clientSecret, string refreshToken, ZohoTokenInformation accessToken)
        {
            this.Token        = accessToken;
            restTokenClient   = new RestClient(endpoint);
            this.endpoint     = endpoint;
            this.clientId     = clientId;
            this.clientSecret = clientSecret;
            this.refreshToken = refreshToken;

            // Setting up JSON Serialization Engine
            serializer = NewtonsoftJsonSerializer.Default;

            // Check Token the first time
            CheckToken();
            InitializeDataClient();
            // Prepare Client
            Leads    = new Module <Lead>(this, "Leads");
            Accounts = new Module <Account>(this, "Accounts");
            Contacts = new Module <Contact>(this, "Contacts");
            Deals    = new Module <Deal>(this, "Deals");
        }
Пример #2
0
        public ZohoClient(Uri endpoint, string clientId, string clientSecret, string refreshToken, ZohoTokenInformation accessToken, int asyncTaskTimeout = 5000)
        {
            restTokenClient = new RestClient(endpoint);
            restTokenClient.UseSerializer(() => new NewtonsoftJsonSerializer());

            this.Token            = accessToken;
            this.endpoint         = endpoint;
            this.clientId         = clientId;
            this.clientSecret     = clientSecret;
            this.refreshToken     = refreshToken;
            this.asyncTaskTimeout = asyncTaskTimeout;



            // Check Token the first time
            CheckToken();
            InitializeDataClient();
            // Prepare Client
            Leads    = new Module <Lead>(this, "Leads");
            Accounts = new Module <Account>(this, "Accounts");
            Contacts = new Module <Contact>(this, "Contacts");
            Deals    = new Module <Deal>(this, "Deals");
        }