가이드
SDK
30개 이상의 언어 클라이언트 — 주요 플랫폼은 직접 제작하고 나머지는 자동 생성합니다.
AskAIs Customer Service은 프로토콜 우선 접근 방식을 채택합니다. 하나의 OpenAPI 3.1 명세, 하나의 WebSocket 프로토콜, 그리고 이를 원하는 모든 언어의 클라이언트입니다.
1단계 — 직접 제작한 SDK
당사가 유지 관리하며, 각 플랫폼에 맞는 관용적 구현이고, 해당되는 경우 완전한 UI 컴포넌트를 제공합니다.
- Web —
@singlink/web-widget(바닐라 JS 번들, 바로 사용 가능한 script 태그, 약 30 kB gzip) - iOS — Swift Package, 네이티브 UIKit + SwiftUI 컴포넌트 (로드맵)
- Android — Kotlin 라이브러리 + Jetpack Compose 컴포넌트 (로드맵)
- Flutter — pub.dev 패키지 (로드맵)
- React Native — npm 패키지 (로드맵)
2단계 — 자동 생성된 SDK
당사 명세를 바탕으로 openapi-generator가 생성한 12개 언어 — API가 변경될 때마다 다시 생성됩니다.
- Python · Go · Rust · Java · C# / .NET / Unity · PHP
- Ruby · Dart · Kotlin · Swift(서버 측)· TypeScript · C++(Unreal)
로컬에서 다시 생성하기:
# from repo root, with web app running
pnpm sdks:generate
# subset
./scripts/generate-sdks.sh python go rust3단계 — 프로토콜 문서
Lua / Perl / Crystal / Elixir / Haskell 또는 당사가 미리 빌드하지 않은 모든 언어의 경우 명세를 직접 따르세요.
- OpenAPI:
GET /api/v1/openapi.json - WebSocket:이벤트 JSON은 Web 위젯 문서를 참조하세요
빠른 예제
Python
from singlink_sdk import ApiClient, AuthApi, MessagesApi
from singlink_sdk.models import IdentifyRequest, SendMessageRequest
client = ApiClient()
auth = AuthApi(client)
identity = auth.identify(
IdentifyRequest(
app_id="ws_abc123",
external_id="user_42",
email="ada@example.com",
)
)
client.set_default_header("Authorization", f"Bearer {identity.token}")
msgs = MessagesApi(client)
conv = msgs.create_conversation()
msgs.send_message(
conv.id,
SendMessageRequest(content="Hi from Python!")
)Go
import (
"context"
singlink "github.com/singlink/singlink-go"
)
cfg := singlink.NewConfiguration()
api := singlink.NewAPIClient(cfg)
resp, _, _ := api.AuthApi.Identify(context.Background()).
IdentifyRequest(singlink.IdentifyRequest{
AppId: "ws_abc123",
Email: singlink.PtrString("ada@example.com"),
}).Execute()
cfg.AddDefaultHeader("Authorization", "Bearer "+resp.Token)Rust
use singlink_sdk::apis::{auth_api, configuration::Configuration};
use singlink_sdk::models::IdentifyRequest;
let mut cfg = Configuration::new();
let identity = auth_api::identify(&cfg, IdentifyRequest {
app_id: "ws_abc123".into(),
email: Some("ada@example.com".into()),
..Default::default()
}).await?;
cfg.bearer_access_token = Some(identity.token);C# / Unity
using SingChat.Sdk.Api;
using SingChat.Sdk.Client;
using SingChat.Sdk.Model;
var cfg = new Configuration();
var auth = new AuthApi(cfg);
var identity = await auth.IdentifyAsync(new IdentifyRequest(
appId: "ws_abc123",
email: "ada@example.com"
));
cfg.DefaultHeaders.Add("Authorization", $"Bearer {identity.Token}");원시 curl
# identify (no library at all)
curl https://cs.askais.com/api/v1/auth/identify \
-H "Content-Type: application/json" \
-d '{ "appId": "ws_abc123", "email": "ada@example.com" }'