Skip to content

Using the Bizzkit SDKs

All Bizzkit applications utilize a default REST API, compliant with the Swagger/OpenAPI standards. This API allows you to experiment with various methods and observe the models for all requests and responses. To facilitate seamless integration, we offer NuGet packages, alongside a TypeScript NPM package specifically designed for Ecommerce Search, which assist you in interfacing with our APIs.

SDK packages

Our SDK packages can be acquired via our Bizzkit Partner feed. To gain access to these packages, credentials can be obtained from your Bizzkit contact.

NuGet packages

These packages primarily consist of auto-generated Swagger clients, and an factory class designed to streamline the authentication process.

All SDK package names start with the prefix Bizzkit.Sdk., and the SDK packages incorporate the following elements:

  • A client factory
  • A dedicated client
  • Options to configure the client factory

Info

The package Bizzkit.Sdk.Search.Authenticated contains tools for using the authentication in Bizzkit.Sdk.Search.

Factory client

To simplify the authentication process, all NuGet packages associated with Bizzkit applications come with a factory class. This class streamlines the creation of an authenticated Swagger-generated client. Below is a demonstration of how to establish an SDK client:

// Example getting an iam client
public async static Task<IIamClient> GetIamClientFactory()
{
    var iamConnectionOptions = new IamConnectionOptions
    {
        BaseUrl = "...",
        Authority = "...",
        ClientId = "...",
        ClientSecret = "...",
        Scope = "...",
    };
    return new IamClientFactory(options);
}

// Example setting up an iam client factory in DI
public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    var iamConnectionOptions = new IamConnectionOptions
    {
        BaseUrl = "...",
        Authority = "...",
        ClientId = "...",
        ClientSecret = "...",
        Scope = "...",
    };
    services.AddSingleton<IIamClientFactory>(new IamClientFactory(iamConnectionOptions));
  }
}

The settings given are:

  • BaseUrl: URL of the API.
  • Authority: URL of Bizzkit Auth.
  • Scope: Name of the API, should normally not be overwritten.
  • ClientId: Id of the client.
  • ClientSecret: Secret of the client.

Info

Read about IAM here.

Using the client

Clients should be created through the client factory.

// Example of usage
try
{
  var client = await clientFactory.CreateAuthenticatedClientAsync().ConfigureAwait(false);
  var result = await client.CallSomeApiEndpoint(request);
  return result;
}
catch (ApiException e)
{
  throw;
}

Note

It's important to note that clients are not designed to be maintained for prolonged reuse. If held onto for later use, the client will ultimately reach its expiration.

Restoring packages from the feed

In order to restore NuGet packages from the Bizzkit partner feed you can use configuration file or Visual Studio.

Using a configuration file

Add a nuget.config file to your project, in the same folder as your .csproj or .sln file.

1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="bizzkit-partner-feed" value="https://pkgs.dev.azure.com/bizzkit-platform/7dad82b4-f2ae-4a3a-ab87-3fc791e4ea62/_packaging/bizzkit-partner-feed/nuget/v3/index.json" />
  </packageSources>
</configuration>

After that you can restore packages by running:

dotnet restore

or

nuget.exe restore

Using Visual Studio

On the Tools menu, select Options > NuGet Package Manager > Package Sources. Select the green plus in the upper-right corner and enter the name and source URL below.

Name

bizzkit-partner-feed

Source

https://pkgs.dev.azure.com/bizzkit-platform/7dad82b4-f2ae-4a3a-ab87-3fc791e4ea62/_packaging/bizzkit-partner-feed/nuget/v3/index.json

Note

You need to do this on every machine that needs access to your packages. Use the configuration file instructions if you want to complete setup once and check it into your repository.

NPM packages

The Ecommerce Search SDK includes an automated TypeScript client. This client is designed to facilitate direct search capabilities on the frontend interface. To use it, visit the Bizzkit Partner feed. There, click on @bizzkit/ecommerce-search@[version] and select 'Connect to Feed'. You'll find detailed instructions on how to obtain an access token.

Creating a client

Here is an example of using the Ecommerce Search Typescript client:

import { Client } from "@bizzkit/ecommerce-search";
const searchClient = new Client({ baseUrl: "..." });

The baseUrl is the URL of the Ecommerce Search API.

Using the client

After creating the client it can be used like:

1
2
3
4
5
6
7
8
let response = await searchClient.skus.getSkus(
{
  segmentId: "...",
  scopeId: "...",
  numberOfResults: 100,
  offset:0});

console.log(response.data.skus)

Install the package

In order to install any of the Bizzkit packages the NPM registry should be configured.

To configure it on a project level create an .npmrc file in the root of the project and add:

registry=https://pkgs.dev.azure.com/bizzkit-platform/7dad82b4-f2ae-4a3a-ab87-3fc791e4ea62/_packaging/bizzkit-partner-feed/npm/registry/

or place the file in the users directory %userprofile% for Windows.

After the NPM registry is set, the Search client can be installed by running:

npm install @bizzkit/ecommerce-search@latest