Skip to content
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

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

Open
JakubHolovsky opened this issue Apr 22, 2024 · 1 comment
Assignees
Labels
type: getting started question while getting started

Comments

@JakubHolovsky
Copy link

JakubHolovsky commented Apr 22, 2024

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
    --
@sbansla
Copy link
Contributor

sbansla commented Apr 23, 2024

Hi,
I will check this issue.

@sbansla sbansla self-assigned this Apr 23, 2024
@sbansla sbansla added the type: getting started question while getting started label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: getting started question while getting started
Projects
None yet
Development

No branches or pull requests

2 participants