Skip to content

Helpers missing array parameters. #382

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

Closed
rburnham52 opened this issue Jan 4, 2017 · 4 comments
Closed

Helpers missing array parameters. #382

rburnham52 opened this issue Jan 4, 2017 · 4 comments
Labels
status: help wanted requesting help from the community type: question question directed at the library

Comments

@rburnham52
Copy link

Issue Summary

The helper classes do not provide an public interface that matches the api documentation.

Steps to Reproduce

In the code sample we use the following lines

` string apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGridAPIClient(apiKey);

        Email from = new Email("[email protected]");
        string subject = "Hello World from the SendGrid CSharp Library!";
        Email to = new Email("[email protected]");
        Content content = new Content("text/plain", "Hello, Email!");
        Mail mail = new Mail(from, subject, to, content);

        dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());`

Email represents a single recipient or sender. Mail represents a the actual message being sent. Mail only has 2 constructors though. A default constructor and this one

public Mail(Email from, string subject, Email to, Content content)

But a message can be sent to multiple recipients. The API documentation represents to as an Array of Email. It seems like the Mail class should contain a constructor overload that takes an array of email instead of one?

Also have you thought about having a constructor overload that takes a .net System.Net.Mail.MailMessage type? not sure what the pros/cons would be though

Technical details:

  • sendgrid-csharp Version: master (latest commit: [commit number])
  • .NET Version: 4.5.2
@thinkingserious
Copy link
Contributor

Hello @Nitro52,

You may have run into this issue: https://github.com/sendgrid/sendgrid-csharp/blob/master/TROUBLESHOOTING.md#missing

Also, this library is currently being rewritten in the v9beta branch and is near beta release, check out the progress here if you like: #331 (comment) We would love to hear your feedback :)

With Best Regards,

Elmer

@thinkingserious thinkingserious added status: help wanted requesting help from the community type: question question directed at the library labels Jan 26, 2017
@rburnham52
Copy link
Author

Hi @thinkingserious
No there were no actual errors, its was just feedback about the fact that the C# sdk did not expose the same public interface that your API does. In this case the Mail class did not allow you to select more than 1 recipient where your API does.

I had a look at the beta and it looks like you've solved this problem. SendGridMessage is the new replacement to the Mail class i assume? it seems a bit cleaner and allows you to add multiple recipients via the AddTos method.

@rburnham52
Copy link
Author

@thinkingserious one more comment about the new beta release, I noticed that it will support .net core. I had an issue with another library recently that meant i could not use nuget to install it. This was because it depended on System.Net.Http 4.0.x which. This version requires nuget 3.0 and if your using Visual Studio 2013 you can not upgrade nuget to 3.0. It seems you have the same dependency, So you will probably need VS 2015 + to manage the sendgrid dependency via nuget.

Here is the original issue i had Jericho/StrongGrid#109 (comment)

@thinkingserious
Copy link
Contributor

@Nitro52,

Yes, the new v9 of this library should help achieve your use case.

With regards to the Nuget issue, could you please create a new issue here?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: question question directed at the library
Projects
None yet
Development

No branches or pull requests

2 participants