diff --git a/openapi/spec.yaml b/openapi/spec.yaml new file mode 100644 index 0000000000..0001cccb6d --- /dev/null +++ b/openapi/spec.yaml @@ -0,0 +1,134 @@ +openapi: "3.0.0" +info: + title: OpenAPI of Django sspanel + description: "" + version: 0.0.1 +servers: + - url: http://127.0.0.1:8000/openapi/v1 + description: Local development server + +components: + securitySchemes: + OpenApiKeyAuth: + type: apiKey + in: header + name: x-api-key + schemas: + ProxyNode: + type: object + properties: + id: + type: integer + format: int64 + sequence: + type: integer + name: + type: string + server: + type: string + enable: + type: boolean + node_type: + type: string + info: + type: string + level: + type: integer + country: + type: string + used_traffic: + type: integer + total_traffic: + type: integer + provider_remark: + type: string + enable_udp: + type: boolean + current_used_download_bandwidth_bytes: + type: integer + current_used_upload_bandwidth_bytes: + type: integer + download_bandwidth_bytes: + type: integer + upload_bandwidth_bytes: + type: integer + required: + - id + - name + - server + - enable + - node_type + - info + - level + - country + - used_traffic + - total_traffic + - enlarge_scale + - provider_remark + - enable_udp + - current_used_download_bandwidth_bytes + - current_used_upload_bandwidth_bytes + - download_bandwidth_bytes + - upload_bandwidth_bytes + CommonErrorResp: + type: object + properties: + error_msg: + type: string + description: Error message + required: + - error_msg + UpdateProxyNodeReq: + type: object + properties: + enable: + type: boolean + description: Whether to enable or disable the ProxyNode + # TODO Add more properties as needed +security: + - OpenApiKeyAuth: [] + +paths: + /proxy_nodes/{node_id}/: + patch: + summary: Update a ProxyNode + tags: + - ProxyNode + parameters: + - name: node_id + in: path + required: true + schema: + type: integer + description: ID of the ProxyNode to update + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/UpdateProxyNodeReq" + responses: + 200: + description: Successful update + content: + application/json: + schema: + $ref: "#/components/schemas/ProxyNode" + 400: + description: Bad request + content: + application/json: + schema: + $ref: "#/components/schemas/CommonErrorResp" + 404: + description: ProxyNode not found + content: + application/json: + schema: + $ref: "#/components/schemas/CommonErrorResp" + 500: + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/CommonErrorResp"