public @interface(ref PardotAPI.token thisToken, string thisInterface) { interfaceName = thisInterface; token = thisToken; // prepend API url to the baseUrl call baseUrl = GlobalConstants.pardotAPIUrl + "/" + baseUrl; }
public void instantiate(string email, string password, string user_key) { // make sure parameters are filld out if (email.notFilled() || password.notFilled() || user_key.notFilled()) { throw new System.ArgumentException("Email, password, and user key must be provided"); } // create token from provided parameters token = new PardotAPI.token(email, password, user_key); // test token if (!token.is_valid()) { status = "An error occurred creating the security token. Please double check your credentials."; PardotAPI.GlobalMethods.notifyAdmin(status); } // load child objects campaigns = new PardotAPI.@interface(ref token, "campaign"); custom_fields = new PardotAPI.@interface(ref token, "custom_field"); custom_redirects = new PardotAPI.@interface(ref token, "custom_redirect"); dynamic_contents = new PardotAPI.@interface(ref token, "dynamic_content"); emails = new PardotAPI.@interface(ref token, "email"); email_templates = new PardotAPI.@interface(ref token, "email_template"); forms = new PardotAPI.@interface(ref token, "form"); lifecycle_histories = new PardotAPI.@interface(ref token, "lifecycle_history"); lifecycle_stages = new PardotAPI.@interface(ref token, "lifecycle_stage"); lists = new PardotAPI.@interface(ref token, "list"); list_memberships = new PardotAPI.@interface(ref token, "list_membership"); opportunities = new PardotAPI.@interface(ref token, "opportunity"); prospects = new PardotAPI.@interface(ref token, "prospect"); prospect_accounts = new PardotAPI.@interface(ref token, "prospect_account"); tags = new PardotAPI.@interface(ref token, "tag"); tag_objects = new PardotAPI.@interface(ref token, "tag_object");; users = new PardotAPI.@interface(ref token, "user"); visitors = new PardotAPI.@interface(ref token, "visitor"); visitor_activities = new PardotAPI.@interface(ref token, "visitor_activity"); visits = new PardotAPI.@interface(ref token, "visit"); }