/// <summary>
        /// Gets a list of deals
        /// </summary>
        /// <typeparam name="T">Implementation of DealListHubSpotModel</typeparam>
        /// <param name="opts">Options (limit, offset) relating to request</param>
        /// <returns>List of deals</returns>
        public DealListHubSpotModel <T> List <T>(bool includeAssociations, ListRequestOptions opts = null) where T : DealHubSpotModel, new()
        {
            if (opts == null)
            {
                opts = new ListRequestOptions();
            }

            var path = $"{new DealListHubSpotModel<T>().RouteBasePath}/deal/paged"
                       .SetQueryParam("limit", opts.Limit);

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            if (includeAssociations)
            {
                path = path.SetQueryParam("includeAssociations", "true");
            }

            if (opts.PropertiesToInclude.Any())
            {
                path = path.SetQueryParam("properties", opts.PropertiesToInclude);
            }

            var data = _client.ExecuteList <DealListHubSpotModel <T> >(path, opts);

            return(data);
        }
        public ContactListResponse GetPageContacts(ListRequestOptions opts)
        {
            if (opts == null)
            {
                opts = new ListRequestOptions();
            }

            var fullUrl = $"{ BaseURL }/contacts/v1/lists/recently_updated/contacts/recent?"
                          .SetQueryParam("hapikey", ApiKey);

            fullUrl.SetQueryParam("count", opts.Limit);

            if (opts.PropertiesToInclude.Any())
            {
                fullUrl.SetQueryParam("property", opts.PropertiesToInclude);
            }
            if (opts.timeOffset.HasValue)
            {
                fullUrl = fullUrl.SetQueryParam("timeOffset", opts.timeOffset);
            }

            string response = RequestController.GetResponse(fullUrl);

            //deserialise this to a list of contacts
            var contactList = ContactListResponse.FromJson(response);

            return(contactList);
        }
Beispiel #3
0
        /// <summary>
        /// Get all contacts in a list
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="listId"></param>
        /// <param name="opts"></param>
        /// <returns></returns>
        public ContactListHubSpotModel <T> GetList <T>(long listId, ListRequestOptions opts = null) where T : ContactHubSpotModel, new()
        {
            if (opts == null)
            {
                opts = new ListRequestOptions();
            }

            var path = $"{new ContactHubSpotModel().RouteBasePath}/lists/{listId}/contacts/all"

                       .SetQueryParam("count", opts.Limit);

            if (opts.PropertiesToInclude.Any())
            {
                path.SetQueryParam("property", opts.PropertiesToInclude);
            }

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("vidOffset", opts.Offset);
            }


            var data = _client.ExecuteList <ContactListHubSpotModel <T> >(path, opts);

            return(data);
        }
Beispiel #4
0
        /// <summary>
        /// Get all contacts in a list
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="listId"></param>
        /// <param name="opts"></param>
        /// <returns></returns>
        public ContactListHubSpotModel <ContactHubSpotModel> GetList(long listId, ListRequestOptions opts = null)
        {
            if (opts == null)
            {
                opts = new ListRequestOptions();
            }

            string path = GetRoute <ContactHubSpotModel>("lists", $"{listId}", "contacts", "all");

            path += $"{QueryParams.COUNT}={opts.Limit}";


            if (opts.PropertiesToInclude.Any())
            {
                path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}";
            }

            if (opts.Offset.HasValue)
            {
                path = path += $"{QueryParams.VID_OFFSET}={opts.Offset}";
            }

            var data = _client.Execute <ContactListHubSpotModel <ContactHubSpotModel> >(path);

            return(data);
        }
        public FileListHubSpotModel <T> List <T>(ListRequestOptions opts = null) where T : FileHubSpotModel, new()
        {
            opts = opts ?? new ListRequestOptions();
            var path = $"{new T().RouteBasePath}/files".SetQueryParam("limit", opts.Limit);

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }
            var data = _client.ExecuteList <FileListHubSpotModel <T> >(path, opts, Method.GET, false);

            return(data);
        }
        private CompanyListHubSpotModel <CompanyHubSpotModel> GetCompanyMoreByQuery(HubSpotApi api)
        {
            List <string> lstProperties = new List <string>();

            lstProperties.Add("Name");

            ListRequestOptions lstRequestOptions = new ListRequestOptions();

            lstRequestOptions.PropertiesToInclude = lstProperties;

            var companies = api.Company.List(lstRequestOptions);

            return(companies);
        }
        public Task <CompanyListHubSpotModel <CompanyHubSpotModel> > ListAsync(ListRequestOptions opts = null, CancellationToken cancellationToken = default)
        {
            opts = opts ?? new ListRequestOptions();

            var path = GetRoute <CompanyHubSpotModel>("companies", "paged").SetQueryParam("count", opts.Limit);

            if (opts.PropertiesToInclude.Any())
            {
                path.SetQueryParam("properties", opts.PropertiesToInclude);
            }

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            return(_client.ExecuteAsync <CompanyListHubSpotModel <CompanyHubSpotModel>, ListRequestOptions>(path, opts, cancellationToken: cancellationToken));
        }
        public CompanyListHubSpotModel <CompanyHubSpotModel> List(ListRequestOptions opts = null)
        {
            opts = opts ?? new ListRequestOptions();

            var path = GetRoute <CompanyHubSpotModel>("companies", "paged").SetQueryParam("count", opts.Limit);

            if (opts.PropertiesToInclude.Any())
            {
                path.SetQueryParam("properties", opts.PropertiesToInclude);
            }

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            return(_client.Execute <CompanyListHubSpotModel <CompanyHubSpotModel>, ListRequestOptions>(path, opts));
        }
        public CompanyListHubSpotModel <CompanyHubSpotModel> List(ListRequestOptions opts = null)
        {
            opts = opts ?? new ListRequestOptions();

            string path = GetRoute <CompanyHubSpotModel>("companies", "paged");

            path += $"{QueryParams.COUNT}={opts.Limit}";

            if (opts.PropertiesToInclude.Any())
            {
                path += $"{QueryParams.PROPERTIES}={opts.PropertiesToInclude}";
            }

            if (opts.Offset.HasValue)
            {
                path += $"{QueryParams.OFFSET}={opts.Offset}";
            }

            return(_client.Execute <CompanyListHubSpotModel <CompanyHubSpotModel>, ListRequestOptions>(path, opts));
        }
Beispiel #10
0
        /// <summary>
        /// List all available contacts
        /// </summary>
        /// <param name="properties">List of properties to fetch for each contact</param>
        /// <param name="opts">Request options - used for pagination etc.</param>
        /// <typeparam name="T">Implementation of ContactHubSpotModel</typeparam>
        /// <returns>A list of contacts</returns>
        public ContactListHubSpotModel <ContactHubSpotModel> List(ListRequestOptions opts = null)
        {
            opts = opts ?? new ListRequestOptions();

            string path = GetRoute <ContactHubSpotModel>("lists", "all", "contacts", "all");

            path += $"{QueryParams.COUNT}={opts.Limit}";

            if (opts.PropertiesToInclude.Any())
            {
                path += $"{QueryParams.PROPERTY}={opts.PropertiesToInclude}";
            }

            if (opts.Offset.HasValue)
            {
                path = path += $"{QueryParams.VID_OFFSET}={opts.Offset}";
            }

            return(_client.Execute <ContactListHubSpotModel <ContactHubSpotModel>, ListRequestOptions>(path, opts));
        }
        public CompanyListHubSpotModel <T> List <T>(ListRequestOptions opts = null) where T : CompanyHubSpotModel, new()
        {
            if (opts == null)
            {
                opts = new ListRequestOptions();
            }

            var path = $"{new CompanyHubSpotModel().RouteBasePath}/companies/paged"
                       .SetQueryParam("count", opts.Limit);

            if (opts.PropertiesToInclude.Any())
            {
                path.SetQueryParam("properties", opts.PropertiesToInclude);
            }
            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            var data = _client.ExecuteList <CompanyListHubSpotModel <T> >(path, opts);

            return(data);
        }
        /// <summary>
        /// Gets a list of deals
        /// </summary>
        /// <typeparam name="T">Implementation of DealListHubSpotModel</typeparam>
        /// <param name="opts">Options (limit, offset) relating to request</param>
        /// <returns>List of deals</returns>
        public DealListHubSpotModel <DealHubSpotModel> List(bool includeAssociations, ListRequestOptions opts = null)
        {
            opts = opts ?? new ListRequestOptions(250);

            Url path = GetRoute <DealListHubSpotModel <DealHubSpotModel> >("deal", "paged").SetQueryParam("limit", opts.Limit);

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            if (includeAssociations)
            {
                path = path.SetQueryParam("includeAssociations", "true");
            }

            if (opts.PropertiesToInclude.Any())
            {
                path = path.SetQueryParam("properties", opts.PropertiesToInclude);
            }

            return(_client.Execute <DealListHubSpotModel <DealHubSpotModel>, ListRequestOptions>(path, opts));
        }
        /// <summary>
        /// Gets a list of deals associated to a hubSpot Object
        /// </summary>
        /// <typeparam name="T">Implementation of DealListHubSpotModel</typeparam>
        /// <param name="includeAssociations">Bool include associated Ids</param>
        /// <param name="hubId">Long Id of Hubspot object related to deals</param>
        /// <param name="objectName">String name of Hubspot object related to deals (contact\account)</param>
        /// <param name="opts">Options (limit, offset) relating to request</param>
        /// <returns>List of deals</returns>
        public DealListHubSpotModel <DealHubSpotModel> ListAssociated(bool includeAssociations, long hubId, ListRequestOptions opts = null, string objectName = "contact")
        {
            opts = opts ?? new ListRequestOptions();

            Url path = $"{GetRoute<DealListHubSpotModel<DealHubSpotModel>>()}/deal/associated/{objectName}/{hubId}/paged"
                       .SetQueryParam("limit", opts.Limit);

            if (opts.Offset.HasValue)
            {
                path = path.SetQueryParam("offset", opts.Offset);
            }

            if (includeAssociations)
            {
                path = path.SetQueryParam("includeAssociations", "true");
            }

            if (opts.PropertiesToInclude.Any())
            {
                path = path.SetQueryParam("properties", opts.PropertiesToInclude);
            }

            return(_client.Execute <DealListHubSpotModel <DealHubSpotModel>, ListRequestOptions>(path, opts));
        }
Beispiel #14
0
 public ActionResult GetList(ListRequestOptions options)
 {
     return(Json(eqService.GetList(options)));
 }
Beispiel #15
0
        /// <summary>
        /// Gets a list of deals
        /// </summary>
        /// <typeparam name="T">Implementation of DealListHubSpotModel</typeparam>
        /// <param name="opts">Options (limit, offset) relating to request</param>
        /// <returns>List of deals</returns>
        public DealListHubSpotModel <DealHubSpotModel> List(bool includeAssociations, ListRequestOptions opts = null)
        {
            opts = opts ?? new ListRequestOptions(250);

            string path = GetRoute <DealListHubSpotModel <DealHubSpotModel> >("deal", "paged");

            path += $"{QueryParams.LIMIT}={opts.Limit}";

            if (opts.Offset.HasValue)
            {
                path += $"{QueryParams.OFFSET}={opts.Offset}";
            }

            if (includeAssociations)
            {
                path += $"{QueryParams.INCLUDE_ASSOCIATIONS}=true";
            }

            if (opts.PropertiesToInclude.Any())
            {
                path += $"{QueryParams.PROPERTIES}={opts.PropertiesToInclude}";
            }

            return(_client.Execute <DealListHubSpotModel <DealHubSpotModel>, ListRequestOptions>(path, opts));
        }
Beispiel #16
0
        /// <summary>
        /// Gets a list of deals associated to a hubSpot Object
        /// </summary>
        /// <typeparam name="T">Implementation of DealListHubSpotModel</typeparam>
        /// <param name="includeAssociations">Bool include associated Ids</param>
        /// <param name="hubId">Long Id of Hubspot object related to deals</param>
        /// <param name="objectName">String name of Hubspot object related to deals (contact\account)</param>
        /// <param name="opts">Options (limit, offset) relating to request</param>
        /// <returns>List of deals</returns>
        public DealListHubSpotModel <DealHubSpotModel> ListAssociated(bool includeAssociations, long hubId, ListRequestOptions opts = null, string objectName = "contact")
        {
            opts = opts ?? new ListRequestOptions();

            string path = GetRoute <DealListHubSpotModel <DealHubSpotModel> >("deal", "associated", $"{objectName}", $"{hubId}", "paged");

            path += $"?{QueryParams.LIMIT}={opts.Limit}";

            if (opts.Offset.HasValue)
            {
                path += $"&{QueryParams.OFFSET}={opts.Offset}";
            }

            if (includeAssociations)
            {
                path += $"&{QueryParams.INCLUDE_ASSOCIATIONS}=true";
            }

            if (opts.PropertiesToInclude.Any())
            {
                path += $"&{QueryParams.PROPERTIES}={opts.PropertiesToInclude}";
            }

            return(_client.Execute <DealListHubSpotModel <DealHubSpotModel>, ListRequestOptions>(path, opts));
        }