Skip to content

ListEntitlements method fails to deserialize the response data #853

@jweber

Description

@jweber

Describe the bug

When calling the ListEntitlements method, the client returns a Pager<Entitlements> instead of a Pager<Entitlement> object. This causes improper deserialization of the response and fails to return the Entitlement data for an Account.

To Reproduce

Create an Entitlement, and have it assigned to an Account.

var entitlementPager = client.ListEntitlements("code-...");
var page = entitlementPager.FetchNextPage();
// See that `page.Data` is a `List<Entitlement>`, and that list does not contain the expected Entitlement

Taking the RawResponse of the page, we can manually deserialize it into a Pager<Entitlement> and successfully retrieve the data.

var raw = page.GetResponse().RawResponse;

var restResponse = new RestResponse
{
    Content = raw
};

var deserialized = JsonSerializer.Default.Deserialize<Pager<Recurly.Resources.Entitlement>>(restResponse);

Expected behavior

The client correctly deserializes the response from the API.

Your Environment

  • Which version of this library are you using? 4.58.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions