ApiTranslator 1.0.0
dotnet add package ApiTranslator --version 1.0.0
NuGet\Install-Package ApiTranslator -Version 1.0.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="ApiTranslator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApiTranslator" Version="1.0.0" />
<PackageReference Include="ApiTranslator" />
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 ApiTranslator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ApiTranslator, 1.0.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 ApiTranslator@1.0.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=ApiTranslator&version=1.0.0
#tool nuget:?package=ApiTranslator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ApiTranslator 🔄
REST, GraphQL ve SOAP API'leri arasında otomatik çeviri yapan .NET 8 middleware paketi.
📦 Kurulum
dotnet add package ApiTranslator
🚀 Kullanım
Fluent API
using ApiTranslator;
using ApiTranslator.Core.Enums;
// REST → GraphQL
var result = await ApiTranslate
.From(ApiProtocol.REST)
.To(ApiProtocol.GraphQL)
.WithUrl("https://api.example.com/graphql")
.WithParam("id", "1")
.SendAsync();
// REST → SOAP
var result = await ApiTranslate
.From(ApiProtocol.REST)
.To(ApiProtocol.SOAP)
.WithUrl("https://service.com/calculator.asmx")
.WithMethod("POST")
.WithBody("{\"intA\": 10, \"intB\": 5}")
.SendAsync();
// GraphQL → REST
var result = await ApiTranslate
.From(ApiProtocol.GraphQL)
.To(ApiProtocol.REST)
.WithUrl("https://jsonplaceholder.typicode.com/users/1")
.WithBody("{ \"query\": \"{ user(id: 1) { id name email } }\" }")
.SendAsync();
// SOAP → REST
var result = await ApiTranslate
.From(ApiProtocol.SOAP)
.To(ApiProtocol.REST)
.WithUrl("https://jsonplaceholder.typicode.com/users/1")
.WithMethod("GET")
.SendAsync();
🔐 Authentication
// 1. API Key
var result = await ApiTranslate
.From(ApiProtocol.REST)
.To(ApiProtocol.GraphQL)
.WithUrl("https://api.example.com/graphql")
.WithApiKey("my-secret-key")
.SendAsync();
// 2. Bearer Token
var result = await ApiTranslate
.From(ApiProtocol.REST)
.To(ApiProtocol.SOAP)
.WithUrl("https://service.com/api")
.WithBearerToken("eyJhbGciOiJIUzI1NiJ9...")
.SendAsync();
// 3. Basic Auth
var result = await ApiTranslate
.From(ApiProtocol.GraphQL)
.To(ApiProtocol.REST)
.WithUrl("https://api.example.com/users")
.WithBasicAuth("admin", "password123")
.SendAsync();
// 4. OAuth2 — token otomatik alınır
var result = await ApiTranslate
.From(ApiProtocol.REST)
.To(ApiProtocol.GraphQL)
.WithUrl("https://api.example.com/graphql")
.WithOAuth2(
tokenEndpoint: "https://auth.example.com/token",
clientId: "my-client-id",
clientSecret: "my-secret",
scope: "api.read"
)
.SendAsync();
🏗️ Dependency Injection
// Program.cs
using ApiTranslator.Handlers;
builder.Services.AddApiTranslator(options =>
{
options.IgnoreSslErrors = false;
options.Timeout = TimeSpan.FromSeconds(30);
});
// Controller
public class MyController : ControllerBase
{
private readonly ITranslationEngine _translator;
public MyController(ITranslationEngine translator)
=> _translator = translator;
public async Task<IActionResult> MyAction()
{
var result = await _translator.TranslateAsync(new TranslationRequest
{
SourceProtocol = ApiProtocol.REST,
TargetProtocol = ApiProtocol.GraphQL,
TargetUrl = "https://api.example.com/graphql",
QueryParams = new() { { "id", "1" } }
});
return Ok(result.Body);
}
}
🔄 Desteklenen Çeviriler
| Kaynak | Hedef | Durum |
|---|---|---|
| REST | GraphQL | ✅ |
| REST | SOAP | ✅ |
| GraphQL | REST | ✅ |
| SOAP | REST | ✅ |
| GraphQL | SOAP | ✅ |
| SOAP | GraphQL | ✅ |
🔐 Desteklenen Auth Yöntemleri
| Yöntem | Metod |
|---|---|
| API Key | .WithApiKey("key", "X-API-Key") |
| Bearer | .WithBearerToken("token") |
| Basic Auth | .WithBasicAuth("user", "pass") |
| OAuth2 | .WithOAuth2("endpoint", "id", "secret") |
🏗️ Mimari
ApiTranslator
├── Core → Interface'ler ve modeller
├── Handlers → REST, GraphQL, SOAP handler'ları
└── Gateway → Demo Web API (Swagger)
Strategy Pattern + Adapter Pattern kullanılmıştır.
📄 Lisans
MIT © 2024
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- ApiTranslator.Core (>= 1.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Newtonsoft.Json (>= 13.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 |
|---|---|---|
| 1.0.0 | 115 | 3/7/2026 |