← All changes
|
includes/sdk/google/google/common-protos/src/Api/HttpRule.php
+32
-41
1.0.2
→
1.4.2
View file →
| @@ -1,15 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | # Generated by the protocol buffer compiler. DO NOT EDIT! |
| 4 | 4 | # source: google/api/http.proto |
| 5 | -namespace Dudlewebs\WPMCS\Google\Api; | |
| 5 | +namespace Dudlewebs\WPMCS\GCP\Google\Api; | |
| 6 | 6 | |
| 7 | -use Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBType; | |
| 8 | -use Dudlewebs\WPMCS\Google\Protobuf\Internal\RepeatedField; | |
| 9 | -use Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBUtil; | |
| 7 | +use Dudlewebs\WPMCS\GCP\Google\Protobuf\Internal\GPBType; | |
| 8 | +use Dudlewebs\WPMCS\GCP\Google\Protobuf\Internal\GPBUtil; | |
| 9 | +use Dudlewebs\WPMCS\GCP\Google\Protobuf\RepeatedField; | |
| 10 | 10 | /** |
| 11 | - * # gRPC Transcoding | |
| 11 | + * gRPC Transcoding | |
| 12 | 12 | * gRPC Transcoding is a feature for mapping between a gRPC method and one or |
| 13 | 13 | * more HTTP REST endpoints. It allows developers to build a single API service |
| 14 | 14 | * that supports both gRPC APIs and REST APIs. Many systems, including [Google |
| 15 | 15 | * APIs](https://github.com/googleapis/googleapis), |
| @@ -30,9 +30,9 @@ | ||
| 30 | 30 | * Example: |
| 31 | 31 | * service Messaging { |
| 32 | 32 | * rpc GetMessage(GetMessageRequest) returns (Message) { |
| 33 | 33 | * option (google.api.http) = { |
| 34 | - * get: "/v1/{name=messages/*}" | |
| 34 | + * get: "/v1/{name=messages/*}" | |
| 35 | 35 | * }; |
| 36 | 36 | * } |
| 37 | 37 | * } |
| 38 | 38 | * message GetMessageRequest { |
| @@ -41,11 +41,10 @@ | ||
| 41 | 41 | * message Message { |
| 42 | 42 | * string text = 1; // The resource content. |
| 43 | 43 | * } |
| 44 | 44 | * This enables an HTTP REST to gRPC mapping as below: |
| 45 | - * HTTP | gRPC | |
| 46 | - * -----|----- | |
| 47 | - * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` | |
| 45 | + * - HTTP: `GET /v1/messages/123456` | |
| 46 | + * - gRPC: `GetMessage(name: "messages/123456")` | |
| 48 | 47 | * Any fields in the request message which are not bound by the path template |
| 49 | 48 | * automatically become HTTP query parameters if there is no HTTP request body. |
| 50 | 49 | * For example: |
| 51 | 50 | * service Messaging { |
| @@ -63,13 +62,11 @@ | ||
| 63 | 62 | * int64 revision = 2; // Mapped to URL query parameter `revision`. |
| 64 | 63 | * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. |
| 65 | 64 | * } |
| 66 | 65 | * This enables a HTTP JSON to RPC mapping as below: |
| 67 | - * HTTP | gRPC | |
| 68 | - * -----|----- | |
| 69 | - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | | |
| 70 | - * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: | |
| 71 | - * "foo"))` | |
| 66 | + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` | |
| 67 | + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: | |
| 68 | + * SubMessage(subfield: "foo"))` | |
| 72 | 69 | * Note that fields which are mapped to URL query parameters must have a |
| 73 | 70 | * primitive type or a repeated primitive type or a non-repeated message type. |
| 74 | 71 | * In the case of a repeated type, the parameter can be repeated in the URL |
| 75 | 72 | * as `...?param=A¶m=B`. In the case of a message type, each field of the |
| @@ -92,12 +89,10 @@ | ||
| 92 | 89 | * } |
| 93 | 90 | * The following HTTP JSON to RPC mapping is enabled, where the |
| 94 | 91 | * representation of the JSON in the request body is determined by |
| 95 | 92 | * protos JSON encoding: |
| 96 | - * HTTP | gRPC | |
| 97 | - * -----|----- | |
| 98 | - * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: | |
| 99 | - * "123456" message { text: "Hi!" })` | |
| 93 | + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` | |
| 94 | + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` | |
| 100 | 95 | * The special name `*` can be used in the body mapping to define that |
| 101 | 96 | * every field not bound by the path template should be mapped to the |
| 102 | 97 | * request body. This enables the following alternative definition of |
| 103 | 98 | * the update method: |
| @@ -113,12 +108,10 @@ | ||
| 113 | 108 | * string message_id = 1; |
| 114 | 109 | * string text = 2; |
| 115 | 110 | * } |
| 116 | 111 | * The following HTTP JSON to RPC mapping is enabled: |
| 117 | - * HTTP | gRPC | |
| 118 | - * -----|----- | |
| 119 | - * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: | |
| 120 | - * "123456" text: "Hi!")` | |
| 112 | + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` | |
| 113 | + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` | |
| 121 | 114 | * Note that when using `*` in the body mapping, it is not possible to |
| 122 | 115 | * have HTTP parameters, as all fields not bound by the path end in |
| 123 | 116 | * the body. This makes this option more rarely used in practice when |
| 124 | 117 | * defining REST APIs. The common usage of `*` is in custom methods |
| @@ -139,14 +132,13 @@ | ||
| 139 | 132 | * string message_id = 1; |
| 140 | 133 | * string user_id = 2; |
| 141 | 134 | * } |
| 142 | 135 | * This enables the following two alternative HTTP JSON to RPC mappings: |
| 143 | - * HTTP | gRPC | |
| 144 | - * -----|----- | |
| 145 | - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` | |
| 146 | - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: | |
| 147 | - * "123456")` | |
| 148 | - * ## Rules for HTTP mapping | |
| 136 | + * - HTTP: `GET /v1/messages/123456` | |
| 137 | + * - gRPC: `GetMessage(message_id: "123456")` | |
| 138 | + * - HTTP: `GET /v1/users/me/messages/123456` | |
| 139 | + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` | |
| 140 | + * Rules for HTTP mapping | |
| 149 | 141 | * 1. Leaf request fields (recursive expansion nested messages in the request |
| 150 | 142 | * message) are classified into three categories: |
| 151 | 143 | * - Fields referred by the path template. They are passed via the URL path. |
| 152 | 144 | * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They |
| @@ -161,9 +153,9 @@ | ||
| 161 | 153 | * are passed via URL path and HTTP request body. |
| 162 | 154 | * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP |
| 163 | 155 | * request body, all |
| 164 | 156 | * fields are passed via URL path and URL query parameters. |
| 165 | - * ### Path template syntax | |
| 157 | + * Path template syntax | |
| 166 | 158 | * Template = "/" Segments [ Verb ] ; |
| 167 | 159 | * Segments = Segment { "/" Segment } ; |
| 168 | 160 | * Segment = "*" | "**" | LITERAL | Variable ; |
| 169 | 161 | * Variable = "{" FieldPath [ "=" Segments ] "}" ; |
| @@ -185,9 +177,9 @@ | ||
| 185 | 177 | * server side does the reverse decoding. Such variables show up in the |
| 186 | 178 | * [Discovery |
| 187 | 179 | * Document](https://developers.google.com/discovery/v1/reference/apis) as |
| 188 | 180 | * `{var}`. |
| 189 | - * If a variable contains multiple path segments, such as `"{var=foo/*}"` | |
| 181 | + * If a variable contains multiple path segments, such as `"{var=foo/*}"` | |
| 190 | 182 | * or `"{var=**}"`, when such a variable is expanded into a URL path on the |
| 191 | 183 | * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. |
| 192 | 184 | * The server side does the reverse decoding, except "%2F" and "%2f" are left |
| 193 | 185 | * unchanged. Such variables show up in the |
| @@ -193,9 +185,9 @@ | ||
| 193 | 185 | * unchanged. Such variables show up in the |
| 194 | 186 | * [Discovery |
| 195 | 187 | * Document](https://developers.google.com/discovery/v1/reference/apis) as |
| 196 | 188 | * `{+var}`. |
| 197 | - * ## Using gRPC API Service Configuration | |
| 189 | + * Using gRPC API Service Configuration | |
| 198 | 190 | * gRPC API Service Configuration (service config) is a configuration language |
| 199 | 191 | * for configuring a gRPC service to become a user-facing product. The |
| 200 | 192 | * service config is simply the YAML representation of the `google.api.Service` |
| 201 | 193 | * proto message. |
| @@ -205,15 +197,14 @@ | ||
| 205 | 197 | * effect as the proto annotation. This can be particularly useful if you |
| 206 | 198 | * have a proto that is reused in multiple services. Note that any transcoding |
| 207 | 199 | * specified in the service config will override any matching transcoding |
| 208 | 200 | * configuration in the proto. |
| 209 | - * Example: | |
| 201 | + * The following example selects a gRPC method and applies an `HttpRule` to it: | |
| 210 | 202 | * http: |
| 211 | 203 | * rules: |
| 212 | - * # Selects a gRPC method and applies HttpRule to it. | |
| 213 | 204 | * - selector: example.v1.Messaging.GetMessage |
| 214 | 205 | * get: /v1/messages/{message_id}/{sub.subfield} |
| 215 | - * ## Special notes | |
| 206 | + * Special notes | |
| 216 | 207 | * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the |
| 217 | 208 | * proto to JSON conversion must follow the [proto3 |
| 218 | 209 | * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). |
| 219 | 210 | * While the single segment variable follows the semantics of |
| @@ -235,9 +226,9 @@ | ||
| 235 | 226 | * Transcoding implementations may not support this feature. |
| 236 | 227 | * |
| 237 | 228 | * Generated from protobuf message <code>google.api.HttpRule</code> |
| 238 | 229 | */ |
| 239 | -class HttpRule extends \Dudlewebs\WPMCS\Google\Protobuf\Internal\Message | |
| 230 | +class HttpRule extends \Dudlewebs\WPMCS\GCP\Google\Protobuf\Internal\Message | |
| 240 | 231 | { |
| 241 | 232 | /** |
| 242 | 233 | * Selects a method to which this rule applies. |
| 243 | 234 | * Refer to [selector][google.api.DocumentationRule.selector] for syntax |
| @@ -312,9 +303,9 @@ | ||
| 312 | 303 | * response body. When omitted, the entire response message will be used |
| 313 | 304 | * as the HTTP response body. |
| 314 | 305 | * NOTE: The referred field must be present at the top-level of the response |
| 315 | 306 | * message type. |
| 316 | - * @type array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $additional_bindings | |
| 307 | + * @type \Google\Api\HttpRule[] $additional_bindings | |
| 317 | 308 | * Additional HTTP bindings for the selector. Nested bindings must |
| 318 | 309 | * not contain an `additional_bindings` field themselves (that is, |
| 319 | 310 | * the nesting may only be one level deep). |
| 320 | 311 | * } |
| @@ -320,9 +311,9 @@ | ||
| 320 | 311 | * } |
| 321 | 312 | */ |
| 322 | 313 | public function __construct($data = NULL) |
| 323 | 314 | { |
| 324 | - \Dudlewebs\WPMCS\GPBMetadata\Google\Api\Http::initOnce(); | |
| 315 | + \Dudlewebs\WPMCS\GCP\GPBMetadata\Google\Api\Http::initOnce(); | |
| 325 | 316 | parent::__construct($data); |
| 326 | 317 | } |
| 327 | 318 | /** |
| 328 | 319 | * Selects a method to which this rule applies. |
| @@ -516,9 +507,9 @@ | ||
| 516 | 507 | * @return $this |
| 517 | 508 | */ |
| 518 | 509 | public function setCustom($var) |
| 519 | 510 | { |
| 520 | - GPBUtil::checkMessage($var, \Dudlewebs\WPMCS\Google\Api\CustomHttpPattern::class); | |
| 511 | + GPBUtil::checkMessage($var, \Dudlewebs\WPMCS\GCP\Google\Api\CustomHttpPattern::class); | |
| 521 | 512 | $this->writeOneof(8, $var); |
| 522 | 513 | return $this; |
| 523 | 514 | } |
| 524 | 515 | /** |
| @@ -588,9 +579,9 @@ | ||
| 588 | 579 | * not contain an `additional_bindings` field themselves (that is, |
| 589 | 580 | * the nesting may only be one level deep). |
| 590 | 581 | * |
| 591 | 582 | * Generated from protobuf field <code>repeated .google.api.HttpRule additional_bindings = 11;</code> |
| 592 | - * @return \Google\Protobuf\Internal\RepeatedField | |
| 583 | + * @return RepeatedField<\Google\Api\HttpRule> | |
| 593 | 584 | */ |
| 594 | 585 | public function getAdditionalBindings() |
| 595 | 586 | { |
| 596 | 587 | return $this->additional_bindings; |
| @@ -600,14 +591,14 @@ | ||
| 600 | 591 | * not contain an `additional_bindings` field themselves (that is, |
| 601 | 592 | * the nesting may only be one level deep). |
| 602 | 593 | * |
| 603 | 594 | * Generated from protobuf field <code>repeated .google.api.HttpRule additional_bindings = 11;</code> |
| 604 | - * @param array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $var | |
| 595 | + * @param \Google\Api\HttpRule[] $var | |
| 605 | 596 | * @return $this |
| 606 | 597 | */ |
| 607 | 598 | public function setAdditionalBindings($var) |
| 608 | 599 | { |
| 609 | - $arr = GPBUtil::checkRepeatedField($var, \Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBType::MESSAGE, \Dudlewebs\WPMCS\Google\Api\HttpRule::class); | |
| 600 | + $arr = GPBUtil::checkRepeatedField($var, \Dudlewebs\WPMCS\GCP\Google\Protobuf\Internal\GPBType::MESSAGE, \Dudlewebs\WPMCS\GCP\Google\Api\HttpRule::class); | |
| 610 | 601 | $this->additional_bindings = $arr; |
| 611 | 602 | return $this; |
| 612 | 603 | } |
| 613 | 604 | /** |