twilio / twilio-csharp

Twilio C#/.NET Helper Library for .NET6+.
MIT License
676 stars 301 forks source link

Twillo sample does not work for create Async #417

Closed weedkiller closed 5 years ago

weedkiller commented 6 years ago
    public async Task<MessageResource> SendMessage(string from, string to, string body, List<Uri> mediaUrl, Client client)
        {
            var toPhoneNumber = new PhoneNumber(to);
            return await MessageResource.CreateAsync(
                toPhoneNumber,
                from: new PhoneNumber(from),
                body: body,
                //mediaUrl: mediaUrl,
                client: client);
        }

The sample from twillo above does not work.

image

dubstylee commented 6 years ago

@weedkiller Which version of the API are you using? Make sure to use Twilio.Rest.Api.V2010.Account to use the mediaUrl parameter.

weedkiller commented 6 years ago

@dubstylee I was using latest.

I tried latest download from here, and also saw a nuget. Does not build in VS 2017 targeting 4.71 or 4.72 which ships with Win 10 ENT install since 2018 jan.

thinkingserious commented 5 years ago

Thanks for helping out @dubstylee!

@weedkiller,

Please let me know if you are still having issues and we will re-open.

weedkiller commented 5 years ago

hello both the sample, does not work in 4.8 with progress task, or IProgress report or simply compile because its the old task interface. I posted the picture with the link, but its not resolved yet

childish-sambino commented 5 years ago

What namespace are you using? There are several MessageResource classes defined in the lib under different namespaces. The one you want (that contains the mediaUrl param is under the Twilio.Rest.Api.V2010.Account namespace: https://github.com/twilio/twilio-csharp/blob/master/src/Twilio/Rest/Api/V2010/Account/MessageResource.cs#L204

See the using statements in the example you linked in the description.