Official .NET SDK for the Neo-EDI platform
License
—
Deps
3
Install Size
—
Vulns
✓ 0
Published
Jan 16, 2026
$ dotnet add package NeoEdi.SdkOfficial .NET SDK for the Neo-EDI platform.
dotnet add package NeoEdi.Sdk
using NeoEdi.Sdk;
using NeoEdi.Sdk.Models;
var client = new NeoEdiClient(new NeoEdiClientOptions
{
BaseUrl = "https://api.neo-edi.com",
ApiKey = "nedk_xxxxxxxxxxxx"
});
// List customers
var customers = await client.Customers.ListAsync(new ListCustomersParams { IsActive = true });
// Create a customer
var customer = await client.Customers.CreateAsync(new CreateCustomerRequest
{
CustomerName = "Acme Corporation"
});
// Get a customer
var existing = await client.Customers.GetAsync("ACME-001");
// Get customer by identifier (e.g., EXTERNAL, GLN, DUNS)
var byExternal = await client.Customers.GetByIdentifierAsync(
CustomerIdentifierType.EXTERNAL, "EXT-12345");
// Update a customer
var updated = await client.Customers.UpdateAsync("ACME-001", new UpdateCustomerRequest
{
CustomerName = "Acme Corp"
});
// Delete a customer
await client.Customers.DeleteAsync("ACME-001");
// Link existing customer as sub-customer
var result = await client.SubCustomers.AddAsync("PARENT-001", "CHILD-001");
// Returns: { HierarchyId, ParentCustomerId, ChildCustomerId, Created, Activated }
// Create a new sub-customer under a parent
var newSub = await client.SubCustomers.CreateAsync("PARENT-001", new CreateSubCustomerRequest
{
CustomerName = "New Store Location",
AccountNumber = "STORE-123", // Optional: creates an EXTERNAL identifier
IsActive = true // Optional: defaults to true
});
// Returns: { HierarchyId, ParentCustomerId, ChildCustomerId, ChildCustomerName, Identifier?, Created }
// List sub-customers
var subs = await client.SubCustomers.ListAsync("PARENT-001");
// Include inactive relationships
var allSubs = await client.SubCustomers.ListAsync("PARENT-001", includeInactive: true);
// List sub-customers with their identifiers
var subsWithIds = await client.SubCustomers.ListWithIdentifiersAsync("PARENT-001");
// Returns List<SubCustomerWithIdentifiers> with Identifiers array for each sub-customer
// Remove sub-customer relationship
await client.SubCustomers.RemoveAsync("PARENT-001", "CHILD-001");
// List all partners
var partners = await client.Partners.ListAsync();
// List only active partners
var activePartners = await client.Partners.ListAsync(new ListPartnersParams { ActiveOnly = true });
// Get a partner
var partner = await client.Partners.GetAsync("PARTNER-001");
// Create a partner
var newPartner = await client.Partners.CreateAsync(new CreatePartnerRequest
{
PartnerId = "WALMART",
PartnerName = "Walmart",
Email = "edi@walmart.com",
Phone = "+15551234567",
Address = new Address
{
Street = "702 SW 8th St",
City = "Bentonville",
State = "AR",
Zip = "72712",
Country = "USA"
}
});
// Update a partner
var updated = await client.Partners.UpdateAsync("WALMART", new UpdatePartnerRequest
{
PartnerName = "Walmart Inc."
});
// Delete (soft delete) a partner
await client.Partners.DeleteAsync("WALMART");
// List all mapping templates
var templates = await client.MappingTemplates.ListAsync();
// Filter templates
var filtered = await client.MappingTemplates.ListAsync(new ListMappingTemplatesParams
{
TargetTable = "edi_852_items",
IsPublic = true
});
// Get a template by ID
var template = await client.MappingTemplates.GetAsync("template-001");
// Create a mapping template
var newTemplate = await client.MappingTemplates.CreateAsync(new CreateMappingTemplateRequest
{
Name = "852 Item Import",
TargetTable = "edi_852_items",
MappingConfig = new Dictionary<string, object>
{
["upc"] = "UPC_CODE",
["quantity"] = "QTY_ON_HAND"
},
Tags = ["852", "inventory"]
});
// Update a template
var updated = await client.MappingTemplates.UpdateAsync("template-001", new UpdateMappingTemplateRequest
{
Name = "Updated Template Name"
});
// Delete a template
await client.MappingTemplates.DeleteAsync("template-001");
// Upload and ingest a CSV file
using var fileStream = File.OpenRead("data.csv");
var result = await client.Ingest.UploadCsvAsync(fileStream, "data.csv", new IngestCsvOptions
{
PartnerId = "PARTNER-001",
MappingConfig = new CsvHeaderMappingCollection
{
Id = "mapping-001",
Version = 1,
Tables = new Dictionary<string, CsvHeaderTableEntry>
{
["edi_852_items"] = new CsvHeaderTableEntry
{
BatchSize = 1000,
Mapping = new Dictionary<string, object>
{
["upc"] = "UPC_CODE",
["quantity_on_hand"] = "QTY"
},
Defaults = new Dictionary<string, string>()
}
}
}
});
Console.WriteLine($"Processed {result.Stats.ProcessedRows} rows");
// Perform a dry run (validation only, no data changes)
using var testStream = File.OpenRead("test.csv");
var dryResult = await client.Ingest.DryRunAsync(testStream, "test.csv", options);
if (!dryResult.Valid)
{
foreach (var error in dryResult.Errors)
{
Console.WriteLine($"Row {error.Row}: {error.Message}");
}
}
// Get all identifier patterns for a partner
var patterns = await client.IdentifierMappings.GetAsync("PARTNER-001");
// Get patterns for a specific customer
var customerPatterns = await client.IdentifierMappings.GetForCustomerAsync("PARTNER-001", "CUST-001");
// Add a pattern
await client.IdentifierMappings.AddAsync("PARTNER-001", new IdentifierPattern
{
Pattern = @"^ACME-\d+$",
CustomerId = "CUST-001",
Priority = 10
});
// Remove a pattern
await client.IdentifierMappings.RemoveAsync("PARTNER-001", @"^ACME-\d+$");
The SDK provides LINQ-style queries for all GraphQL operations.
// Query with filtering and projection
var headers = await client.GraphQL.Edi852Headers()
.Where(h => h.Status == "pending" && h.VendorPartnerId == "PARTNER-001")
.Select(h => new { h.Id, h.DocumentId, h.ReportDate, h.TotalItems })
.ToListAsync();
// Include nested locations
var headersWithLocations = await client.GraphQL.Edi852Headers()
.Where(h => h.VendorPartnerId == "PARTNER-001")
.Include(h => h.Locations)
.Take(10)
.ToListAsync();
// Nested includes with items
var full = await client.GraphQL.Edi852Headers()
.Include(h => h.Locations, loc => loc.Include(l => l.Items))
.FirstOrDefaultAsync();
// Get single header by ID (includes locations and items)
var header = await client.GraphQL.GetEdi852HeaderByIdAsync("header-id");
// Get header by document details
var header = await client.GraphQL.GetEdi852HeaderByDocumentDetailsAsync(
documentId: "DOC123",
customerId: "CUST-001",
partnerId: "PARTNER-001");
// Query locations for a header
var locations = await client.GraphQL.Edi852Locations()
.ForHeader("header-id")
.IncludeItems()
.Take(100)
.ToListAsync();
// Get single location by ID (includes items)
var location = await client.GraphQL.GetEdi852LocationByIdAsync("location-id");
// Query items for a location
var items = await client.GraphQL.Edi852Items()
.ForLocation("location-id")
.Select(i => new { i.Id, i.Upc, i.QuantityOnHand })
.Take(50)
.ToListAsync();
// Get single item by ID
var item = await client.GraphQL.GetEdi852ItemByIdAsync("item-id");
// Query delivery summaries by date range
var summaries = await client.GraphQL.Edi852DeliverySummaries()
.ForPartners("PARTNER-001", "PARTNER-002")
.ForCustomer("CUST-001") // optional
.InDateRange("2024-01-01", "2024-12-31")
.Take(100)
.ToListAsync();
// Query execution details
var executions = await client.GraphQL.TradingPartnerExecutions()
.Where(e => e.TradingPartnerId == "PARTNER-001")
.Take(50)
.ToListAsync();
// Query execution summaries
var summaries = await client.GraphQL.TradingPartnerExecutionSummaries()
.ToListAsync();
// Get partner IDs for a customer
var partnerIds = await client.GraphQL.CustomerPartnerIds()
.ForCustomer("CUST-001")
.IncludeInactive() // optional
.ToListAsync();
| Method | Description |
|---|---|
.Where(predicate) | Filter using expressions (==, !=, &&) |
.Select(selector) | Project to anonymous/named types |
.Include(nav) | Include nested navigation properties |
.Take(n) | Limit results |
.ToListAsync() | Execute and return list |
.FirstOrDefaultAsync() | Execute and return first or null |
Register the client in Program.cs:
using NeoEdi.Sdk.DependencyInjection;
// Option 1: Configure inline
builder.Services.AddNeoEdiClient(options =>
{
options.BaseUrl = "https://api.neo-edi.com";
options.ApiKey = "nedk_xxxxxxxxxxxx";
});
// Option 2: From configuration
builder.Services.AddNeoEdiClient(builder.Configuration.GetSection("NeoEdi"));
With appsettings.json:
{
"NeoEdi": {
"BaseUrl": "https://api.neo-edi.com",
"ApiKey": "nedk_xxxxxxxxxxxx"
}
}
Then inject INeoEdiClient in your services:
public class CustomerService
{
private readonly INeoEdiClient _client;
public CustomerService(INeoEdiClient client)
{
_client = client;
}
public async Task<EdiCustomer?> GetCustomerAsync(string id)
{
return await _client.Customers.GetAsync(id);
}
}
try
{
var customer = await client.Customers.GetAsync("non-existent");
}
catch (NeoEdiException ex)
{
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Status Code: {ex.StatusCode}");
}