Example #1
0
        /// <summary>
        /// Gets a list of recently modified 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 DealRecentListHubSpotModel <T> RecentlyUpdated <T>(DealRecentRequestOptions opts = null) where T : DealHubSpotModel, new()
        {
            if (opts == null)
            {
                opts = new DealRecentRequestOptions();
            }

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

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

            if (opts.IncludePropertyVersion)
            {
                path = path.SetQueryParam("includePropertyVersions", "true");
            }

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

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

            return(data);
        }
Example #2
0
        /// <summary>
        /// Gets a list of recently modified 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 DealRecentListHubSpotModel <DealHubSpotModel> RecentlyUpdated(DealRecentRequestOptions opts = null)
        {
            opts = opts ?? new DealRecentRequestOptions();

            string path = GetRoute <DealRecentListHubSpotModel <DealHubSpotModel> >("deal", "recent", "modified");

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

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

            if (opts.IncludePropertyVersion)
            {
                path += $"{QueryParams.INCLUDE_PROPERTY_VERSIONS}=true";
            }

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

            return(_client.Execute <DealRecentListHubSpotModel <DealHubSpotModel>, DealRecentRequestOptions>(path, opts));
        }
        /// <summary>
        /// Gets a list of recently modified 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 DealRecentListHubSpotModel <DealHubSpotModel> RecentlyUpdated(DealRecentRequestOptions opts = null)
        {
            opts = opts ?? new DealRecentRequestOptions();

            var path = $"{GetRoute<DealRecentListHubSpotModel<DealHubSpotModel>>()}/deal/recent/modified"
                       .SetQueryParam("limit", opts.Limit);

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

            if (opts.IncludePropertyVersion)
            {
                path = path.SetQueryParam("includePropertyVersions", "true");
            }

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

            return(_client.Execute <DealRecentListHubSpotModel <DealHubSpotModel>, DealRecentRequestOptions>(path, opts));
        }
        /// <summary>
        /// Gets a list of recently created 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 Task <DealRecentListHubSpotModel <DealHubSpotModel> > RecentlyCreatedAsync(DealRecentRequestOptions opts = null, CancellationToken cancellationToken = default)
        {
            opts = opts ?? new DealRecentRequestOptions();

            Url path = $"{GetRoute<DealRecentListHubSpotModel<DealHubSpotModel>>()}/deal/recent/created"
                       .SetQueryParam("limit", opts.Limit);

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

            if (opts.IncludePropertyVersion)
            {
                path = path.SetQueryParam("includePropertyVersions", "true");
            }

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

            return(_client.ExecuteAsync <DealRecentListHubSpotModel <DealHubSpotModel>, DealRecentRequestOptions>(path, opts, cancellationToken: cancellationToken));
        }