MarketSDK 1.0.0
dotnet add package MarketSDK --version 1.0.0
NuGet\Install-Package MarketSDK -Version 1.0.0
<PackageReference Include="MarketSDK" Version="1.0.0" />
<PackageVersion Include="MarketSDK" Version="1.0.0" />
<PackageReference Include="MarketSDK" />
paket add MarketSDK --version 1.0.0
#r "nuget: MarketSDK, 1.0.0"
#:package MarketSDK@1.0.0
#addin nuget:?package=MarketSDK&version=1.0.0
#tool nuget:?package=MarketSDK&version=1.0.0
MarketSdk C# Library
The MarketSdk C# library provides convenient access to the MarketSdk APIs from C#.
Table of Contents
Requirements
This SDK requires:
- .NET 8 and above
- .NET Framework 4.6.2 and above
- .NET Standard 2.0 and above
Installation
dotnet add package MarketSDK
Reference
A full reference for this library is available here.
Usage
Instantiate and use the client with the following:
using MarketSDK;
var client = new MarketSDKClient("TOKEN");
await client.Sellers.CreateSellerAsync(new CreatePartyDto { ExternalId = "external_id" });
Environments
This SDK allows you to configure different environments for API requests.
using MarketSDK;
var client = new MarketSDKClient(clientOptions: new ClientOptions
{
BaseUrl = MarketSDKClientEnvironment.Default
});
Exception Handling
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.
using MarketSDK;
try {
var response = await client.Sellers.CreateSellerAsync(...);
} catch (MarketSDKClientApiException e) {
System.Console.WriteLine(e.Body);
System.Console.WriteLine(e.StatusCode);
// Access the raw HTTP response (status code, URL, headers) off the exception
var rawResponse = e.RawResponse;
if (rawResponse != null)
{
System.Console.WriteLine(rawResponse.Url);
if (rawResponse.Headers.TryGetValue("X-Request-Id", out var requestId))
{
System.Console.WriteLine($"Request ID: {requestId}");
}
}
}
Advanced
Retries
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
Which status codes are retried depends on the retryStatusCodes generator configuration:
legacy (current default): retries on
recommended: retries on
- 408 (Timeout)
- 429 (Too Many Requests)
- 502 (Bad Gateway)
- 503 (Service Unavailable)
- 504 (Gateway Timeout)
Use the MaxRetries request option to configure this behavior.
var response = await client.Sellers.CreateSellerAsync(
...,
new RequestOptions {
MaxRetries = 0 // Override MaxRetries at the request level
}
);
Timeouts
The SDK defaults to a 30 second timeout. Use the Timeout option to configure this behavior.
var response = await client.Sellers.CreateSellerAsync(
...,
new RequestOptions {
Timeout = TimeSpan.FromSeconds(3) // Override timeout to 3s
}
);
Raw Response
Access raw HTTP response data (status code, headers, URL) alongside parsed response data using the .WithRawResponse() method.
using MarketSDK;
// Access raw response data (status code, headers, etc.) alongside the parsed response
var result = await client.Sellers.CreateSellerAsync(...).WithRawResponse();
// Access the parsed data
var data = result.Data;
// Access raw response metadata
var statusCode = result.RawResponse.StatusCode;
var headers = result.RawResponse.Headers;
var url = result.RawResponse.Url;
// Access specific headers (case-insensitive)
if (headers.TryGetValue("X-Request-Id", out var requestId))
{
System.Console.WriteLine($"Request ID: {requestId}");
}
// For the default behavior, simply await without .WithRawResponse()
var parsedData = await client.Sellers.CreateSellerAsync(...);
// .WithRawResponse() also works on streaming endpoints (returns IAsyncEnumerable<T> + RawResponse)
// and on endpoints with no response body (returns RawResponse only).
Additional Headers
If you would like to send additional headers as part of the request, use the AdditionalHeaders request option.
var response = await client.Sellers.CreateSellerAsync(
...,
new RequestOptions {
AdditionalHeaders = new Dictionary<string, string?>
{
{ "X-Custom-Header", "custom-value" }
}
}
);
Additional Query Parameters
If you would like to send additional query parameters as part of the request, use the AdditionalQueryParameters request option.
var response = await client.Sellers.CreateSellerAsync(
...,
new RequestOptions {
AdditionalQueryParameters = new Dictionary<string, string>
{
{ "custom_param", "custom-value" }
}
}
);
Additional Body Properties
If you would like to send additional body properties as part of the request, use the AdditionalBodyProperties request option.
These properties are merged into the serialized JSON body using their wire-format names; on a key collision the additional
property wins, and nested objects are merged recursively. If the endpoint has no request body, the additional properties
are sent as the JSON body. Form-urlencoded requests merge the additional properties the same way before encoding;
multipart (file upload) requests are not supported.
var response = await client.Sellers.CreateSellerAsync(
...,
new RequestOptions {
AdditionalBodyProperties = new Dictionary<string, object>
{
{ "custom_field", "custom-value" }
}
}
);
Forward Compatible Enums
This SDK uses forward-compatible enums that can handle unknown values gracefully.
using MarketSDK;
// Using a built-in value
var listSellersRequestStatus = ListSellersRequestStatus.Active;
// Using a custom value
var customListSellersRequestStatus = ListSellersRequestStatus.FromCustom("custom-value");
// Using in a switch statement
switch (listSellersRequestStatus.Value)
{
case ListSellersRequestStatus.Values.Active:
Console.WriteLine("Active");
break;
default:
Console.WriteLine($"Unknown value: {listSellersRequestStatus.Value}");
break;
}
// Explicit casting
string listSellersRequestStatusString = (string)ListSellersRequestStatus.Active;
ListSellersRequestStatus listSellersRequestStatusFromString = (ListSellersRequestStatus)"active";
Contributing
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- OneOf (>= 3.0.271)
- OneOf.Extended (>= 3.0.271)
- Portable.System.DateTimeOnly (>= 9.0.1)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 9.0.9)
- System.Text.RegularExpressions (>= 4.3.1)
-
.NETStandard 2.0
- OneOf (>= 3.0.271)
- OneOf.Extended (>= 3.0.271)
- Portable.System.DateTimeOnly (>= 9.0.1)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 9.0.9)
- System.Text.RegularExpressions (>= 4.3.1)
-
net8.0
- OneOf (>= 3.0.271)
- OneOf.Extended (>= 3.0.271)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
-
net9.0
- OneOf (>= 3.0.271)
- OneOf.Extended (>= 3.0.271)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
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.0.0 | 54 | 10/6/2026 |