Example #1
0
        static void Main(string[] args)
        {
            var authClient = new OAuthClient("*****@*****.**", "password");
            var apiContext = new ApiContext(authClient.GetSecureToken())
            {
                AppName = "Application name",
            };

            var api = new ApiExplorer(apiContext);

            // get template for new contact
            var template = api.Contacts.Default();

            // cast to insert model
            var contact = (ContactCreate)template;

            // fill new contact
            contact.CompanyName = "New Company";

            // insert
            var addedContact = api.Contacts.Create(contact);

            // delete
            bool isDeleted = api.Contacts.Delete(addedContact.Id);
            

            List<ValidationMessage> errors;
            bool isValid = ApiValidator.ValidateObject(contact, out errors);

            if (isValid)
            {
                var result = api.Contacts.Create(new ContactCreate());
            }
        }
Example #2
0
        public static IdokladSdk.ApiExplorer Connect(string clientId, string clientSecret)
        {
            var credentials = new ClientCredentialAuth(clientId, clientSecret);

            var apiContext = new ApiContext(credentials)
            {
                AppName = "iDoklad",
            };

            var explorer = new IdokladSdk.ApiExplorer(apiContext);

            return(explorer);
        }