Beispiel #1
0
        /// <summary>
        /// Get a list of recently created contacts
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="opts">Request options</param>
        /// <returns></returns>
        public ContactListHubSpotModel <T> RecentlyCreated <T>(ListRecentRequestOptions opts = null) where T : ContactHubSpotModel, new()
        {
            if (opts == null)
            {
                opts = new ListRecentRequestOptions();
            }

            var path = $"{new ContactHubSpotModel().RouteBasePath}/lists/all/contacts/recent"
                       .SetQueryParam("count", opts.Limit);

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

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

            if (!string.IsNullOrEmpty(opts.TimeOffset))
            {
                path = path.SetQueryParam("timeOffset", opts.TimeOffset);
            }

            path = path.SetQueryParam("propertyMode", opts.PropertyMode);

            path = path.SetQueryParam("formSubmissionMode", opts.FormSubmissionMode);

            path = path.SetQueryParam("showListMemberships", opts.ShowListMemberships);

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

            return(data);
        }
Beispiel #2
0
        /// <summary>
        /// Get a list of recently created contacts
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="opts">Request options</param>
        /// <returns></returns>
        public ContactListHubSpotModel <ContactHubSpotModel> RecentlyCreated(ListRecentRequestOptions opts = null)
        {
            opts = opts ?? new ListRecentRequestOptions();

            Url path = GetRoute <ContactHubSpotModel>("lists", "all", "contacts", "recent")
                       .SetQueryParam("count", opts.Limit);

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

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

            if (!string.IsNullOrEmpty(opts.TimeOffset))
            {
                path = path.SetQueryParam("timeOffset", opts.TimeOffset);
            }

            path = path.SetQueryParam("propertyMode", opts.PropertyMode)
                   .SetQueryParam("formSubmissionMode", opts.FormSubmissionMode)
                   .SetQueryParam("showListMemberships", opts.ShowListMemberships);

            return(_client.Execute <ContactListHubSpotModel <ContactHubSpotModel>, ListRecentRequestOptions>(path, opts));
        }
Beispiel #3
0
        /// <summary>
        /// Get a list of recently created contacts
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="opts">Request options</param>
        /// <returns></returns>
        public ContactListHubSpotModel <ContactHubSpotModel> RecentlyCreated(ListRecentRequestOptions opts = null)
        {
            opts = opts ?? new ListRecentRequestOptions();

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

            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}";
            }

            if (!string.IsNullOrEmpty(opts.TimeOffset))
            {
                path = path += $"{QueryParams.TIME_OFFSET}={opts.TimeOffset}";
            }

            path += $"{QueryParams.PROPERTY_MODE}={opts.PropertyMode}"
                    + $"{QueryParams.FORM_SUBMISSION_MODE}={opts.FormSubmissionMode}"
                    + $"{QueryParams.SHOW_LIST_MEMBERSHIPS}={opts.ShowListMemberships}";

            return(_client.Execute <ContactListHubSpotModel <ContactHubSpotModel>, ListRecentRequestOptions>(path, opts));
        }
Beispiel #4
0
        /// <summary>
        /// Get recently updated (or created) contacts
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="opts">Request options</param>
        /// <returns></returns>
        public Task <ContactListHubSpotModel <ContactHubSpotModel> > RecentlyUpdatedAsync(ListRecentRequestOptions opts = null, CancellationToken cancellationToken = default)
        {
            opts = opts ?? new ListRecentRequestOptions();

            Url path = GetRoute <ContactHubSpotModel>("lists", "recently_updated", "contacts", "recent")
                       .SetQueryParam("count", opts.Limit);

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

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

            if (!string.IsNullOrEmpty(opts.TimeOffset))
            {
                path = path.SetQueryParam("timeOffset", opts.TimeOffset);
            }

            path = path.SetQueryParam("propertyMode", opts.PropertyMode)
                   .SetQueryParam("formSubmissionMode", opts.FormSubmissionMode)
                   .SetQueryParam("showListMemberships", opts.ShowListMemberships);

            return(_client.ExecuteAsync <ContactListHubSpotModel <ContactHubSpotModel>, ListRecentRequestOptions>(path, opts, cancellationToken: cancellationToken));
        }