-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add Svix Api client for csharp #248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IAmArchaic, thanks so much for the contribution, so far looking great, just left a few comments/questions before you move forward with other API tags
I think I got everything you were looking for @svix-frank. If you agree, I'll get started implementing the remaining Api resources. |
💯 @IAmArchaic that was quick! Looks great! |
@svix-frank, I've added Mock and refactored the unit tests to correctly test the Api wrappers without requiring a valid access token/serverUrl. I also started implementing the Application Api resource. Just wanted to open it up to any further comments or recommendations before I continue. |
everything looks great so far! |
Hey @IAmArchaic, any updates? Very much looking forward to having this! :) |
Hey @tasn, I'm expecting to make progress this weekend. Shouldn't have to wait too much longer. lol |
No rush, but also yay! :) Thanks a lot! |
Hey @IAmArchaic, again no rush, but really looking forward to having it. :) |
Hey @tasn, I believe all Api resources have now been implemented. All that should remain are Unit Tests. |
Yay! 😍 Ready to take a look, or do are you still changing things? |
You can certainly take a look/try it out. I'm planning to do a second-pass through the API client classes just in case before moving to tests. |
So I tried taking a look, and I don't understand C# at all. :) I can take a look at the tests, but do you have may simple code samples so I can check out the API? Or should I just rely on the tests. |
Right now there are only the tests. They exist to validate that the wrapper created around the generated client is passing the parameters correctly. I can certainly create additional code samples to help! |
I think I can probably figure it out from the tests, but yeah examples always help! |
From what I was able to tell it looks good! Can you please verify and add tests for the verification based on existing Svix signatures (or e.g. ones taken from other examples). Also, can you please rebase on top of main? Excited to get it in! |
\o/ Btw, please rebase when you have a moment (it looks like there aren't any real conflicts). |
Hey @tasn , only a few more test classes to complete. Planning to finish them today! I'll rebase once I'm code complete. |
Thanks a lot! Looking forward to having this in!! 🔥 🔥 🔥 |
Hey @tasn and @svix-frank, I've completed all Api client wrappers and unit tests for each one. There are currently 103 unit tests that validate the Api Wrappers are calling the generated open-api client methods correctly. These changes have also been rebased on main. I haven't had the time to add additional examples, but the unit tests to demonstrate how to use the Csharp lib in its entirety. let me know what you think. |
Looks amazing, I'll take a better look either later today or tomorrow morning! \o/ |
There are some lint errors it seems. |
Want me to fix them for you? |
Hey @tasn , I'm so sorry for missing your messages. I've been busy with work and newborn classes that they slipped through. I can look at fixing them today. |
No rush, just wanted to check on you and see if you need help! |
@tasn , I ran the formatter used in the linter across the project. I think we should be good now. |
Cool, thanks! Letting CI run, let's see! |
Updated Api client error messages
Removed unused Dispose method and unnecessary async - Added missing comma to package.json
…required after rebase
It's in! Yay, thanks a lot! |
You're most welcome! Reach out to me if I can be of further assistance. |
Will do, thanks! |
@IAmArchaic, I just realized we forgot to update the docs with the C# examples! What's the C# equivalent of this JS snippet? import { Svix } from "svix";
const svix = new Svix("AUTH_TOKEN");
const app = await svix.application.create({ name: "Application name" }); We just need this to make sure that we update the docs correctly. |
@tasn, no worry! The equivalent in a .Net 6 console app would be
|
Yay, thanks a lot! :) |
You're welcome. Ping me again if you need something else. |
I'll probably ping you once there's a PR out. :) |
Creating a simple message (updated the www example): using Svix;
using Svix.Model;
using Svix.Models;
var svix = new SvixClient("sk_IrlFPEh3VYctuyHhKTCxamGV", new SvixOptions("https://api.svix.com"));
// Send an event to Rock Inc's webhook endpoints
await svix.Message.CreateAsync(
"app_Xzx8bQeOB1D1XEYmAJaRGoj0",
new MessageIn(
eventType: "user.created",
payload: new {
username = "new_user",
email = "new_user@example.com",
}
),
new MessageCreateOptions {}); |
I just realized something: the functions require passing Options, is it possible to make them have a default value? Can you show me one example of how to change them and I'll change them everywhere? 🙏🏻 |
I also added svix/svix-docs#82 I hope it's correct. :) |
Also added C# examples to https://api.svix.com/docs I hope those are correct too. :P Please let me know if you have any comments. |
@tasn the interface and classes can be updated to assign a default value for the options parameter. Here is an example for the Application Create. Application.cs
IApplication.cs
|
Would |
The csharp live was designed to work with
|
OK, I'll open a PR to add nulls there, thanks! |
If the given |
Sorry for the trouble! |
This is following the discussion in: https://github.com/svix/svix-webhooks/pull/248\#issuecomment-1137223221
No trouble at all, I missed it at review! |
This is following the discussion in: https://github.com/svix/svix-webhooks/pull/248\#issuecomment-1137223221
Motivation
Add Svix Api client support for csharp developers.
Solution
Implemented OpenApi generator for csharp to add generated client to pre-existing csharp Project/Solution. Added a wrapper around generated client to create a facade for an Api consumers.