Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.68 KB

File metadata and controls

68 lines (47 loc) · 1.68 KB

AGENTS.md — uapi-sdk-cpp

This file tells AI coding agents how to use the official C++ SDK for the uapis.cn public API platform.

What this library is

Header-only C++17 client for UAPI. Generated from the live OpenAPI 3.1 spec at https://uapis.cn/openapi.json.

Install

CMake (FetchContent):

include(FetchContent)
FetchContent_Declare(
  uapi-sdk-cpp
  GIT_REPOSITORY https://github.com/AxT-Team/uapi-sdk-cpp
  GIT_TAG main
)
FetchContent_MakeAvailable(uapi-sdk-cpp)

target_link_libraries(my_app PRIVATE uapi)

Quick start

#include <uapi/client.hpp>

int main() {
    uapi::Client client("https://uapis.cn");

    auto weather = client.misc().get_misc_weather({.city = "北京"});
    std::cout << weather.dump() << std::endl;
}

The client is grouped by tag (misc(), network(), text(), image(), social(), translate(), search(), …). Method names match the OpenAPI operationId, snake_cased.

Authentication

Free-tier endpoints work with no key. Paid endpoints take a key:

uapi::Client client("https://uapis.cn", "sk_…");

Errors

Methods throw uapi::ApiException on non-2xx responses. The exception carries code, error, and request_id fields. Surface error verbatim.

Rate limits

Headers X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After are exposed on response headers. Honor them.

Related repos