示例#1
0
        /// <summary>
        /// Creates a deal entity
        /// </summary>
        /// <typeparam name="T">Implementation of DealHubSpotModel</typeparam>
        /// <param name="entity">The entity</param>
        /// <returns>The created entity (with ID set)</returns>
        public T Create <T>(T entity) where T : DealHubSpotModel, new()
        {
            var path = $"{entity.RouteBasePath}/deal";
            var data = _client.Execute <T>(path, entity, Method.POST);

            return(data);
        }
        /// <summary>
        /// Creates an engagement
        /// </summary>
        /// <param name="entity">The engagement to create</param>
        /// <returns>The created engagement (with ID set)</returns>
        public EngagementHubSpotModel Create(EngagementHubSpotModel entity)
        {
            var path = $"{entity.RouteBasePath}/engagements";
            var data = _client.Execute <EngagementHubSpotModel>(path, entity, Method.POST, false);

            return(data);
        }
        /// <summary>
        /// Gets campaign data by ID from hubspot
        /// </summary>
        /// <param name="campaignId">The campaign ID to query.</param>
        /// <param name="appId">The app ID to query.</param>
        /// <typeparam name="T">Implementation of EmailCampaignDataHubSpotModel</typeparam>
        /// <returns>The xcampaign data entity</returns>
        public T GetCampaignDataById <T>(long campaignId, long appId) where T : EmailCampaignDataHubSpotModel, new()
        {
            var path = $"{(new T()).RouteBasePath}/{campaignId}"
                       .SetQueryParam("appId", appId);
            var data = _client.Execute <T>(path, Method.GET);

            return(data);
        }
示例#4
0
 public TimelineEventHubSpotModel GetEventById(long entityID)
 {
     try
     {
         return(_client.Execute <TimelineEventHubSpotModel>(GetRoute <TimelineEventHubSpotModel>(entityID.ToString())));
     }
     catch (HubSpotException exception)
     {
         if (exception.ReturnedError.StatusCode == HttpStatusCode.NotFound)
         {
             return(null);
         }
         throw;
     }
 }
示例#5
0
 /// <summary>
 /// Gets campaign data by ID from hubspot
 /// </summary>
 /// <param name="campaignId">The campaign ID to query.</param>
 /// <param name="appId">The app ID to query.</param>
 /// <typeparam name="T">Implementation of EmailCampaignDataHubSpotModel</typeparam>
 /// <returns>The campaign data entity or null if the compaign does not exist.</returns>
 public T GetCampaignDataById<T>(long campaignId, long appId) where T : EmailCampaignDataHubSpotModel, new()
 {
     var path = $"{(new T()).RouteBasePath}/{campaignId}"
         .SetQueryParam("appId", appId);
     try
     {
         var data = _client.Execute<T>(path, Method.GET);
         return data;
     }
     catch (HubSpotException exception)
     {
         if (exception.ReturnedError.StatusCode == HttpStatusCode.NotFound)
             return null;
         throw;
     }
 }
示例#6
0
        /// <summary>
        /// Returns a list of all pipelines of the specified objectType
        /// </summary>
        /// <typeparam name="T">Implementation of PipelineHubSpotModel</typeparam>
        /// <param name="objectType">Must be one of: deals, tickets</param>
        /// <param name="includeInactive">Must be one of "EXCLUDE_DELETED" (default), or "INCLUDE_DELETED" </param>
        /// <returns>The requested list</returns>
        public PipelineListHubSpotModel <T> List <T>(string objectType, string includeInactive = "EXCLUDE_DELETED") where T : PipelineHubSpotModel, new()
        {
            string path = $"{new PipelineListHubSpotModel<T>().RouteBasePath}/pipelines/{objectType}?includeInactive={includeInactive}";

            var data = _client.Execute <PipelineListHubSpotModel <T> >(path, method: RestSharp.Method.GET);

            return(data);
        }
        /// <summary>
        /// Creates a deal entity
        /// </summary>
        /// <typeparam name="T">Implementation of DealHubSpotModel</typeparam>
        /// <param name="entity">The entity</param>
        /// <returns>The created entity (with ID set)</returns>
        public DealHubSpotModel Create(DealHubSpotModel entity)
        {
            NameTransportModel <DealHubSpotModel> model = new NameTransportModel <DealHubSpotModel>();

            model.ToPropertyTransportModel(entity);

            return(_client.Execute <DealHubSpotModel, NameTransportModel <DealHubSpotModel> >(GetRoute <DealHubSpotModel>(), model, Method.POST));
        }
        /// <summary>
        /// Get subscription status for the given email address
        /// </summary>
        /// <param name="email"></param>
        public SubscriptionStatusHubSpotModel GetStatus(string email)
        {
            var path = $"{new SubscriptionTypeListHubSpotModel().RouteBasePath}/subscriptions/{email}";

            return(_client.Execute <SubscriptionStatusHubSpotModel>(path, Method.GET, false));
        }
示例#9
0
        /// <summary>
        /// Creates a contact entity
        /// </summary>
        /// <typeparam name="T">Implementation of ContactHubSpotModel</typeparam>
        /// <param name="entity">The entity</param>
        /// <returns>The created entity (with ID set)</returns>
        /// <exception cref="NotImplementedException"></exception>
        public T Create <T>(T entity) where T : ContactHubSpotModel, new()
        {
            var path = $"{entity.RouteBasePath}/contact";

            return(_client.Execute <T>(path, entity, Method.POST));
        }
示例#10
0
 /// <summary>
 /// Creates an engagement
 /// </summary>
 /// <param name="entity">The engagement to create</param>
 /// <returns>The created engagement (with ID set)</returns>
 public EngagementHubSpotModel Create(EngagementHubSpotModel entity)
 => _client.Execute <EngagementHubSpotModel, EngagementHubSpotModel>(GetRoute <EngagementHubSpotModel>(), entity, Method.POST);
示例#11
0
 public PropertiesListHubSpotModel <CompanyPropertyHubSpotModel> GetAll()
 => _client.Execute <PropertiesListHubSpotModel <CompanyPropertyHubSpotModel> >(GetRoute <CompanyPropertyHubSpotModel>());
示例#12
0
        /// <summary>
        /// Creates a contact entity
        /// </summary>
        /// <typeparam name="T">Implementation of ContactHubSpotModel</typeparam>
        /// <param name="entity">The entity</param>
        /// <returns>The created entity (with ID set)</returns>
        /// <exception cref="NotImplementedException"></exception>
        public ContactHubSpotModel Create(ContactHubSpotModel entity)
        {
            CreateOrUpdateContactTransportModel transport = new CreateOrUpdateContactTransportModel(entity);
            string path = GetRoute <ContactHubSpotModel>("contact");

            return(_client.Execute <ContactHubSpotModel, CreateOrUpdateContactTransportModel>(path, transport, Method.POST));
        }
示例#13
0
        /// <summary>
        /// Creates a folder within the File Manager
        /// </summary>
        /// <param name="folder">Folder to create</param>
        /// <returns>The created folder</returns>
        public FolderHubSpotModel CreateFolder(FolderHubSpotModel folder)
        {
            var path = $"{new FolderHubSpotModel().RouteBasePath}/folders";

            return(_client.Execute <FolderHubSpotModel>(path, folder, Method.POST, false));
        }
 /// <summary>
 /// Creates a Company entity
 /// </summary>
 /// <typeparam name="T">Implementation of CompanyHubSpotModel</typeparam>
 /// <param name="entity">The entity</param>
 /// <returns>The created entity (with ID set)</returns>
 /// <exception cref="NotImplementedException"></exception>
 public CompanyHubSpotModel Create(CompanyHubSpotModel entity)
 => _client.Execute <CompanyHubSpotModel, CompanyHubSpotModel>(GetRoute <CompanyHubSpotModel>("companies"), entity, Method.POST);
        public CompanyPropertyHubSpotModel Create(CompanyPropertyHubSpotModel property)
        {
            var path = $"{new PropertiesListHubSpotModel<CompanyPropertyHubSpotModel>().RouteBasePath}";

            return(_client.Execute <CompanyPropertyHubSpotModel>(path, property, Method.POST, convertToPropertiesSchema: false));
        }
        public ContactPropertyModel CreateProperty(ContactPropertyModel entity)
        {
            string path = GetRoute <ContactPropertyModel>();

            return(_client.Execute <ContactPropertyModel, ContactPropertyModel>(path, entity, RestSharp.Method.POST));
        }
示例#17
0
 /// <summary>
 /// Gets all owners within your HubSpot account
 /// </summary>
 /// <returns>The set of owners</returns>
 public OwnerListHubSpotModel <T> GetAll <T>() where T : OwnerHubSpotModel
 => _client.Execute <OwnerListHubSpotModel <T> >(GetRoute <T>("owners"));
示例#18
0
 public TimelineEventHubSpotModel GetEventById(long entityID)
 => _client.Execute <TimelineEventHubSpotModel>(GetRoute <TimelineEventHubSpotModel>(entityID.ToString()));
 public SubscriptionTypeListHubSpotModel GetSubscriptionTypes() 
     => _client.Execute<SubscriptionTypeListHubSpotModel>(GetRoute());
示例#20
0
        /// <summary>
        /// Creates a folder within the File Manager
        /// </summary>
        /// <param name="folder">Folder to create</param>
        /// <returns>The created folder</returns>
        public FolderHubSpotModel CreateFolder(FolderHubSpotModel folder)
        {
            var path = $"{GetRoute<FolderHubSpotModel>()}/folders";

            return(_client.Execute <FolderHubSpotModel, FolderHubSpotModel>(path, folder, Method.POST));
        }
示例#21
0
 public IEnumerable <CompanyPropertyGroupHubSpotModel> GetAll()
 => _client.Execute <List <CompanyPropertyGroupHubSpotModel> >(GetRoute <CompanyPropertyGroupHubSpotModel>());