/// <summary> /// Lists recent engagements (i.e. in date order) /// </summary> /// <param name="opts">Options for querying</param> /// <returns>List of engagements, with additional metadata, e.g. total</returns> public EngagementListHubSpotModel<T> ListRecent<T>(EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>()}/engagements/recent/modified".SetQueryParam("count", opts.Limit); if (opts.Offset.HasValue) path = path.SetQueryParam("offset", opts.Offset); return _client.Execute<EngagementListHubSpotModel<T>, EngagementListRequestOptions>(path, opts); }
/// <summary> /// Retrieves a paginated list of engagements /// </summary> /// <param name="opts">Options for querying</param> /// <returns>List of engagements, with additional metadata, e.g. total</returns> public EngagementListHubSpotModel <T> List <T>(EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>("paged")}".SetQueryParam("limit", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } return(_client.Execute <EngagementListHubSpotModel <T>, EngagementListRequestOptions>(path, opts)); }
/// <summary> /// Lists recent engagements (i.e. in date order) /// </summary> /// <param name="opts">Options for querying</param> /// <returns>List of engagements, with additional metadata, e.g. total</returns> public Task <EngagementListHubSpotModel <T> > ListRecentAsync <T>(EngagementListRequestOptions opts = null, CancellationToken cancellationToken = default) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>()}/engagements/recent/modified".SetQueryParam("count", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } return(_client.ExecuteAsync <EngagementListHubSpotModel <T>, EngagementListRequestOptions>(path, opts, cancellationToken: cancellationToken)); }
/// <summary> /// Lists recent engagements (i.e. in date order) /// </summary> /// <param name="opts">Options for querying</param> /// <returns>List of engagements, with additional metadata, e.g. total</returns> public EngagementListHubSpotModel <T> ListRecent <T>(EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>()}/engagements/recent/modified?{QueryParams.COUNT}={opts.Limit}"; if (opts.Offset.HasValue) { path += $"{QueryParams.OFFSET}={opts.Offset}"; } return(_client.Execute <EngagementListHubSpotModel <T>, EngagementListRequestOptions>(path, opts)); }
/// <summary> /// Lists recent engagements (i.e. in date order) /// </summary> /// <param name="opts">Options for querying</param> /// <returns>List of engagements, with additional metadata, e.g. total</returns> public EngagementListHubSpotModel <T> ListRecent <T>(EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel, new() { if (opts == null) { opts = new EngagementListRequestOptions(); } var path = $"{new EngagementHubSpotModel().RouteBasePath}/engagements/recent/modified".SetQueryParam("count", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } var data = _client.ExecuteList <EngagementListHubSpotModel <T> >(path, opts, convertToPropertiesSchema: false); return(data); }
/// <summary> /// Lists associated engagements for a given object type and ID /// </summary> /// <param name="objectId">The object ID</param> /// <param name="objectType">The object type, e.g. CONTACT</param> /// <param name="opts">Options used for querying</param> /// <returns>List of associated engagements</returns> public EngagementListHubSpotModel <T> ListAssociated <T>(long objectId, string objectType, EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel, new() { if (opts == null) { opts = new EngagementListRequestOptions(); } var path = $"{new EngagementHubSpotModel().RouteBasePath}/engagements/associated/{objectType}/{objectId}/paged".SetQueryParam("limit", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } var data = _client.ExecuteList <EngagementListHubSpotModel <T> >(path, opts, convertToPropertiesSchema: false); return(data); }
/// <summary> /// Lists associated engagements for a given object type and ID /// </summary> /// <param name="objectId">The object ID</param> /// <param name="objectType">The object type, e.g. CONTACT</param> /// <param name="opts">Options used for querying</param> /// <returns>List of associated engagements</returns> public EngagementListHubSpotModel <T> ListAssociated <T>(long objectId, string objectType, EngagementListRequestOptions opts = null) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>()}/engagements/associated/{objectType}/{objectId}/paged".SetQueryParam("limit", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } return(_client.Execute <EngagementListHubSpotModel <T>, EngagementListRequestOptions>(path, opts)); }
/// <summary> /// Lists associated engagements for a given object type and ID /// </summary> /// <param name="objectId">The object ID</param> /// <param name="objectType">The object type, e.g. CONTACT</param> /// <param name="opts">Options used for querying</param> /// <returns>List of associated engagements</returns> public Task <EngagementListHubSpotModel <T> > ListAssociatedAsync <T>(long objectId, string objectType, EngagementListRequestOptions opts = null, CancellationToken cancellationToken = default) where T : EngagementHubSpotModel { opts = opts ?? new EngagementListRequestOptions(); var path = $"{GetRoute<T>()}/engagements/associated/{objectType}/{objectId}/paged".SetQueryParam("limit", opts.Limit); if (opts.Offset.HasValue) { path = path.SetQueryParam("offset", opts.Offset); } return(_client.ExecuteAsync <EngagementListHubSpotModel <T>, EngagementListRequestOptions>(path, opts, cancellationToken: cancellationToken)); }