Skip to content

Vorboss/product-availability-api-csharp-dotnet2-client

Repository files navigation

Com.Vorboss.ProductAvailability - the C# library for the Vorboss Product Availability API

This API is provided by Vorboss to allow customers to check which products are available at a given postcode.

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: 0.2.0
  • SDK version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.dotnet.CsharpDotNet2ClientCodegen

Frameworks supported

  • .NET 2.0

Dependencies

  • Mono compiler
  • Newtonsoft.Json.7.0.1
  • RestSharp.Net2.1.1.11

Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh compile-mono.sh
  • [Windows] ./Install.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Com.Vorboss.ProductAvailability.Api;
using Com.Vorboss.ProductAvailability;
using Com.Vorboss.ProductAvailability.Model;

Getting Started

using System;
using System.Diagnostics;
using Com.Vorboss.ProductAvailability;
using Com.Vorboss.ProductAvailability.Model;
using Com.Vorboss.ProductAvailability.Api;


namespace MyConsoleApp
{
    class Program
    {
        private const string ApiKey = "MY_VORBOSS_API_KEY";

        static void Main(string[] args)
        {
            ApiClient client = new ApiClient("https://api.vorboss.com/");
            client.AddDefaultHeader("Authorization", "Bearer " + ApiKey);
            var apiInstance = new ProductAvailabilityApi(client);

            var postcode = "EC2A2BS";  // string | UK Postcode to check availability for.

            try
            {
                // Check a postcode
                Postcode result = apiInstance.ConfirmPostcode(postcode);
                Console.WriteLine(result);

                foreach (PostcodeAvailableProducts product in result.AvailableProducts)
                {
                    Console.WriteLine("Product Name: " + product.Name);
                    Console.WriteLine("Product Lead Time: " + product.LeadTimeDays);
                    Console.WriteLine("Product Price: " + product.Price);
                    Console.WriteLine("Product Provisioned Bandwidth: " + product.BandwidthProvisioned);
                    Console.WriteLine();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling ProductAvailabilityApi.ConfirmPostcode: " + e.Message );
            }
        }
    }
}

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
ProductAvailabilityApi ConfirmPostcode GET /product-availability/postcode/{postcode} Check a postcode

Documentation for Models

Documentation for Authorization

bearerAuth