Skip to content

Repository files navigation

OSDU C# Client

SCM Compliance

This project is a C# client library for OSDU services, automatically generated from OpenAPI specifications using Microsoft Kiota.

It provides typed, async clients for various OSDU core services, allowing for easy integration with OSDU APIs in .NET applications.

Prerequisites

For regenerating clients locally:

  • Kiota CLI

    dotnet tool install --global Microsoft.OpenApi.Kiota
  • Python 3.10+

Installation

The package is published to GitHub Packages.

Add the Equinor NuGet feed (once per machine), then install the package:

dotnet nuget add source "https://nuget.pkg.github.com/equinor/index.json" \
  --name equinor-github \
  --username <your-github-username> \
  --password <your-github-personal-access-token>

dotnet add package Equinor.OsduCsharpClient

The personal access token needs the read:packages scope. Generate one at github.com/settings/tokens.

Quick Start

The OsduClient facade handles auth, token caching, and data-partition-id injection automatically:

using Equinor.OsduCsharpClient.Facade;
using Equinor.OsduCsharpClient.Search.Models;
using Microsoft.Extensions.Configuration;

using var osdu = new OsduClient(OsduConfig.FromConfiguration(builder.Configuration));

var result = await osdu.Search.Query.PostAsync(
    new QueryRequest
    {
        Kind = new QueryRequest.QueryRequest_kind
        {
            QueryRequestKindString = "osdu:wks:work-product-component--WellLog:*"
        },
        Query = "*",
        Limit = 10,
        ReturnedFields = ["id", "kind", "createTime"],
    });

if (result?.Results is not null)
{
    foreach (var record in result.Results)
        Console.WriteLine(record.AdditionalData["id"]);
}

OsduConfig.FromConfiguration(IConfiguration) binds the Osdu section (Server, DataPartitionId, Authority, ClientId, Scopes) from any standard .NET configuration source — appsettings.json, environment variables (Osdu__Server), user secrets, etc. See docs/environment-and-tests.md for setup.

For low-level usage (constructing service clients directly with a raw adapter), see docs/usage.md.

Wellbore DDMS bulk data (well-log curves) can be read and written as Parquet via osdu.WellboreDdmsBulk — including chunked session writes for large datasets. See docs/usage.md.

Typed schema models (optional companion)

This client keeps each record's free-form data block as an UntypedNode, matching the canonical OSDU Map<String, Object> model — a single client cannot hard-code every OSDU kind. When you want intellisense and compile-time types for a specific OSDU kind and version, pair the client with the companion equinor/osdu-csharp-schemas (Equinor.Osdu.Schemas) library. It provides typed POCOs for work-product-component, master-data, and dataset entity types that bridge into a record envelope through the client's ToUntypedNode() / Deserialize<T>() extensions — no changes to the client required.

using V15 = Osdu.Schemas.WorkProductComponent.WellLog.V1_5_0;
using Equinor.OsduCsharpClient.Facade; // ToUntypedNode() / Deserialize<T>()

// Read: envelope from the client, data as a typed schema POCO.
var record = await osdu.WellboreDdms.Ddms.V3.Welllogs[id].GetAsync();
V15.Data data = record.Data.Deserialize<V15.Data>(); // UntypedNode → POCO
Console.WriteLine(data.Name);                         // typed property, not data["name"]

// Write: author the data as a POCO, bridge back to the envelope.
record.Data = data.ToUntypedNode();                   // POCO → UntypedNode

Runnable, end-to-end examples combining both libraries live in the separate equinor/osdu-csharp-samples repository — covering search, get, versioning, reference navigation, bulk-data read/write, and typed WellLog ingestion.

Available Services

Namespace Service
OsduCsharpClient.CrsCatalog CRS Catalog
OsduCsharpClient.CrsConversion CRS Conversion
OsduCsharpClient.Dataset Dataset
OsduCsharpClient.Entitlements Entitlements
OsduCsharpClient.File File
OsduCsharpClient.Geospatial Geospatial
OsduCsharpClient.Indexer Indexer
OsduCsharpClient.Legal Legal
OsduCsharpClient.Notification Notification
OsduCsharpClient.Partition Partition
OsduCsharpClient.Policy Policy
OsduCsharpClient.Register Register
OsduCsharpClient.Schema Schema
OsduCsharpClient.Search Search
OsduCsharpClient.SeismicDdms Seismic DDMS
OsduCsharpClient.Storage Storage
OsduCsharpClient.Unit Unit
OsduCsharpClient.WellboreDdms Wellbore DDMS
OsduCsharpClient.Workflow Workflow

Running Tests

Quick run:

# Run all integration tests
dotnet test OsduCsharpClient.slnx

For configuration setup, optional variables, and detailed test commands, see docs/environment-and-tests.md.

Development

Quick flow:

git clone https://github.com/equinor/osdu-csharp-client.git
cd osdu-csharp-client
python3 generate_all.py
dotnet build OsduCsharpClient.slnx

For release flow, OpenAPI update steps, response media type normalization, client regeneration, and project structure details, see docs/development.md.

Documentation

Related projects

License

Ref. License Information

About

C# client library for OSDU services, generated with Kiota

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages