> For the complete documentation index, see [llms.txt](https://docs.kangal.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kangal.dev/tr/sdklar/api-client.md).

# Üretilmiş API client entegrasyonu

SDK, yayınlanmış bir API sürümüyle saklanan OpenAPI contract'ından üretilir. Draft, retired, süresi geçmiş, contract'ı eksik veya cross-tenant sürümler export edilemez.

## Uçtan uca akış

1. Platform ekibi Developer Portal üzerinde API ve değiştirilemez sürüm yayınlar.
2. API tüketicisi application kaydı oluşturur ve gerekli credential'ı alır.
3. Platform yöneticisi bir dil seçip üretilmiş SDK ZIP dosyasını export eder.
4. Platform ekibi artifact'i doğrular ve onaylı registry'ye yayınlar.
5. Tüketici build pipeline'ı `checksums.sha256` ve `sdk-manifest.json` değerlerini doğrular.
6. Uygulama üretilmiş package'ı kurar veya build eder.
7. Runtime configuration gateway Proxy URL ve credential değerini sağlar.
8. Uygulama üretilmiş operation metodunu çağırır veya gerektiğinde genel istek metodunu kullanır.

## Üretilen metot yüzeyi

Her OpenAPI operation public bir client metoduna dönüşür. Metot adı `operationId` değerinden gelir; bu alan yoksa generator HTTP metodu ve path'ten kararlı bir ad türetir. Her dilin reserved word ve çakışma kuralları uygulanır.

Örneğin `operationId: getOrder` değerine sahip `GET /orders/{order_id}` şu metotları üretir:

| Dil        | Üretilen metot           |
| ---------- | ------------------------ |
| TypeScript | `getOrder(options)`      |
| Python     | `get_order(**kwargs)`    |
| Go         | `GetOrder(ctx, options)` |
| Java       | `getOrder(options)`      |
| C#         | `GetOrderAsync(options)` |
| PHP        | `getOrder($options)`     |

Path parametresi, query değeri, request body, header, timeout ve retry override'larını dilin request-options tipiyle verin. Her package, her operation için kesin SDK metodu, HTTP metodu, path ve response modelini gösteren `REFERENCE.md` dosyasını içerir. Request ve response şemalarının asıl kaynağı `openapi.json` dosyasıdır.

Dinamik path'ler ve ileriye uyumlu çağrılar için genel `request` / `Request` / `RequestAsync` metodu da korunur. Normal uygulama kodunda kararlı operation adını ve return-model bilgisini koruduğu için üretilmiş metotları tercih edin.

## CLI üzerinden export

Kangal Admin API URL, admin token ve tenant scope ile bir `kangalctl` context yapılandırın. Ardından yayınlanmış API sürümünü export edin:

```bash
python scripts/kangalctl.py sdk export \
  --service-id svc-orders \
  --version-id version-1 \
  --gateway-id gw-production \
  --target typescript-fetch \
  --output orders-sdk.zip
```

Desteklenen hedefler: `typescript-fetch`, `python`, `go`, `java`, `csharp` ve `php`.

## API üzerinden export

```
GET /portal/services/{service_id}/versions/{version_id}/sdk
    ?tenant_id={tenant_id}
    &gateway_id={gateway_id}
    &target={target}
```

Endpoint, `developer_portal.manage` yetkisine sahip authenticated administrator gerektirir. Tüketici uygulama bu endpoint'i çağırmamalı ve Admin API token gömmemelidir. Platform ekibi artifact'i export edip doğrulanan package'ı onaylı kanaldan dağıtır.

## Artifact doğrulaması

ZIP şunları içerir:

* OpenAPI operation başına bir metot içeren üretilmiş client kaynağı;
* eksiksiz metot indeksi içeren `REFERENCE.md`;
* seçilen dile ait package metadata;
* değiştirilemez `openapi.json` contract;
* üretilen dosyalar için `checksums.sha256`;
* generator, scope, version ve checksum metadata'sı içeren `sdk-manifest.json`.

Üretilmiş package'ı internal registry'ye göndermeden önce checksum değerlerini doğrulayın. Bütünlük doğrulaması başarısız artifact'i çalıştırmayın.

## Runtime yapılandırması

`baseUrl` olarak Kangal gateway'in public **Proxy URL** değerini kullanın. Gateway route'un beklediği API key veya bearer token değerlerinden birini verin. Credential'ı environment variable, workload identity veya secret manager'da saklayın.

Üretilmiş client yayınlanmış `X-Tenant-ID` ve `X-Gateway-ID` varsayılanlarını içerir. Platform owner açıkça başka bir uyumlu scope vermedikçe değiştirmeyin.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kangal.dev/tr/sdklar/api-client.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
