From 059e0435945f3fe3727f4e763435d553ffbf2d32 Mon Sep 17 00:00:00 2001 From: shuakami Date: Wed, 6 May 2026 03:39:44 +0000 Subject: [PATCH] Add LICENSE, AGENTS.md, and richer package metadata Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- AGENTS.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++ package.json | 29 ++++++++++++++++++-- 3 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 AGENTS.md create mode 100644 LICENSE diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..dbd95c5 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,74 @@ +# AGENTS.md — uapi-browser-sdk + +This file tells AI coding agents how to use the **official browser / +vanilla-JS SDK** for the [uapis.cn](https://uapis.cn) public API platform. + +## What this package is + +Browser-first, dependency-free TypeScript client for UAPI. Built on the +native `fetch` API, ships an ESM bundle, and works equally well from a +` +``` + +## Quick start + +```ts +import { UapiClient } from "uapi-browser-sdk"; + +const client = new UapiClient("https://uapis.cn"); +const weather = await client.misc.getMiscWeather({ city: "北京" }); +console.log(weather); +``` + +The client is grouped by tag (`misc`, `network`, `text`, `image`, `social`, +`translate`, `search`, …) and each method name matches the underlying +`operationId`, camelCased. + +## Authentication + +Free-tier endpoints work with no key. Paid endpoints take a key: + +```ts +const client = new UapiClient("https://uapis.cn", { apiKey: "sk_…" }); +``` + +> **Warning.** Putting an API key inside a public web page exposes it to +> anyone who reads the JS bundle. For browser-side calls to paid +> endpoints, prefer a thin server-side proxy that injects the key. + +## Errors + +Methods throw a typed `UapiApiError` on non-2xx responses. The error +carries `code`, `error`, and `requestId` fields. Surface `error` verbatim. + +## Rate limits + +Headers `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, +`Retry-After` are exposed via `error.response.headers` (and on success +responses via the optional `withResponse` overload). Honor them. + +## Related repos + +- Server-side TS SDK: . +- MCP server: . +- Skills bundle: . +- Other languages: `uapi-sdk-python`, `uapi-sdk-go`, `uapi-sdk-rust`, + `uapi-sdk-java`, `uapi-sdk-csharp`, `uapi-sdk-cpp`, `uapi-sdk-php`. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4e7b5fa --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 AxT-Team / UAPI + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/package.json b/package.json index c8a1776..02432ee 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,33 @@ "type": "git", "url": "https://github.com/AxT-Team/uapi-browser-sdk" }, - "scripts": { "build": "tsc -p tsconfig.json" }, + "scripts": { + "build": "tsc -p tsconfig.json" + }, "devDependencies": { "typescript": "^5.4.0" - } + }, + "description": "Official browser / vanilla-JS SDK for UAPI / uapis.cn — dependency-free `fetch`-based wrapper around 100+ free public-API endpoints. Works in browsers, Cloudflare Workers, and any modern JS runtime.", + "homepage": "https://uapis.cn/docs/sdk/browser", + "bugs": { + "url": "https://github.com/AxT-Team/uapi-browser-sdk/issues" + }, + "author": "UAPI ", + "license": "MIT", + "keywords": [ + "uapi", + "uapis", + "uapis.cn", + "sdk", + "browser", + "vanilla-js", + "typescript", + "fetch", + "public-api", + "free-api", + "openapi", + "client", + "agent", + "llm" + ] }