Skip to content

TrustProductsChannelEndpointAssignmentResource.ReadAsync() doesn't load entities fully #742

@JakubHolovsky

Description

@JakubHolovsky

Issue Summary

When we try to load TrustProduct Channel Endpoint Assignments with limit 1000 it only fully loads 67 records out of 130. If we do a foreach through it - it results in an inconsistent behavior where we cannot rely on the data properties.

We have to resort in doing "ToList()" on the result set to get all the entities fully loaded.

Code Snippet

var incomingPhoneNumbers = await IncomingPhoneNumberResource.ReadAsync(limit: 1000, client: twilioRestClient);

var trustProductAssignments = await TrustProductsChannelEndpointAssignmentResource.ReadAsync(
    new ReadTrustProductsChannelEndpointAssignmentOptions(shakenStirTrustProductSid)
    {
        Limit = 1000
    }, twilioRestClient);

foreach (var number in incomingPhoneNumbers)
{
    if (trusthubAssignments != null && trusthubAssignments.Select(n => n.ChannelEndpointSid).Contains(number.Sid))
        {
             continue; // this will not execute correctly because trusthubAssignments entity is not loaded fully
        }

}

// IF we do this the entities get fully loaded and we don't have the issue - note that this issue is only with TrustProductsChannelEndpointAssignmentResource:

var trustProductAssignments = (await TrustProductsChannelEndpointAssignmentResource.ReadAsync(
    new ReadTrustProductsChannelEndpointAssignmentOptions(shakenStirTrustProductSid)
    {
        Limit = 1000
    }, twilioRestClient)).ToList();

Technical details:

  • twilio-csharp version: 7.0.4
  • csharp version:
    C# 12
    --

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions