Confiti.MoySklad.Remap.Sdk
0.21.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Confiti.MoySklad.Remap.Sdk --version 0.21.1
NuGet\Install-Package Confiti.MoySklad.Remap.Sdk -Version 0.21.1
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="Confiti.MoySklad.Remap.Sdk" Version="0.21.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Confiti.MoySklad.Remap.Sdk" Version="0.21.1" />
<PackageReference Include="Confiti.MoySklad.Remap.Sdk" />
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 Confiti.MoySklad.Remap.Sdk --version 0.21.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Confiti.MoySklad.Remap.Sdk, 0.21.1"
#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 Confiti.MoySklad.Remap.Sdk@0.21.1
#: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=Confiti.MoySklad.Remap.Sdk&version=0.21.1
#tool nuget:?package=Confiti.MoySklad.Remap.Sdk&version=0.21.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
МойСклад C# API client
Реализация C# клиента для МойСклад API
Поддерживаемые API
- МойСклад Remap API v1.2
Начало работы c Remap API
Быстрый старт
var credentials = new MoySkladCredentials()
{
AccessToken = "your-access-token"
// или
Username = "your-username",
Password = "your-password",
};
var api = new MoySkladApi(credentials);
var response = await api.Assortment.GetAllAsync();
Пользовательский HttpClient
var httpClient = new HttpClient(new HttpClientHandler()
{
// gZip обязателен
AutomaticDecompression = DecompressionMethods.GZip
});
var credentials = new MoySkladCredentials()
{
AccessToken = "your-access-token"
};
var api = new MoySkladApi(credentials, httpClient);
Фильтрация
var query = new AssortmentApiParameterBuilder();
// фильтр '='
query.Parameter(p => p.Name).Should().Be("foo");
// вложенный фильтр '='
query.Parameter(p => p.Alcoholic.Type).Should().Be(123);
// множественный фильтр '='
query.Parameter(p => p.Archived).Should().Be(true).Or.Be(false);
// фильтр '~'
query.Parameter(p => p.Article).Should().Contains("foo");
// фильтр '~='
query.Parameter(p => p.Article).Should().StartsWith("foo");
// фильтр '>=' и '<='
query.Parameter(p => p.Updated).Should()
.BeGreaterOrEqualTo(DateTime.Parse("2020-07-10 12:00:00"))
.And
.BeLessOrEqualTo(DateTime.Parse("2020-07-12 12:00:00"));
// фильтр по пользовательскому полю
query.Parameter("your-custom-attribute-href").Should().Be(123);
var response = await api.Assortment.GetAllAsync(query);
Сортировка
query.Order().By(p => p.Name)
// пользовательское поле
.And.By("your-custom-property-name");
// по убыванию
query.Order().By(p => p.Name, OrderBy.Desc)
Limit и Offset
query.Limit(100);
query.Offset(50);
Контекстный поиск
query.Search("foo");
Группировка
query.GroupBy(GroupBy.Consignment);
Expand
query.Expand().With(p => p.Images)
.And.With(p => p.Product)
// вложенный
.And.With(p => p.SalePrices.Currency)
.And.With(p => p.BuyPrice.Currency)
.And.With(p => p.Product.SalePrices.Currency)
.And.With(p => p.Product.BuyPrice.Currency)
// пользовательское поле
.And.With("your-custom-property-name")
Загрузка картинок
var imagesResponse = await api.Product.Images.GetAllAsync(Guid.Parse("product-id"));
foreach (var image in imagesResponse.Payload.Rows)
{
var imageDataResponse = await api.Product.Images.DownloadAsync(image);
await using (imageDataResponse.Payload)
{
if (imageDataResponse.Payload is MemoryStream memoryStream)
{
var imageData = memoryStream.ToArray();
// обработать изображение
}
}
}
Получение метаданных
await api.Product.Metadata.GetAsync();
Обработка исключений
try
{
await _moySkladApi.Counterparty.GetAsync(counterpartyId);
}
catch (ApiException ex)
{
// обработать код ошибки
if (ex.ErrorCode == 404) { ... }
// обработать ошибки
foreach (var error in ex.Errors) { ... }
// полное описание ошибки
// cодержит все коды/описания по каждой ошибке из ex.Errors.
_logger.Log(ex.Message);
}
Сборка и запуск тестов
- В корневой папке в файле
build.ps1укажитеAPI_LOGINиAPI_PASSWORD
build.ps1
# Enter your login and password
# $Env:API_LOGIN = "enter-your-api-login-here"
# $Env:API_PASSWORD = "enter-your-api-password-here"
- Запустите
build.ps1
Поддержка
Я открыт для любого сотрудничества и расширения функционала данного проекта. Pull requests приветствуются, однако сначала откройте issue для обсуждения.
Если вам понравился данный проект, воткните ⭐
| 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 was computed. 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. |
| .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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Newtonsoft.Json (>= 12.0.3)
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 |
|---|---|---|
| 0.24.0 | 172 | 11/6/2025 |
| 0.23.0 | 183 | 11/5/2025 |
| 0.22.0 | 310 | 9/17/2025 |
| 0.21.1 | 2,351 | 7/22/2024 |
| 0.21.0 | 172 | 7/22/2024 |
| 0.20.1 | 173 | 7/18/2024 |
| 0.20.0 | 178 | 6/17/2024 |
| 0.19.0 | 187 | 5/16/2024 |
| 0.18.0 | 842 | 10/19/2023 |
| 0.17.1 | 477 | 12/26/2022 |
| 0.17.0 | 448 | 11/13/2022 |
| 0.16.1 | 528 | 10/30/2022 |
| 0.15.2 | 542 | 8/16/2022 |
| 0.15.1 | 521 | 8/15/2022 |
| 0.15.0 | 509 | 8/14/2022 |
| 0.14.0 | 528 | 8/14/2022 |
| 0.13.1 | 608 | 4/11/2022 |
| 0.13.0 | 554 | 3/23/2022 |
| 0.12.0 | 553 | 3/23/2022 |
| 0.11.0 | 565 | 3/18/2022 |
| 0.9.1 | 528 | 9/4/2021 |
| 0.9.0 | 445 | 9/1/2021 |
| 0.8.0 | 481 | 6/25/2021 |
| 0.7.0 | 508 | 6/17/2021 |
| 0.6.0 | 513 | 6/13/2021 |
| 0.5.0 | 456 | 5/9/2021 |
| 0.4.2 | 444 | 4/15/2021 |
| 0.3.2 | 488 | 2/13/2021 |
| 0.3.1 | 476 | 2/12/2021 |
| 0.3.0 | 495 | 2/7/2021 |