svix / svix-docs

Documentation for the Svix libraries and CLI

Home Page:https://docs.svix.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C# examples does not compile when creating a client

whyer opened this issue · comments

In all examples for C# you have the following code:
var svix = new SvixClient(apiKey, new SvixOptions("https://api.svix.com"));

but that does not compile:

error CS0121: The call is ambiguous between the following methods or properties: 'SvixClient.SvixClient(string, ISvixOptions, ILogger, IApplicationApi, IAuthenticationApi, IEndpointApi, IEventTypeApi, IHealthApi, IIntegrationApi, IMessageApi, IMessageAttemptApi)' and 'SvixClient.SvixClient(string, ISvixOptions, ILogger)'

This code does compile:

// Send in some implementation of ILogger
var svix = new SvixClient(apiKey, new SvixOptions("https://api.svix.com"), logger);

// or NULL - we cannot omit the argument
var svix = new SvixClient(apiKey, new SvixOptions("https://api.svix.com"), null);

It may be a better idea to change the signature of the SwixClient class constructor to allow it to be created without the logger.

But as it is right now the examples cannot be copied and paste as is.

Oh, I thought we made them optional, but I guess we haven't! Would you mind opening a ticket on https://github.com/svix/svix-webhooks to make it optional? I'd love someone from the team to take a look. I think it's a better solution than updating the docs if we can be quick enough.

I'm sorry for the rough edges with the C# experience. The library was completely done with a 3rd party contributor while the docs were done by us, so it looks like there may have been a bit of confusion on our end on some of the function signatures.

Thanks for closing this!