intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 53 forks source link

Fix paginated contact list deserialization #161

Closed iPlexor closed 3 years ago

iPlexor commented 4 years ago

Why?

Fixes Issue #160 ContactsClient.List() returns JSON that can't be deserialized. Specifically, the next object:

{
    "type": "list",
    "data": [ ],
    "pages": {
        "type": "pages",
        "next": {
            "page": 2,
            "starting_after": "WzE1ODk0NjU0NTkwMDAsIjVjOTBjYTg0NjQxNjBjMTc2OTFmOThhZiIsMl0="
        },
        "page": 1,
        "per_page": 10,
        "total_pages": 27
    }
}

How?

This PR adds Next.cs and uses it instead of a string for the type of next in Pages.cs

iPlexor commented 4 years ago

It looks like the UserConversationsClient.List() and AdminConversationsClient.List() responses actually return next as a string, meaning this PR will break deserialization of those lists.

Looks like the API is serving two different models of Pages, which is incompatible with the shared Pages data structure of intercom-dotnet.