summaryrefslogtreecommitdiffstats
path: root/vendor/gipfl/openrpc/src/Method.php
blob: 54226e3d0b43d6c6e0098d387a546a5e52f57d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php

namespace gipfl\OpenRpc;

use JsonSerializable;

/**
 * Describes the interface for the given method name. The method name is used
 * as the method field of the JSON-RPC body. It therefore MUST be unique.
 */
class Method implements JsonSerializable
{
    use SimpleJsonSerializer;

    /**
     * REQUIRED. The cannonical name for the method. The name MUST be unique
     * within the methods array.
     *
     * @var string
     */
    public $name;

    /**
     * A list of tags for API documentation control. Tags can be used for
     * logical grouping of methods by resources or any other qualifier.
     *
     * @var TagObject[]|Reference[]
     */
    public $tags;

    /**
     * A short summary of what the method does
     *
     * @var string|null
     */
    public $summary;

    /**
     * A verbose explanation of the method behavior. GitHub Flavored Markdown
     * syntax MAY be used for rich text representation.
     *
     * @var string|null
     */
    public $description;

    /**
     * Additional external documentation for this method
     *
     * @var ExternalDocumentation
     */
    public $externalDocs;

    /**
     * REQUIRED. A list of parameters that are applicable for this method. The
     * list MUST NOT include duplicated parameters and therefore require name
     * to be unique. The list can use the Reference Object to link to parameters
     * that are defined by the Content Descriptor Object. All optional params
     * (content descriptor objects with “required”: false) MUST be positioned
     * after all required params in the list.
     *
     * @var <ContentDescriptor|Reference>[]
     */
    public $params;

    /**
     * REQUIRED. The description of the result returned by the method. It MUST
     * be a Content Descriptor.
     *
     * @var ContentDescriptor|Reference
     */
    public $result;

    /**
     * Declares this method to be deprecated. Consumers SHOULD refrain from
     * usage of the declared method. Default value is false.
     *
     * @var boolean
     */
    public $deprecated;

    /**
     * An alternative servers array to service this method. If an alternative
     * servers array is specified at the Root level, it will be overridden by
     * this value.
     *
     * @var Server[]
     */
    public $servers;

    /**
     * A list of custom application defined errors that MAY be returned. The
     * Errors MUST have unique error codes.
     *
     * @var <Error|Reference>[]
     */
    public $errors;

    /**
     * A list of possible links from this method call
     *
     * @var <Link|Reference>[]
     */
    public $links;

    /**
     * The expected format of the parameters. As per the JSON-RPC 2.0 specification,
     * the params of a JSON-RPC request object may be an array, object, or either
     * (represented as by-position, by-name, and either respectively). When a method
     * has a paramStructure value of by-name, callers of the method MUST send a
     * JSON-RPC request object whose params field is an object. Further, the key
     * names of the params object MUST be the same as the contentDescriptor.names
     * for the given method. Defaults to "either".
     *
     * @var string "by-name" | "by-position" | "either"
     */
    public $paramStructure;

    /**
     * Array of Example Pairing Object where each example includes a valid
     * params-to-result Content Descriptor pairing.
     *
     * @var ExamplePairing []
     */
    public $examples;

    /**
     * @param $name
     */
    public function __construct($name)
    {
        $this->name = $name;
    }
}