ME.Api.Sdk 2.8.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ME.Api.Sdk --version 2.8.1                
NuGet\Install-Package ME.Api.Sdk -Version 2.8.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="ME.Api.Sdk" Version="2.8.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ME.Api.Sdk --version 2.8.1                
#r "nuget: ME.Api.Sdk, 2.8.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.
// Install ME.Api.Sdk as a Cake Addin
#addin nuget:?package=ME.Api.Sdk&version=2.8.1

// Install ME.Api.Sdk as a Cake Tool
#tool nuget:?package=ME.Api.Sdk&version=2.8.1                

ME.Api.Sdk

ME.Api.Sdk is a C# SDK that simplifies integration with Mercado Eletrônico APIs and Webhooks. It provides built-in authentication, retry handling, and rate-limit management, enabling a smoother and more efficient integration experience.

APIs Reference:: Mercado Eletrônico APIs

Requirements

.NET 6.0 or higher

Installation

To install the ME.Api.Sdk, use NuGet Package Manager with the following command:

dotnet add package ME.Api.Sdk

Alternatively, you can search for ME.Api.Sdk in the NuGet Package Manager in Visual Studio.

Getting Started

Dependency Injection Setup

To integrate the SDK into your application, you need to configure it through Dependency Injection (DI). Add the following code in your application's DI setup (typically in Program.cs or Startup.cs):


var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMEApiClient(builder.Configuration);

// Retrieve the IMEApiClient from the service provider
var apiClient = serviceProvider.GetService<IMEApiClient>(); 

Configuration

Ensure that your appsettings.json file contains the required API settings:

{
  "MEApiSettings": {
    "BaseAddress": "https://api.mercadoe.com",
    "ClientId": "ClientId",
    "ClientSecret": "ClientSecret"
  }
}

This configuration allows the SDK to authenticate requests automatically.

Direct Instantiation (Optional)

If you prefer not to use Dependency Injection, you can instantiate the client directly:

var settings = new MEApiSettings
{
    BaseAddress = "https://trunk.api.mercadoe.com",
    ClientId = "ClientId",
    ClientSecret = "ClientSecret"
};
var apiClient = new MEApiClient(settings);

Usage

To interact with the APIs, inject the IMEApiClient and enjoy!

app.MapGet("/", async (IMEApiClient api, CancellationToken ctx) =>
{
   var preOrder = await api.PreOrderClient.GetPreOrderAsync(
     new GetPreOrderRequest { PreOrderId = "your_preorder_id" }
     , cancellationToken);
  return Ok(preOrder);
});

Features

  • Integrated Authentication: Easily manage OAuth 2.0 authentication flows.
  • Retry Policies: Automatic retries on transient failures.
  • Rate-Limit Control: Manage API request limits effectively. For more details on the available API endpoints and usage examples, refer to the Mercado Eletrônico API documentation
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.9.0 104 10/9/2024
2.8.1 100 9/25/2024