-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added get list of contact lists (#63)
Add HubSpotListOfContactsClient.cs
- Loading branch information
1 parent
6f2835a
commit 016fda1
Showing
4 changed files
with
162 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using Newtonsoft.Json; | ||
using Skarp.HubSpotClient.Core.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
|
||
namespace Skarp.HubSpotClient.ListOfContacts.Dto | ||
{ | ||
public class ListOfContactListsHubSpotEntity: IHubSpotEntity | ||
{ | ||
[DataContract(Name="MetaData")] | ||
public class ContactListsMetaData | ||
{ | ||
[DataMember(Name="processing")] | ||
public string Processing { get; set; } | ||
[DataMember(Name="size")] | ||
public int Size { get; set; } | ||
[DataMember(Name="error")] | ||
public string Error { get; set; } | ||
[DataMember(Name="lastProcessingStateChangeAt")] | ||
public long LastProcessingStateChangeAtTimeStamp { get; set; } | ||
[DataMember(Name="lastSizeChangeAt")] | ||
public long LastSizeChangeAtTimeStamp { get; set; } | ||
} | ||
|
||
[DataContract(Name="List")] | ||
public class ContactListsItem | ||
{ | ||
[DataMember(Name="dynamic")] | ||
public bool Dynamic { get; set; } | ||
[DataMember(Name="metaData")] | ||
public ContactListsMetaData MetaData { get; set; } | ||
[DataMember(Name="name")] | ||
public string Name { get; set; } | ||
[DataMember(Name="filters")] | ||
public List<List<ContactListsFilter>> Filters { get; set; } | ||
[DataMember(Name="portalId")] | ||
public int PortalId { get; set; } | ||
[DataMember(Name="createdAt")] | ||
public long CreatedAtTimeStamp { get; set; } | ||
[DataMember(Name="listId")] | ||
public int ListId { get; set; } | ||
[DataMember(Name="updatedAt")] | ||
public long UpdatedAtTimeStamp { get; set; } | ||
[DataMember(Name="listType")] | ||
public string ListType { get; set; } | ||
[DataMember(Name="internalListId")] | ||
public int InternalListId { get; set; } | ||
[DataMember(Name="deleteable")] | ||
public bool Deleteable { get; set; } | ||
} | ||
|
||
[DataContract(Name="filter")] | ||
public class ContactListsFilter | ||
{ | ||
[DataMember(Name="filterFamily")] | ||
public string FilterFamily { get; set; } | ||
[DataMember(Name="withinTimeMode")] | ||
public string WithinTimeMode { get; set; } | ||
[DataMember(Name="checkPastVersions")] | ||
public bool CheckPastVersions { get; set; } | ||
[DataMember(Name="type")] | ||
public string Type { get; set; } | ||
[DataMember(Name="property")] | ||
public string Property { get; set; } | ||
[DataMember(Name="value")] | ||
public string Value { get; set; } | ||
[DataMember(Name = "operator")] | ||
public string op { get; set; } | ||
} | ||
|
||
|
||
public List<ContactListsItem> lists { get; set; } | ||
public int offset { get; set; } | ||
|
||
[DataMember(Name = "has-more")] | ||
public bool HasMore { get; set; } | ||
|
||
public bool IsNameValue => false; | ||
|
||
public virtual void ToHubSpotDataEntity(ref dynamic dataEntity) | ||
{ | ||
|
||
} | ||
|
||
public virtual void FromHubSpotDataEntity(dynamic hubspotData) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
|
||
namespace Skarp.HubSpotClient.ListOfContacts | ||
{ | ||
public class ListOfContactListsRequestOptions | ||
{ | ||
private int _numberOfContactListsToReturn = 100; | ||
|
||
/// <summary> | ||
/// Gets or sets the number of contact lists to return. | ||
/// </summary> | ||
/// <remarks> | ||
/// Defaults to 20 which is also the hubspot api default. Max value is 100 | ||
/// </remarks> | ||
/// <value> | ||
/// The number of contacts to return. | ||
/// </value> | ||
public int NumberOfContactListsToReturn | ||
{ | ||
get => _numberOfContactListsToReturn; | ||
set | ||
{ | ||
if (value < 1 || value > 250) | ||
{ | ||
throw new ArgumentException( | ||
$"Number of contacts to return must be a positive ingeteger greater than 0 and less than 251 - you provided {value}"); | ||
} | ||
_numberOfContactListsToReturn = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Get or set the continuation offset when calling list many times to enumerate all your contact lists | ||
/// </summary> | ||
/// <remarks> | ||
/// The return DTO from List contains the current "offset" that you can inject into your next list call | ||
/// to continue the listing process | ||
/// </remarks> | ||
public long? ContactListOffset { get; set; } = null; | ||
} | ||
} |