-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added get list of contact lists #63
Conversation
Added list of contact lists request
Added list of contact lists request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise overall I think it looks good - and thanks for your first PR here on this repo.
There's a few suggestions and issues I think we should get resolved before merging.
Add DataMember attributes, use PascalCase for names and replace generic names with more specific ones to avoid confusion - these are recomendations of @nover
Syntax errors corrected
Change DateTime properties to string because deserialization of .NET type DateTime in WCF requires some more work e.g. the use of attributes [IgnoreDataMember], [OnSerializing] and [OnDeserialized] along with a private property - see https://stackoverflow.com/questions/18511147/change-default-date-serialization-in-wcf. String datestamps can be easily translated to DateTime explicitly by the caller as necessary. Adding DataMember attributes revealed the problem of deserialization of the DateTime properties (but not before runtime) - it caused exceptions where as without the DataMember attribute, the deserialization failure was not notified.
I think this covers all the changes requested by @nover. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Some functional tests and documentation would also be great but those can be added later via another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just now noticed that the CreatedAt
is a string
rather than a DateTime
.
What's keeping us from using a proper DateTime
? @davymirfin
After adding the renaming DataMember attributes I got a runtime error for each of the DateTime properties. I guess it revealed a problem that had always been there but never noticed in my testing. The value comes across as a "ticks" string. I refer to the problem here: I think I must have always used default DateTime serialization/deserialization in the past - I don't remember having problems. I know how to fix it. There are suggestions in this link: So a solution would be something like this: [IgnoreDataMember] [DataMember(Name = "createdAt")] [OnSerializing] [OnDeserialized] Do you know of a better way to to it (I know I can use the getter/setter approach that is also described in the stackoverflow article)? Anyway, to avoid the added complexity I decided to make the properties strings (whose value is the image of the ticks value) and worry about type conversion in the client call. Do you want me to fix it? |
Okay I see - do you have an example response from HubSpot we could have a look at? edit Then one can use |
That is a super suggestion - very quick and very safe. This is an example of the JSON that comes back from HubSpot incidentally: { |
…ged each of their names to inclide the postfix "TimeStamp" to imply to the user that unix epoch is the value.
I've made the change and commited it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
To request a contact list prior to this change it was necessary to know the list's listId. This change enables the API user to discover which lists are available - the information it returns about each list does not include the lists' contents but it does include their names and listIds along with other information about each of the lists.
This is the functionality that this change implements:
https://legacydocs.hubspot.com/docs/methods/lists/get_lists
Closes #62