UltimoSDK 1.4.0

dotnet add package UltimoSDK --version 1.4.0
                    
NuGet\Install-Package UltimoSDK -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UltimoSDK" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UltimoSDK" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="UltimoSDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add UltimoSDK --version 1.4.0
                    
#r "nuget: UltimoSDK, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package UltimoSDK@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=UltimoSDK&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=UltimoSDK&version=1.4.0
                    
Install as a Cake Tool

Introduction

This is a package to help develop against the Ultimo API in C#.

Install

To use this package you need to install it with npm, or download the repo and add the code to your project.

Usage

To use this SDK, there are a few steps to follow

Create a client

To create a client all you need is an api key and a portal uri like so

// Do make sure to add the v1/object to this uri
UltimoClient client = new(new Uri("https://www.portalUri.com"), "apiKey");

Execute requests

Once a client has been created you can start to execute request, this will show an example of how to get a list of jobs with a filter

Get a list of jobs

UltimoListRequestData requestData = new()
{
    // This is one way to do it
    Filter = "Id eq \"0002\""

    // we could also use
    //Filters = new List<string>(){"Id eq \"0002\"", "Second filter"}
    // This uses a custom setter to set the Filter property
};

// Replace the Job with another BaseUltimoItem type and it should work
UltimoResponse<UltimoListResponse<Job>> response = client.GetUltimoListResponse<Job>(requestData, UriAddOn.Job);

Get a single item

UltimoResponse<Job> jobResponse = client.GetSingleItem("itemId", UriAddOn.Job)

Execute your own list request

UltimoListRequestData requestData = new()
{
    // This is one way to do it
    Filter = "Id eq \"0002\""

    // we could also use
    //Filters = new List<string>(){"Id eq \"0002\"", "Second filter"}
    // This uses a custom setter to set the Filter property
};
UltimoResponse<UltimoListResponse<Job>> response = client.Execute<UltimoListResponse<Job>>(requestData, "Job")
// Replace "Job" with endpoint add on e.g "ProcessFunction"
// Or use the UriAddOn enum instead

Read data or error from request

Once the response object has been obtained we can start to extract data from the response

Read data from UltimoResponse

if(response.Error != null || response.Result == null){
    Console.WriteLine($"Request failed because of empty result or with message {response.Error.Message}");
    return;
}

Job job = response.Result;
// Do something with the job

Read data from UltimoResponse<UltimoListResponse>

if(response.Error != null){
    Console.WriteLine($"Request to Ultimo failed with message: {response.Error.Message}");
    return;
}

foreach(JToken item in response.Result.Items){
    // Do something with item
}

(Optional) Create Request data or Response data

If you want the SDK to return a specific type of item you can create your own data model for the response or request data with some limitations

Create your own response type

To create your own response type, you can pass it along in the UltimoListResponse or create a class that implements UltimoResponse

Example 1, using UltimoListResponse
// Create model class
public class UltimoExampleResponse{
        // Make sure to use the JsonProperty attribute,
        [JsonProperty("jsonPropertyName")] // e.g "id"
        public string? Id { get; set; }

        // To ignore a property use the JsonIgnore attribute
        [JsonIgnore]
        public int example = 5
}
// Execute the request as normal except that the type is given along with the UltimoListResponse Type
UltimoResponse<UltimoListResponse<UltimoExampleResponse>> response = await client.ExecuteAsync<UltimoListResponse<UltimoExampleResponse>>(requestData, "Job");

// Now we can access the UltimoExample response item list again
// foreach(UltimoExampleResponse data in response.Items)
//{ Do something }
Example 2, creating a custom item response
// we use the UltimoExampleResponse class from the previous example
UltimoResponse<UltimoExampleResponse> response = client.Execute<UltimoExampleResponse>(requestData, UriAddOn.Job);
Example 3, Implementing BaseUltimoItem

The BaseUltimoItem class has a few properties found in most ultimo responses.
Such as but not limited to Context, GeocodeX and -Y and Id.

Creating a request using this can be done by simply implementing the class

public class Example : BaseUltimoItem
{
    [JsonAttribute("Example")]
    public string? Example { get; set; }
}

// Now we can use this class to convert responses into ultimo items
UltimoResponse<Example> response = client.GetSingleItem("itemId", "Custom endpoint")

Create request data

To create a different type of request data we implement the IUltimoRequestData interface This is just an empty interface, so the request can be any class that implements this empty interface.

// Create model class
public class UltimoExampleRequestData : IUltimoRequestData{
        // Make sure to use the JsonProperty attribute,
        [JsonProperty("jsonPropertyName")] // e.g "id"
        public string? Id { get; set; }

        // Make sure to use the JsonIgnore attribute on properties to ignore
        [JsonIgnore]
        public string? IgnoreMe { get; set; }
}

UltimoExampleRequestData requestData = new(){
    Id = "ExampleId"
};

// Execute request with new params
UltimoListResponse response = await client.ExecuteAsync<UltimoListResponse, UltimoExampleRequestData>(requestData, "Job");
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.0 192 4/14/2025
1.3.1 171 3/19/2025
1.3.0 148 3/19/2025
1.2.0 145 3/18/2025
1.1.0 116 3/14/2025
1.0.0 110 3/14/2025

1.0.0 Created client
1.1.0 Added BaseUltimoItem and Job Data models
1.2.0 Added single item support
1.3.0 Added header support and RestRequest support
1.3.3 Fixed bug with uri
1.4.0 - Improved Async and Body support.
- Improved the ultimo list response to use the length of the list when no count is returned from the response.
- Improved uri handling
- Updated Readme