SDK 接入

多语言 SDK 卡片

Python

占位说明:适合脚本与服务端快速接入。

from guangnian_sdk import Client
client = Client(app_id="demo", app_key="demo")
print(client.ping())

Node.js

占位说明:适合前后端统一 JavaScript 技术栈。

const client = new GuangNianClient({ appId: 'demo' });
const res = await client.ping();

Java

占位说明:适合企业级项目。

Client client = new Client("demo", "demo");
PingResponse ping = client.ping();

C#

占位说明:兼容 .NET 项目。

var client = new GuangNianClient("demo", "demo");
var ping = await client.PingAsync();

C

占位说明:适合轻量环境与嵌入式。

gn_client_t* cli = gn_client_new("demo", "demo");
gn_ping(cli);

C++

占位说明:适合性能敏感客户端。

GuangNianClient cli("demo", "demo");
auto ret = cli.Ping();

PHP

占位说明:适合 Web 服务快速联调。

$client = new GuangNianClient('demo', 'demo');
$resp = $client->ping();

Objective-C

占位说明:适合旧版 iOS 工程。

GNClient *c = [[GNClient alloc] initWithId:@"demo" key:@"demo"];
[c pingWithCompletion:nil];

Swift

占位说明:适合现代 iOS 开发。

let client = GNClient(appId: "demo", appKey: "demo")
let ping = try await client.ping()

网页 JS

占位说明:浏览器端直接调用接口。

const payload = { app_id: 'demo', timestamp: Date.now() };
fetch('/index.php?r=api/v1/ping', { method: 'POST', body: JSON.stringify(payload) });
当前页面没有匹配的内容,请更换关键词。