.NET SDK

        Samenvatting van het artikel

        The Buckaroo .NET SDK is a code library that can be used to communicate with the Buckaroo API. It standardizes requests using a fluent interface, which makes it easy to use and guides you through the process of initializing requests. Matters like authentication, signature calculation, logging and generating JSON messages are performed within the SDK and are no longer something a developer needs to worry about.

        Even though use of the SDK is quite straightforward, we have provided some code examples in this section of the development portal.

        Download the library here:


        or here:

        Github - Buckaroo .NET SDK

        SdkClient class setup

        The SdkClient class is the entry point for each request that is performed using the BuckarooSdk. An instance of this object is required by each function in the class. Depending on your implementation it can both be initiated in your class' constructor, or every function can create it's own.

        In the test suite we created to test the SDK for ourself, we create the client in the Setup() method.

        internal SdkClient BuckarooClient { get; private set; }
        public void Setup()
        	this.BuckarooClient = new SdkClient();

        SdkClient logging options

        One use of the SdkClient class is the handling of the logging. The problem with using an external SDK is often that it is hard to understand what exactly happens on the inside. We've tried to make the Buckaroo SDK hard to break, so it doesn't matter what happens within the Buckaroo code. Nonetheless did we create logging functionality. The SDK provides two logging alternatives: Standard and Extensive, but it is also possible to create your own logger using the ILogger interface.

        The Logger can be provided when creating the SdkClient, but also when creating a request. The syntax is a bit different though. For a request you can set the Logger instance as a parameter. When providing the parameter in the SdkClient constructor parameters, you have to provide a function that returns a logger object (Func). This way you can for example set the StandardLogger within the SdkClient, but upgrade to the ExtensiveLogger for a certain request.

        In case no Logger is provided, like in the Setup() method above, the StandardLogger will be used.

        // Example for a function that returns a custom implemented logger, 
        // which can be provided in the constructor  like this: 
        // this.BuckarooClient = new SdkClient(TestSettings.Logger);
        internal static Func<ILogger> Logger
        	get { return () => new CustomImplementationLogger(); }		

        Was dit artikel nuttig?