Confiti.MoySklad.Remap.Sdk
0.24.0
dotnet add package Confiti.MoySklad.Remap.Sdk --version 0.24.0
NuGet\Install-Package Confiti.MoySklad.Remap.Sdk -Version 0.24.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="Confiti.MoySklad.Remap.Sdk" Version="0.24.0" />
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.24.0" />
<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.24.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Confiti.MoySklad.Remap.Sdk, 0.24.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 Confiti.MoySklad.Remap.Sdk@0.24.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=Confiti.MoySklad.Remap.Sdk&version=0.24.0
#tool nuget:?package=Confiti.MoySklad.Remap.Sdk&version=0.24.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
МойСклад C# SDK
Поддерживаемые API:
- Remap API v1.2
Навигация
<a id="remap-api">Remap API</a>
<a id="remap-api__install">Установка / .NET CLI</a>
dotnet add package Confiti.MoySklad.Remap.Sdk
<a id="remap-api__quick-start">Быстрый старт</a>
var credentials = new MoySkladCredentials()
{
AccessToken = "your-access-token"
// или
Username = "your-username",
Password = "your-password",
};
var api = new MoySkladApi(credentials);
var response = await api.Entity.Assortment.GetAllAsync();
<a id="remap-api__custom-http-client">Пользовательский HttpClient</a>
Создайте свой 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);
или добавьте в IServiceCollection
services
.AddHttpClient<MoySkladApi, MoySkladApi>(httpClient =>
{
return new MoySkladApi(new MoySkladCredentials { AccessToken = "your-access-token" }, httpClient);
})
.ConfigureHttpMessageHandlerBuilder(builder =>
{
if (builder.PrimaryHandler is HttpClientHandler httpClientHandler)
httpClientHandler.AutomaticDecompression = DecompressionMethods.GZip;
});
<a id="remap-api__exceptions-processing">Обработка исключений</a>
try
{
await api.Entity.Counterparty.GetAllAsync();
}
catch (ApiException ex)
{
// обработать код ошибки
if (ex.ErrorCode == 404) { ... }
// обработать ошибки
foreach (var error in ex.Errors) { ... }
// полное описание ошибки
// cодержит все коды/описания по каждой ошибке из ex.Errors.
_logger.Log(ex.Message);
}
<a id="remap-api__auth">Аутентификация</a>
var api = new MoySkladApi(new MoySkladCredentials()
{
Username = "your-username",
Password = "your-password",
});
// или измените текущие
api.Credentials = new MoySkladCredentials()
{
Username = "new-username",
Password = "new-password",
};
var response = await api.Security.Token.GetAsync();
var accessToken = response.Payload.AccessToken;
<a id="remap-api__download-images">Загрузка картинок</a>
var imagesResponse = await api.Entity.Product.Images.GetAllAsync(Guid.Parse("product-id"));
foreach (var image in imagesResponse.Payload.Rows)
{
var imageDataResponse = await api.Entity.Product.Images.DownloadAsync(image);
await using (imageDataResponse.Payload)
{
if (imageDataResponse.Payload is MemoryStream memoryStream)
{
var imageData = memoryStream.ToArray();
// обработать изображение
}
}
}
<a id="remap-api__get-metadata">Получение метаданных</a>
await api.Entity.Product.Metadata.GetAsync();
<a id="remap-api__filter">Фильтрация</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
// фильтр '='
query.FilterBy(p => p.Name).Should().Be("foo");
// фильтр '=' по коду в виде строки
query.FilterBy("code").Should().Be("bar");
// вложенный фильтр '='
query.FilterBy(p => p.Alcoholic.Type).Should().Be(123);
// множественный фильтр '='
query.FilterBy(p => p.Archived).Should().Be(true).Or.Be(false);
// фильтр '~'
query.FilterBy(p => p.Article).Should().Contains("foo");
// фильтр '~='
query.FilterBy(p => p.Barcode).Should().StartsWith("foo");
// фильтр '>=' и '<='
query.FilterBy(p => p.Updated).Should()
.BeGreaterOrEqualTo(DateTime.Parse("2020-07-10 12:00:00"))
.And
.BeLessOrEqualTo(DateTime.Parse("2020-07-12 12:00:00"));
// фильтр по пользовательскому полю
query.FilterBy("your-custom-attribute-href").Should().Be(123);
// фильтр по складу по ссылке
query.FilterBy(p => p.StockStore).Should().Be("https://api.moysklad.ru/api/remap/1.2/entity/store/59a894aa-0ea3-11ea-0a80-006c00081b5b");
// или с объектом Store
query.FilterBy(p => p.StockStore).Should().Be(store);
});
<a id="remap-api__sort">Сортировка</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
query.OrderBy(p => p.Name)
// или по любой строке
.ThenBy("your-custom-property-name");
// по убыванию
query.OrderBy(p => p.Name, OrderBy.Desc)
});
<a id="remap-api__limit-offset">Limit и Offset</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
query.Limit(100);
query.Offset(50);
});
<a id="remap-api__searching">Контекстный поиск</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
query.Search("foo");
});
<a id="remap-api__grouping">Группировка</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
query.GroupBy(GroupBy.Consignment);
});
<a id="remap-api__expand">Expand / вложенные объекты</a>
var response = await api.Entity.Assortment.GetAllAsync(query =>
{
query.ExpandBy(p => p.Images)
.ThenBy(p => p.Product)
// вложенный
.ThenBy(p => p.SalePrices.Currency)
.ThenBy(p => p.BuyPrice.Currency)
.ThenBy(p => p.Product.SalePrices.Currency)
.ThenBy(p => p.Product.BuyPrice.Currency)
// или по любой строке
.ThenBy("salePrices.currency")
});
<a id="build-and-test">Сборка и запуск тестов</a>
В корневой папке в файле 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"
<a id="support">Поддержка</a>
Я открыт для любого сотрудничества и расширения функционала данного проекта. 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 | 670 | 11/6/2025 |
| 0.23.0 | 211 | 11/5/2025 |
| 0.22.0 | 336 | 9/17/2025 |
| 0.21.1 | 2,420 | 7/22/2024 |
| 0.21.0 | 197 | 7/22/2024 |
| 0.20.1 | 196 | 7/18/2024 |
| 0.20.0 | 198 | 6/17/2024 |
| 0.19.0 | 208 | 5/16/2024 |
| 0.18.0 | 862 | 10/19/2023 |
| 0.17.1 | 493 | 12/26/2022 |
| 0.17.0 | 474 | 11/13/2022 |
| 0.16.1 | 553 | 10/30/2022 |
| 0.15.2 | 573 | 8/16/2022 |
| 0.15.1 | 553 | 8/15/2022 |
| 0.15.0 | 544 | 8/14/2022 |
| 0.14.0 | 564 | 8/14/2022 |
| 0.13.1 | 634 | 4/11/2022 |
| 0.13.0 | 578 | 3/23/2022 |
| 0.12.0 | 575 | 3/23/2022 |
Loading failed