Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/commercetools/commercetools-dotnet-sdk
The e-commerce SDK from commercetools running on the .NET platform
https://github.com/commercetools/commercetools-dotnet-sdk
audit-sdk commercetools commercetools-dotnet-sdk commercetools-sdk dotnet dotnet-sdk sdk
Last synced: about 2 months ago
JSON representation
The e-commerce SDK from commercetools running on the .NET platform
- Host: GitHub
- URL: https://github.com/commercetools/commercetools-dotnet-sdk
- Owner: commercetools
- License: mit
- Created: 2016-05-13T11:21:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:14:32.000Z (about 2 years ago)
- Last Synced: 2024-11-08T04:21:15.869Z (about 2 months ago)
- Topics: audit-sdk, commercetools, commercetools-dotnet-sdk, commercetools-sdk, dotnet, dotnet-sdk, sdk
- Language: C#
- Homepage: https://docs.commercetools.com/sdk/dotnet-sdk#net-sdk
- Size: 13.4 MB
- Stars: 8
- Watchers: 82
- Forks: 14
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# commercetools-dotnet-sdk
:warning: **This Composable Commerce .NET SDK is deprecated effective `1st September 2021.`, We recommend to use our [.NET Core SDK V2](https://docs.commercetools.com/sdk/dotnet-sdk#net-core-sdk-v2).
[![Travis Build Status](https://travis-ci.org/commercetools/commercetools-dotnet-sdk.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-dotnet-sdk)
[![AppVeyor Build Status](https://img.shields.io/appveyor/ci/commercetools/commercetools-dotnet-sdk.svg)](https://ci.appveyor.com/project/commercetools/commercetools-dotnet-sdk)
[![NuGet Version and Downloads count](https://buildstats.info/nuget/commercetools.NET.SDK?includePreReleases=true)](https://www.nuget.org/packages/commercetools.NET.SDK)The Composable Commerce SDK allows developers to work effectively by providing typesafe access to commercetools Composable Commerce in their .NET applications.
For more documentation please see [the wiki](//github.com/commercetools/commercetools-dotnet-sdk/wiki/commercetools-.NET-SDK-documentation)
## Supported Platforms
* .NET Standard 2.0
## Using the SDK
You will need a Composable Commerce Project to use the SDK.
If you don't already have one, you can [create a free trial project](http://dev.commercetools.com/getting-started.html) on Composable Commerce and configure the API credentials.The namespaces in the SDK mirror the sections of the [commercetools HTTP API](http://dev.commercetools.com/http-api.html).
Access to these namespaces is provided by a fluent interface on the Client class.Responses from the client are wrapped in a Response object so you can determine if the request was successful and view the error(s) returned from the API if it was not.
```cs
using System;
using System.Threading.Tasks;using commercetools.Common;
using commercetools.Products;class Program
{
static void Main(string[] args)
{
new Program().Run().Wait();Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}private async Task Run()
{
Configuration config = new Configuration(
"https://auth.europe-west1.gcp.commercetools.com/oauth/token",
"https://api.europe-west1.gcp.commercetools.com",
"[your project key]",
"[your client ID]",
"[your client secret]",
ProjectScope.ManageProject);Client client = new Client(config);
Response response = await client.Products().QueryProductsAsync();
if (response.Success)
{
ProductQueryResult productQueryResult = response.Result;foreach (Product product in productQueryResult.Results)
{
Console.WriteLine(product.Id);
}
}
else
{
Console.WriteLine("{0}: {1}", response.StatusCode, response.ReasonPhrase);foreach (ErrorMessage errorMessage in response.Errors)
{
Console.WriteLine("{0}: {1}", errorMessage.Code, errorMessage.Message);
}
}
}
}```
Not all API sections and representations have been implemented in the SDK. If you need to work with areas of the API that have not yet been covered, you can use the Client to make JSON requests directly. Ask the client for a JObject and you will get the entire JSON response that is returned from the API.
This code snippet will have the same output as the code snippet above:
```cs
Response response = await client.GetAsync("/products");
if (response.Success)
{
dynamic responseObj = response.Result;foreach (dynamic product in responseObj.results)
{
Console.WriteLine(product.id);
}
}
else
{
Console.WriteLine("{0}: {1}", response.StatusCode, response.ReasonPhrase);foreach (ErrorMessage errorMessage in response.Errors)
{
Console.WriteLine("{0}: {1}", errorMessage.Code, errorMessage.Message);
}
}```
## License, Contributing
This software is licenses under the MIT License, which allows commercial use and modification as well as open source collaboration.
We are warmly welcoming contributors and are happy to help out.
To contribute changes or improvements, please fork the repository into your account on GitHub and create a pull request.## Contribution Guidelines
* The namespaces and directory names in the SDK should match up exactly with the project name in the documentation. For your contributions.
> For Example: The namespace should be commercetools.CartDiscounts (plural) should be used rather than commercetools.CartDiscount (singular).* Only the required properties for an API entity should be used as constructor parameters in the corresponding SDK class. Parameters marked as optional in the documentation should not be required for creating a new instance of the class.
> For Example: In the commercetools.CartDiscounts.CartDiscountDraft class, description, target, isActive, validFrom and validUntil should not be used as constructor parameters as they are not required.* Wherever applicable, try to treat objects as groups of entities and use a factory to create these groups of entities when response is being parsed.
> For Example: The CartDiscountValue entities (AbsoluteCartDiscountValue/RelativeCartDiscountValue/GiftLineItemCartDiscountValue) are treated as a group of entities that share a common type property, Type (Relative/Absolute/GiftLineItem). These entities are created by a CartDiscountValueFactory when we parse the response from the Composable Commerce API.### Mac Users
The Visual Studio IDE [is available for Mac OS](https://www.visualstudio.com/vs/visual-studio-mac/) (preview version as of 2016)
A more lightweight Coding Environment that also manages the .NET setup automatically for you is [Microsoft Visual Studio Code](https://code.visualstudio.com/) (free).