1227 lines
31 KiB
JSON
1227 lines
31 KiB
JSON
{
|
||
"openapi": "3.0.3",
|
||
"info": {
|
||
"title": "License Platform Client API",
|
||
"version": "1.2.0",
|
||
"description": "Client-facing instance APIs. Update checks return signed update-v1 metadata; admin sessions are never client credentials. See protocol.md for canonical signature and trust-root rules. Restricted Bearer purchase flow is documented in purchase.md."
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "https://license.yihuiyong.cn",
|
||
"description": "Deployed HTTPS origin"
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/v1/portal/snapshot": {
|
||
"post": {
|
||
"summary": "实例凭据查询已发布版本与下载权限",
|
||
"parameters": [
|
||
{
|
||
"in": "query",
|
||
"name": "page",
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
}
|
||
},
|
||
{
|
||
"in": "query",
|
||
"name": "page_size",
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 1,
|
||
"maximum": 100
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"instance_id",
|
||
"secret"
|
||
],
|
||
"properties": {
|
||
"instance_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"secret": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "data 含 customer/product/license/instance/lease/releases,meta 为分页;版本项含 id/version/sha256/size_bytes/download_allowed,不是签名升级清单。"
|
||
},
|
||
"403": {
|
||
"description": "实例凭据无效"
|
||
},
|
||
"503": {
|
||
"description": "门户不可用"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/activation/instances/{instance_id}": {
|
||
"post": {
|
||
"operationId": "activateInstance",
|
||
"summary": "Activate pre-provisioned instance",
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/InstanceID"
|
||
},
|
||
{
|
||
"$ref": "#/components/parameters/IdempotencyKey"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"license_key",
|
||
"secret"
|
||
],
|
||
"properties": {
|
||
"license_key": {
|
||
"type": "string"
|
||
},
|
||
"secret": {
|
||
"type": "string",
|
||
"format": "password"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Activation certificate; verify data.certificate before accepting",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"instance_id": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"enum": [
|
||
"activated"
|
||
]
|
||
},
|
||
"certificate": {
|
||
"$ref": "#/components/schemas/Certificate"
|
||
}
|
||
}
|
||
},
|
||
"idempotent_replay": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/instances/{instance_id}/heartbeat": {
|
||
"post": {
|
||
"operationId": "heartbeat",
|
||
"summary": "Refresh signed runtime lease",
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/InstanceID"
|
||
},
|
||
{
|
||
"$ref": "#/components/parameters/IdempotencyKey"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"secret",
|
||
"client_time"
|
||
],
|
||
"properties": {
|
||
"secret": {
|
||
"type": "string",
|
||
"format": "password"
|
||
},
|
||
"client_time": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Signed lease; HTTP 200 does not imply active state",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/Lease"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"429": {
|
||
"description": "Rate limited; respect Retry-After",
|
||
"headers": {
|
||
"Retry-After": {
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/customers/{customer_id}/releases/{id}/download": {
|
||
"post": {
|
||
"operationId": "downloadRelease",
|
||
"summary": "Download entitled release; repeat credentials for Range retries",
|
||
"parameters": [
|
||
{
|
||
"name": "customer_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
}
|
||
},
|
||
{
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
}
|
||
},
|
||
{
|
||
"name": "Range",
|
||
"in": "header",
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"instance_id",
|
||
"secret"
|
||
],
|
||
"properties": {
|
||
"instance_id": {
|
||
"type": "string"
|
||
},
|
||
"secret": {
|
||
"type": "string",
|
||
"format": "password"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Full file (through configured download gateway)",
|
||
"content": {
|
||
"application/octet-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "binary"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"206": {
|
||
"description": "Partial file",
|
||
"headers": {
|
||
"Content-Range": {
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"content": {
|
||
"application/octet-stream": {
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "binary"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"416": {
|
||
"description": "Unsatisfiable Range"
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/activation/keyring": {
|
||
"get": {
|
||
"operationId": "discoverKeyring",
|
||
"summary": "Discovery only, NOT a trust-root bootstrap",
|
||
"responses": {
|
||
"200": {
|
||
"description": "Configured verification keys",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"current_key_id": {
|
||
"type": "string"
|
||
},
|
||
"keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"key_id": {
|
||
"type": "string"
|
||
},
|
||
"public_key_pem": {
|
||
"type": "string"
|
||
},
|
||
"revoked": {
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/instances/{instance_id}/updates/check": {
|
||
"post": {
|
||
"operationId": "checkForUpdate",
|
||
"summary": "返回实例绑定的签名 update-v1 策略与发布元数据",
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/InstanceID"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateCheckRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "Signed envelope; verify raw decoded payload before use",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/UpdateCheckResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/client/plans": {
|
||
"post": {
|
||
"operationId": "listClientPlans",
|
||
"summary": "List enabled fixed-day plans for bound product",
|
||
"security": [
|
||
{
|
||
"PurchaseBearer": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PurchaseInstallation"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "data envelope; consult purchase.md for recovery and trust rules",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"data"
|
||
],
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/ClientPlans"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/client/purchases": {
|
||
"post": {
|
||
"operationId": "createClientPurchase",
|
||
"summary": "Create or recover an idempotent purchase",
|
||
"security": [
|
||
{
|
||
"PurchaseBearer": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/IdempotencyKey"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PurchaseRequest"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "data envelope; consult purchase.md for recovery and trust rules",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"data"
|
||
],
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/PurchaseOrder"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/client/purchases/status": {
|
||
"post": {
|
||
"operationId": "clientPurchaseStatus",
|
||
"summary": "Recover by order_no or idempotency_key for same installation",
|
||
"security": [
|
||
{
|
||
"PurchaseBearer": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PurchaseLookup"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "data envelope; consult purchase.md for recovery and trust rules",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"data"
|
||
],
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/PurchaseOrder"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/client/purchases/claim": {
|
||
"post": {
|
||
"operationId": "claimClientPurchase",
|
||
"summary": "Claim same issued instance credentials idempotently",
|
||
"security": [
|
||
{
|
||
"PurchaseBearer": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PurchaseClaim"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "data envelope; consult purchase.md for recovery and trust rules",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"required": [
|
||
"data"
|
||
],
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/PurchaseCredentials"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"default": {
|
||
"$ref": "#/components/responses/Error"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"parameters": {
|
||
"InstanceID": {
|
||
"name": "instance_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"IdempotencyKey": {
|
||
"name": "Idempotency-Key",
|
||
"in": "header",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string"
|
||
},
|
||
"description": "Same key and unchanged body for retries of one operation; new key for a new operation"
|
||
}
|
||
},
|
||
"responses": {
|
||
"Error": {
|
||
"description": "See error.code and HTTP status; never blindly retry conflicts",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/Error"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"schemas": {
|
||
"Error": {
|
||
"type": "object",
|
||
"properties": {
|
||
"error": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "string"
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"Certificate": {
|
||
"type": "object",
|
||
"required": [
|
||
"version",
|
||
"payload",
|
||
"signature",
|
||
"canonical_sha256"
|
||
],
|
||
"properties": {
|
||
"version": {
|
||
"type": "string",
|
||
"enum": [
|
||
"license-v2"
|
||
]
|
||
},
|
||
"payload": {
|
||
"$ref": "#/components/schemas/CertificatePayload"
|
||
},
|
||
"signature": {
|
||
"type": "string",
|
||
"description": "ASN.1 DER ECDSA, unpadded standard Base64"
|
||
},
|
||
"canonical_sha256": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"CertificatePayload": {
|
||
"type": "object",
|
||
"additionalProperties": false,
|
||
"required": [
|
||
"version",
|
||
"instance_id",
|
||
"license_id",
|
||
"customer_id",
|
||
"product_id",
|
||
"starts_at",
|
||
"expires_at",
|
||
"key_id"
|
||
],
|
||
"properties": {
|
||
"version": {
|
||
"type": "string",
|
||
"enum": [
|
||
"license-v2"
|
||
]
|
||
},
|
||
"instance_id": {
|
||
"type": "string"
|
||
},
|
||
"license_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"customer_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"product_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"starts_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"expires_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"key_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"Lease": {
|
||
"type": "object",
|
||
"required": [
|
||
"payload",
|
||
"signature",
|
||
"canonical_sha256",
|
||
"algorithm",
|
||
"next_heartbeat_seconds"
|
||
],
|
||
"properties": {
|
||
"payload": {
|
||
"$ref": "#/components/schemas/LeasePayload"
|
||
},
|
||
"signature": {
|
||
"type": "string",
|
||
"description": "ASN.1 DER ECDSA, unpadded standard Base64"
|
||
},
|
||
"canonical_sha256": {
|
||
"type": "string"
|
||
},
|
||
"algorithm": {
|
||
"type": "string",
|
||
"enum": [
|
||
"ECDSA-P256-SHA256"
|
||
]
|
||
},
|
||
"next_heartbeat_seconds": {
|
||
"type": "integer",
|
||
"minimum": 60
|
||
}
|
||
}
|
||
},
|
||
"LeasePayload": {
|
||
"type": "object",
|
||
"additionalProperties": false,
|
||
"required": [
|
||
"version",
|
||
"instance_id",
|
||
"state",
|
||
"server_time",
|
||
"entitlement_expires_at",
|
||
"lease_expires_at",
|
||
"key_id"
|
||
],
|
||
"properties": {
|
||
"version": {
|
||
"type": "string",
|
||
"enum": [
|
||
"lease-v2"
|
||
]
|
||
},
|
||
"instance_id": {
|
||
"type": "string"
|
||
},
|
||
"state": {
|
||
"type": "string",
|
||
"enum": [
|
||
"active",
|
||
"frozen",
|
||
"revoked",
|
||
"expired",
|
||
"not_started",
|
||
"not_activated"
|
||
]
|
||
},
|
||
"server_time": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"entitlement_expires_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"lease_expires_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"key_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"UpdateCheckRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"secret",
|
||
"current_version",
|
||
"platform",
|
||
"arch",
|
||
"channel"
|
||
],
|
||
"properties": {
|
||
"secret": {
|
||
"type": "string",
|
||
"format": "password"
|
||
},
|
||
"current_version": {
|
||
"type": "string"
|
||
},
|
||
"platform": {
|
||
"type": "string"
|
||
},
|
||
"arch": {
|
||
"type": "string"
|
||
},
|
||
"channel": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"UpdateCheckResponse": {
|
||
"type": "object",
|
||
"required": [
|
||
"data"
|
||
],
|
||
"properties": {
|
||
"data": {
|
||
"$ref": "#/components/schemas/UpdateEnvelope"
|
||
}
|
||
}
|
||
},
|
||
"UpdateEnvelope": {
|
||
"type": "object",
|
||
"required": [
|
||
"payload",
|
||
"signature",
|
||
"key_id"
|
||
],
|
||
"properties": {
|
||
"payload": {
|
||
"type": "string",
|
||
"description": "Standard Base64 of raw UTF-8 JSON update-v1 payload"
|
||
},
|
||
"signature": {
|
||
"type": "string",
|
||
"description": "Unpadded standard Base64 DER ECDSA P-256 SHA-256 over decoded payload"
|
||
},
|
||
"key_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"UpdatePayload": {
|
||
"type": "object",
|
||
"additionalProperties": false,
|
||
"required": [
|
||
"version",
|
||
"instance_id",
|
||
"product_id",
|
||
"customer_id",
|
||
"current_version",
|
||
"platform",
|
||
"arch",
|
||
"channel",
|
||
"server_time",
|
||
"expires_at",
|
||
"policy_revision",
|
||
"policy_enabled",
|
||
"recommended_version",
|
||
"minimum_supported_version",
|
||
"enforce_after",
|
||
"mandatory",
|
||
"required_now",
|
||
"update_available",
|
||
"download_allowed",
|
||
"release_id",
|
||
"sha256",
|
||
"size_bytes",
|
||
"message"
|
||
],
|
||
"properties": {
|
||
"version": {
|
||
"type": "string",
|
||
"enum": [
|
||
"update-v1"
|
||
]
|
||
},
|
||
"instance_id": {
|
||
"type": "string"
|
||
},
|
||
"product_id": {
|
||
"type": "integer"
|
||
},
|
||
"customer_id": {
|
||
"type": "integer"
|
||
},
|
||
"current_version": {
|
||
"type": "string"
|
||
},
|
||
"platform": {
|
||
"type": "string"
|
||
},
|
||
"arch": {
|
||
"type": "string"
|
||
},
|
||
"channel": {
|
||
"type": "string"
|
||
},
|
||
"server_time": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"expires_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"policy_revision": {
|
||
"type": "integer",
|
||
"format": "int64",
|
||
"minimum": 0
|
||
},
|
||
"policy_enabled": {
|
||
"type": "boolean"
|
||
},
|
||
"recommended_version": {
|
||
"type": "string"
|
||
},
|
||
"minimum_supported_version": {
|
||
"type": "string"
|
||
},
|
||
"enforce_after": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"mandatory": {
|
||
"type": "boolean"
|
||
},
|
||
"required_now": {
|
||
"type": "boolean"
|
||
},
|
||
"update_available": {
|
||
"type": "boolean"
|
||
},
|
||
"download_allowed": {
|
||
"type": "boolean"
|
||
},
|
||
"release_id": {
|
||
"type": "integer",
|
||
"minimum": 0
|
||
},
|
||
"sha256": {
|
||
"type": "string"
|
||
},
|
||
"size_bytes": {
|
||
"type": "integer",
|
||
"minimum": 0
|
||
},
|
||
"message": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"PurchaseInstallation": {
|
||
"type": "object",
|
||
"required": [
|
||
"installation_id"
|
||
],
|
||
"properties": {
|
||
"installation_id": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"PaymentPlan": {
|
||
"type": "object",
|
||
"required": [
|
||
"id",
|
||
"product_id",
|
||
"code",
|
||
"name",
|
||
"amount_cents",
|
||
"currency",
|
||
"license_days",
|
||
"enabled",
|
||
"version"
|
||
],
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"product_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"code": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"amount_cents": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"currency": {
|
||
"type": "string",
|
||
"enum": [
|
||
"CNY"
|
||
]
|
||
},
|
||
"license_days": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"enabled": {
|
||
"type": "boolean"
|
||
},
|
||
"version": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
}
|
||
}
|
||
},
|
||
"ClientPlans": {
|
||
"type": "object",
|
||
"required": [
|
||
"plans",
|
||
"channels",
|
||
"license_duration",
|
||
"purchase_mode"
|
||
],
|
||
"properties": {
|
||
"plans": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/PaymentPlan"
|
||
}
|
||
},
|
||
"channels": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string",
|
||
"enum": [
|
||
"alipay",
|
||
"wechat"
|
||
]
|
||
}
|
||
},
|
||
"license_duration": {
|
||
"type": "string",
|
||
"enum": [
|
||
"fixed_days_from_payment"
|
||
]
|
||
},
|
||
"purchase_mode": {
|
||
"type": "string",
|
||
"enum": [
|
||
"new_purchase"
|
||
]
|
||
},
|
||
"customer_setup": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"PurchaseRequest": {
|
||
"type": "object",
|
||
"required": [
|
||
"plan_id",
|
||
"plan_version",
|
||
"installation_id",
|
||
"channel"
|
||
],
|
||
"properties": {
|
||
"plan_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"plan_version": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"installation_id": {
|
||
"type": "string"
|
||
},
|
||
"channel": {
|
||
"type": "string",
|
||
"enum": [
|
||
"alipay",
|
||
"wechat"
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"PurchaseLookup": {
|
||
"type": "object",
|
||
"required": [
|
||
"installation_id"
|
||
],
|
||
"description": "Provide either order_no or original idempotency_key",
|
||
"properties": {
|
||
"installation_id": {
|
||
"type": "string"
|
||
},
|
||
"order_no": {
|
||
"type": "string"
|
||
},
|
||
"idempotency_key": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"PurchaseClaim": {
|
||
"type": "object",
|
||
"required": [
|
||
"installation_id",
|
||
"order_no"
|
||
],
|
||
"properties": {
|
||
"installation_id": {
|
||
"type": "string"
|
||
},
|
||
"order_no": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"PurchaseOrder": {
|
||
"type": "object",
|
||
"required": [
|
||
"order_no",
|
||
"status",
|
||
"order_status",
|
||
"code_url",
|
||
"qr_expired",
|
||
"expires_at",
|
||
"amount_cents",
|
||
"currency",
|
||
"license_days",
|
||
"channel"
|
||
],
|
||
"properties": {
|
||
"order_no": {
|
||
"type": "string"
|
||
},
|
||
"status": {
|
||
"type": "string",
|
||
"enum": [
|
||
"created",
|
||
"paid"
|
||
]
|
||
},
|
||
"order_status": {
|
||
"type": "string",
|
||
"enum": [
|
||
"pending_payment",
|
||
"paid",
|
||
"issued"
|
||
]
|
||
},
|
||
"code_url": {
|
||
"type": "string"
|
||
},
|
||
"qr_expired": {
|
||
"type": "boolean",
|
||
"description": "QR display expiry only; not proof of channel closure"
|
||
},
|
||
"expires_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"amount_cents": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"currency": {
|
||
"type": "string",
|
||
"enum": [
|
||
"CNY"
|
||
]
|
||
},
|
||
"license_days": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
},
|
||
"channel": {
|
||
"type": "string",
|
||
"enum": [
|
||
"alipay",
|
||
"wechat"
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"PurchaseCredentials": {
|
||
"type": "object",
|
||
"required": [
|
||
"instance_id",
|
||
"secret",
|
||
"license_key",
|
||
"license_id"
|
||
],
|
||
"properties": {
|
||
"instance_id": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"secret": {
|
||
"type": "string",
|
||
"format": "password"
|
||
},
|
||
"license_key": {
|
||
"type": "string",
|
||
"format": "password"
|
||
},
|
||
"license_id": {
|
||
"type": "integer",
|
||
"minimum": 1
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"securitySchemes": {
|
||
"PurchaseBearer": {
|
||
"type": "http",
|
||
"scheme": "bearer",
|
||
"description": "Admin-issued 32-random-byte purchase credential, restricted to an existing customer/product; never an admin session"
|
||
}
|
||
}
|
||
}
|
||
}
|