frdl / oid-whois-rpc-method
OID 存储库查找 JSON-RPC 方法
dev-master
2020-06-11 11:02 UTC
Requires
- php: >=7.2
- frdl/event-module: *
- frdl/json-rpc-server-dicoverable: *
This package is auto-updated.
Last update: 2024-09-11 20:16:45 UTC
README
这是一个抽象基类,提供返回 OID-Whois-Look-Up-Result JSON-Schema 的 getResultSpec
方法,该结果是对 OIDPlus API 请求的响应。
<?php namespace frdlweb\Api\Whois\OID; use frdlweb\Api\Rpc\MethodDiscoverableInterface; use frdlweb\Api\Rpc\Server; use stdClass; use frdlweb\Api\Rpc\DiscoverMethod; abstract class OIDLookUpRpcMethod extends DiscoverMethod implements MethodDiscoverableInterface { /** * returns the expected JSON-RPC 2.0 Request Parameters Member as JSON-Schema * In this case positional arguments are required with only one element: the OID or the query * @ToDo (in the __invoke Method): - Validate the input parameter, e.g.: /^[0-9\.]+$/ */ public function getSpec(): ?\stdClass { return \json_decode(<<<'JSON' { "$schema": "https://json-schema.fullstack.org.cn/draft-07/schema#", "type": ["array"], "minItems": 1, "maxItems": 1, "items": { "type": ["string"] } } JSON ); } /** * returns the valid JSON-RPC 2.0 Response Result Member as JSON-Schema */ public function getResultSpec(): ?\stdClass { return \json_decode(' { "$schema": "https://look-up.webfan3.de/plugins/publicPages/095_attachments/download.php?id=oid:1.3.6.1.4.1.37553.8.1.8.1.13878.31765&filename=oid-look-up.json#", "type": ["null", "array", "object"], "properties": { }, "required" : [], "additionalProperties": true } ' ); } }