PluginProbe
Media Cloud Sync / 1.2.3
Media Cloud Sync v1.2.3
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / google / google / common-protos / src / Api / HttpRule.php

HttpRule.php in Media Cloud Sync 1.2.3, at includes/sdk/google/google/common-protos/src/Api/HttpRule.php

621 lines 24.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 # Generated by the protocol buffer compiler. DO NOT EDIT!
4 # source: google/api/http.proto
5 namespace Dudlewebs\WPMCS\Google\Api;
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;
10 /**
11 * # gRPC Transcoding
12 * gRPC Transcoding is a feature for mapping between a gRPC method and one or
13 * more HTTP REST endpoints. It allows developers to build a single API service
14 * that supports both gRPC APIs and REST APIs. Many systems, including [Google
15 * APIs](https://github.com/googleapis/googleapis),
16 * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
17 * Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
18 * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
19 * and use it for large scale production services.
20 * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
21 * how different portions of the gRPC request message are mapped to the URL
22 * path, URL query parameters, and HTTP request body. It also controls how the
23 * gRPC response message is mapped to the HTTP response body. `HttpRule` is
24 * typically specified as an `google.api.http` annotation on the gRPC method.
25 * Each mapping specifies a URL path template and an HTTP method. The path
26 * template may refer to one or more fields in the gRPC request message, as long
27 * as each field is a non-repeated field with a primitive (non-message) type.
28 * The path template controls how fields of the request message are mapped to
29 * the URL path.
30 * Example:
31 * service Messaging {
32 * rpc GetMessage(GetMessageRequest) returns (Message) {
33 * option (google.api.http) = {
34 * get: "/v1/{name=messages/&#42;}"
35 * };
36 * }
37 * }
38 * message GetMessageRequest {
39 * string name = 1; // Mapped to URL path.
40 * }
41 * message Message {
42 * string text = 1; // The resource content.
43 * }
44 * This enables an HTTP REST to gRPC mapping as below:
45 * HTTP | gRPC
46 * -----|-----
47 * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
48 * Any fields in the request message which are not bound by the path template
49 * automatically become HTTP query parameters if there is no HTTP request body.
50 * For example:
51 * service Messaging {
52 * rpc GetMessage(GetMessageRequest) returns (Message) {
53 * option (google.api.http) = {
54 * get:"/v1/messages/{message_id}"
55 * };
56 * }
57 * }
58 * message GetMessageRequest {
59 * message SubMessage {
60 * string subfield = 1;
61 * }
62 * string message_id = 1; // Mapped to URL path.
63 * int64 revision = 2; // Mapped to URL query parameter `revision`.
64 * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
65 * }
66 * 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"))`
72 * Note that fields which are mapped to URL query parameters must have a
73 * primitive type or a repeated primitive type or a non-repeated message type.
74 * In the case of a repeated type, the parameter can be repeated in the URL
75 * as `...?param=A&param=B`. In the case of a message type, each field of the
76 * message is mapped to a separate parameter, such as
77 * `...?foo.a=A&foo.b=B&foo.c=C`.
78 * For HTTP methods that allow a request body, the `body` field
79 * specifies the mapping. Consider a REST update method on the
80 * message resource collection:
81 * service Messaging {
82 * rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
83 * option (google.api.http) = {
84 * patch: "/v1/messages/{message_id}"
85 * body: "message"
86 * };
87 * }
88 * }
89 * message UpdateMessageRequest {
90 * string message_id = 1; // mapped to the URL
91 * Message message = 2; // mapped to the body
92 * }
93 * The following HTTP JSON to RPC mapping is enabled, where the
94 * representation of the JSON in the request body is determined by
95 * protos JSON encoding:
96 * HTTP | gRPC
97 * -----|-----
98 * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
99 * "123456" message { text: "Hi!" })`
100 * The special name `*` can be used in the body mapping to define that
101 * every field not bound by the path template should be mapped to the
102 * request body. This enables the following alternative definition of
103 * the update method:
104 * service Messaging {
105 * rpc UpdateMessage(Message) returns (Message) {
106 * option (google.api.http) = {
107 * patch: "/v1/messages/{message_id}"
108 * body: "*"
109 * };
110 * }
111 * }
112 * message Message {
113 * string message_id = 1;
114 * string text = 2;
115 * }
116 * 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!")`
121 * Note that when using `*` in the body mapping, it is not possible to
122 * have HTTP parameters, as all fields not bound by the path end in
123 * the body. This makes this option more rarely used in practice when
124 * defining REST APIs. The common usage of `*` is in custom methods
125 * which don't use the URL at all for transferring data.
126 * It is possible to define multiple HTTP methods for one RPC by using
127 * the `additional_bindings` option. Example:
128 * service Messaging {
129 * rpc GetMessage(GetMessageRequest) returns (Message) {
130 * option (google.api.http) = {
131 * get: "/v1/messages/{message_id}"
132 * additional_bindings {
133 * get: "/v1/users/{user_id}/messages/{message_id}"
134 * }
135 * };
136 * }
137 * }
138 * message GetMessageRequest {
139 * string message_id = 1;
140 * string user_id = 2;
141 * }
142 * 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
149 * 1. Leaf request fields (recursive expansion nested messages in the request
150 * message) are classified into three categories:
151 * - Fields referred by the path template. They are passed via the URL path.
152 * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
153 * are passed via the HTTP
154 * request body.
155 * - All other fields are passed via the URL query parameters, and the
156 * parameter name is the field path in the request message. A repeated
157 * field can be represented as multiple query parameters under the same
158 * name.
159 * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
160 * query parameter, all fields
161 * are passed via URL path and HTTP request body.
162 * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
163 * request body, all
164 * fields are passed via URL path and URL query parameters.
165 * ### Path template syntax
166 * Template = "/" Segments [ Verb ] ;
167 * Segments = Segment { "/" Segment } ;
168 * Segment = "*" | "**" | LITERAL | Variable ;
169 * Variable = "{" FieldPath [ "=" Segments ] "}" ;
170 * FieldPath = IDENT { "." IDENT } ;
171 * Verb = ":" LITERAL ;
172 * The syntax `*` matches a single URL path segment. The syntax `**` matches
173 * zero or more URL path segments, which must be the last part of the URL path
174 * except the `Verb`.
175 * The syntax `Variable` matches part of the URL path as specified by its
176 * template. A variable template must not contain other variables. If a variable
177 * matches a single path segment, its template may be omitted, e.g. `{var}`
178 * is equivalent to `{var=*}`.
179 * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
180 * contains any reserved character, such characters should be percent-encoded
181 * before the matching.
182 * If a variable contains exactly one path segment, such as `"{var}"` or
183 * `"{var=*}"`, when such a variable is expanded into a URL path on the client
184 * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
185 * server side does the reverse decoding. Such variables show up in the
186 * [Discovery
187 * Document](https://developers.google.com/discovery/v1/reference/apis) as
188 * `{var}`.
189 * If a variable contains multiple path segments, such as `"{var=foo/&#42;}"`
190 * or `"{var=**}"`, when such a variable is expanded into a URL path on the
191 * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
192 * The server side does the reverse decoding, except "%2F" and "%2f" are left
193 * unchanged. Such variables show up in the
194 * [Discovery
195 * Document](https://developers.google.com/discovery/v1/reference/apis) as
196 * `{+var}`.
197 * ## Using gRPC API Service Configuration
198 * gRPC API Service Configuration (service config) is a configuration language
199 * for configuring a gRPC service to become a user-facing product. The
200 * service config is simply the YAML representation of the `google.api.Service`
201 * proto message.
202 * As an alternative to annotating your proto file, you can configure gRPC
203 * transcoding in your service config YAML files. You do this by specifying a
204 * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
205 * effect as the proto annotation. This can be particularly useful if you
206 * have a proto that is reused in multiple services. Note that any transcoding
207 * specified in the service config will override any matching transcoding
208 * configuration in the proto.
209 * Example:
210 * http:
211 * rules:
212 * # Selects a gRPC method and applies HttpRule to it.
213 * - selector: example.v1.Messaging.GetMessage
214 * get: /v1/messages/{message_id}/{sub.subfield}
215 * ## Special notes
216 * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
217 * proto to JSON conversion must follow the [proto3
218 * specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
219 * While the single segment variable follows the semantics of
220 * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
221 * Expansion, the multi segment variable **does not** follow RFC 6570 Section
222 * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
223 * does not expand special characters like `?` and `#`, which would lead
224 * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
225 * for multi segment variables.
226 * The path variables **must not** refer to any repeated or mapped field,
227 * because client libraries are not capable of handling such variable expansion.
228 * The path variables **must not** capture the leading "/" character. The reason
229 * is that the most common use case "{var}" does not capture the leading "/"
230 * character. For consistency, all path variables must share the same behavior.
231 * Repeated message fields must not be mapped to URL query parameters, because
232 * no client library can support such complicated mapping.
233 * If an API needs to use a JSON array for request or response body, it can map
234 * the request or response body to a repeated field. However, some gRPC
235 * Transcoding implementations may not support this feature.
236 *
237 * Generated from protobuf message <code>google.api.HttpRule</code>
238 */
239 class HttpRule extends \Dudlewebs\WPMCS\Google\Protobuf\Internal\Message
240 {
241 /**
242 * Selects a method to which this rule applies.
243 * Refer to [selector][google.api.DocumentationRule.selector] for syntax
244 * details.
245 *
246 * Generated from protobuf field <code>string selector = 1;</code>
247 */
248 protected $selector = '';
249 /**
250 * The name of the request field whose value is mapped to the HTTP request
251 * body, or `*` for mapping all request fields not captured by the path
252 * pattern to the HTTP body, or omitted for not having any HTTP request body.
253 * NOTE: the referred field must be present at the top-level of the request
254 * message type.
255 *
256 * Generated from protobuf field <code>string body = 7;</code>
257 */
258 protected $body = '';
259 /**
260 * Optional. The name of the response field whose value is mapped to the HTTP
261 * response body. When omitted, the entire response message will be used
262 * as the HTTP response body.
263 * NOTE: The referred field must be present at the top-level of the response
264 * message type.
265 *
266 * Generated from protobuf field <code>string response_body = 12;</code>
267 */
268 protected $response_body = '';
269 /**
270 * Additional HTTP bindings for the selector. Nested bindings must
271 * not contain an `additional_bindings` field themselves (that is,
272 * the nesting may only be one level deep).
273 *
274 * Generated from protobuf field <code>repeated .google.api.HttpRule additional_bindings = 11;</code>
275 */
276 private $additional_bindings;
277 protected $pattern;
278 /**
279 * Constructor.
280 *
281 * @param array $data {
282 * Optional. Data for populating the Message object.
283 *
284 * @type string $selector
285 * Selects a method to which this rule applies.
286 * Refer to [selector][google.api.DocumentationRule.selector] for syntax
287 * details.
288 * @type string $get
289 * Maps to HTTP GET. Used for listing and getting information about
290 * resources.
291 * @type string $put
292 * Maps to HTTP PUT. Used for replacing a resource.
293 * @type string $post
294 * Maps to HTTP POST. Used for creating a resource or performing an action.
295 * @type string $delete
296 * Maps to HTTP DELETE. Used for deleting a resource.
297 * @type string $patch
298 * Maps to HTTP PATCH. Used for updating a resource.
299 * @type \Google\Api\CustomHttpPattern $custom
300 * The custom pattern is used for specifying an HTTP method that is not
301 * included in the `pattern` field, such as HEAD, or "*" to leave the
302 * HTTP method unspecified for this rule. The wild-card rule is useful
303 * for services that provide content to Web (HTML) clients.
304 * @type string $body
305 * The name of the request field whose value is mapped to the HTTP request
306 * body, or `*` for mapping all request fields not captured by the path
307 * pattern to the HTTP body, or omitted for not having any HTTP request body.
308 * NOTE: the referred field must be present at the top-level of the request
309 * message type.
310 * @type string $response_body
311 * Optional. The name of the response field whose value is mapped to the HTTP
312 * response body. When omitted, the entire response message will be used
313 * as the HTTP response body.
314 * NOTE: The referred field must be present at the top-level of the response
315 * message type.
316 * @type array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $additional_bindings
317 * Additional HTTP bindings for the selector. Nested bindings must
318 * not contain an `additional_bindings` field themselves (that is,
319 * the nesting may only be one level deep).
320 * }
321 */
322 public function __construct($data = NULL)
323 {
324 \Dudlewebs\WPMCS\GPBMetadata\Google\Api\Http::initOnce();
325 parent::__construct($data);
326 }
327 /**
328 * Selects a method to which this rule applies.
329 * Refer to [selector][google.api.DocumentationRule.selector] for syntax
330 * details.
331 *
332 * Generated from protobuf field <code>string selector = 1;</code>
333 * @return string
334 */
335 public function getSelector()
336 {
337 return $this->selector;
338 }
339 /**
340 * Selects a method to which this rule applies.
341 * Refer to [selector][google.api.DocumentationRule.selector] for syntax
342 * details.
343 *
344 * Generated from protobuf field <code>string selector = 1;</code>
345 * @param string $var
346 * @return $this
347 */
348 public function setSelector($var)
349 {
350 GPBUtil::checkString($var, True);
351 $this->selector = $var;
352 return $this;
353 }
354 /**
355 * Maps to HTTP GET. Used for listing and getting information about
356 * resources.
357 *
358 * Generated from protobuf field <code>string get = 2;</code>
359 * @return string
360 */
361 public function getGet()
362 {
363 return $this->readOneof(2);
364 }
365 public function hasGet()
366 {
367 return $this->hasOneof(2);
368 }
369 /**
370 * Maps to HTTP GET. Used for listing and getting information about
371 * resources.
372 *
373 * Generated from protobuf field <code>string get = 2;</code>
374 * @param string $var
375 * @return $this
376 */
377 public function setGet($var)
378 {
379 GPBUtil::checkString($var, True);
380 $this->writeOneof(2, $var);
381 return $this;
382 }
383 /**
384 * Maps to HTTP PUT. Used for replacing a resource.
385 *
386 * Generated from protobuf field <code>string put = 3;</code>
387 * @return string
388 */
389 public function getPut()
390 {
391 return $this->readOneof(3);
392 }
393 public function hasPut()
394 {
395 return $this->hasOneof(3);
396 }
397 /**
398 * Maps to HTTP PUT. Used for replacing a resource.
399 *
400 * Generated from protobuf field <code>string put = 3;</code>
401 * @param string $var
402 * @return $this
403 */
404 public function setPut($var)
405 {
406 GPBUtil::checkString($var, True);
407 $this->writeOneof(3, $var);
408 return $this;
409 }
410 /**
411 * Maps to HTTP POST. Used for creating a resource or performing an action.
412 *
413 * Generated from protobuf field <code>string post = 4;</code>
414 * @return string
415 */
416 public function getPost()
417 {
418 return $this->readOneof(4);
419 }
420 public function hasPost()
421 {
422 return $this->hasOneof(4);
423 }
424 /**
425 * Maps to HTTP POST. Used for creating a resource or performing an action.
426 *
427 * Generated from protobuf field <code>string post = 4;</code>
428 * @param string $var
429 * @return $this
430 */
431 public function setPost($var)
432 {
433 GPBUtil::checkString($var, True);
434 $this->writeOneof(4, $var);
435 return $this;
436 }
437 /**
438 * Maps to HTTP DELETE. Used for deleting a resource.
439 *
440 * Generated from protobuf field <code>string delete = 5;</code>
441 * @return string
442 */
443 public function getDelete()
444 {
445 return $this->readOneof(5);
446 }
447 public function hasDelete()
448 {
449 return $this->hasOneof(5);
450 }
451 /**
452 * Maps to HTTP DELETE. Used for deleting a resource.
453 *
454 * Generated from protobuf field <code>string delete = 5;</code>
455 * @param string $var
456 * @return $this
457 */
458 public function setDelete($var)
459 {
460 GPBUtil::checkString($var, True);
461 $this->writeOneof(5, $var);
462 return $this;
463 }
464 /**
465 * Maps to HTTP PATCH. Used for updating a resource.
466 *
467 * Generated from protobuf field <code>string patch = 6;</code>
468 * @return string
469 */
470 public function getPatch()
471 {
472 return $this->readOneof(6);
473 }
474 public function hasPatch()
475 {
476 return $this->hasOneof(6);
477 }
478 /**
479 * Maps to HTTP PATCH. Used for updating a resource.
480 *
481 * Generated from protobuf field <code>string patch = 6;</code>
482 * @param string $var
483 * @return $this
484 */
485 public function setPatch($var)
486 {
487 GPBUtil::checkString($var, True);
488 $this->writeOneof(6, $var);
489 return $this;
490 }
491 /**
492 * The custom pattern is used for specifying an HTTP method that is not
493 * included in the `pattern` field, such as HEAD, or "*" to leave the
494 * HTTP method unspecified for this rule. The wild-card rule is useful
495 * for services that provide content to Web (HTML) clients.
496 *
497 * Generated from protobuf field <code>.google.api.CustomHttpPattern custom = 8;</code>
498 * @return \Google\Api\CustomHttpPattern|null
499 */
500 public function getCustom()
501 {
502 return $this->readOneof(8);
503 }
504 public function hasCustom()
505 {
506 return $this->hasOneof(8);
507 }
508 /**
509 * The custom pattern is used for specifying an HTTP method that is not
510 * included in the `pattern` field, such as HEAD, or "*" to leave the
511 * HTTP method unspecified for this rule. The wild-card rule is useful
512 * for services that provide content to Web (HTML) clients.
513 *
514 * Generated from protobuf field <code>.google.api.CustomHttpPattern custom = 8;</code>
515 * @param \Google\Api\CustomHttpPattern $var
516 * @return $this
517 */
518 public function setCustom($var)
519 {
520 GPBUtil::checkMessage($var, \Dudlewebs\WPMCS\Google\Api\CustomHttpPattern::class);
521 $this->writeOneof(8, $var);
522 return $this;
523 }
524 /**
525 * The name of the request field whose value is mapped to the HTTP request
526 * body, or `*` for mapping all request fields not captured by the path
527 * pattern to the HTTP body, or omitted for not having any HTTP request body.
528 * NOTE: the referred field must be present at the top-level of the request
529 * message type.
530 *
531 * Generated from protobuf field <code>string body = 7;</code>
532 * @return string
533 */
534 public function getBody()
535 {
536 return $this->body;
537 }
538 /**
539 * The name of the request field whose value is mapped to the HTTP request
540 * body, or `*` for mapping all request fields not captured by the path
541 * pattern to the HTTP body, or omitted for not having any HTTP request body.
542 * NOTE: the referred field must be present at the top-level of the request
543 * message type.
544 *
545 * Generated from protobuf field <code>string body = 7;</code>
546 * @param string $var
547 * @return $this
548 */
549 public function setBody($var)
550 {
551 GPBUtil::checkString($var, True);
552 $this->body = $var;
553 return $this;
554 }
555 /**
556 * Optional. The name of the response field whose value is mapped to the HTTP
557 * response body. When omitted, the entire response message will be used
558 * as the HTTP response body.
559 * NOTE: The referred field must be present at the top-level of the response
560 * message type.
561 *
562 * Generated from protobuf field <code>string response_body = 12;</code>
563 * @return string
564 */
565 public function getResponseBody()
566 {
567 return $this->response_body;
568 }
569 /**
570 * Optional. The name of the response field whose value is mapped to the HTTP
571 * response body. When omitted, the entire response message will be used
572 * as the HTTP response body.
573 * NOTE: The referred field must be present at the top-level of the response
574 * message type.
575 *
576 * Generated from protobuf field <code>string response_body = 12;</code>
577 * @param string $var
578 * @return $this
579 */
580 public function setResponseBody($var)
581 {
582 GPBUtil::checkString($var, True);
583 $this->response_body = $var;
584 return $this;
585 }
586 /**
587 * Additional HTTP bindings for the selector. Nested bindings must
588 * not contain an `additional_bindings` field themselves (that is,
589 * the nesting may only be one level deep).
590 *
591 * Generated from protobuf field <code>repeated .google.api.HttpRule additional_bindings = 11;</code>
592 * @return \Google\Protobuf\Internal\RepeatedField
593 */
594 public function getAdditionalBindings()
595 {
596 return $this->additional_bindings;
597 }
598 /**
599 * Additional HTTP bindings for the selector. Nested bindings must
600 * not contain an `additional_bindings` field themselves (that is,
601 * the nesting may only be one level deep).
602 *
603 * Generated from protobuf field <code>repeated .google.api.HttpRule additional_bindings = 11;</code>
604 * @param array<\Google\Api\HttpRule>|\Google\Protobuf\Internal\RepeatedField $var
605 * @return $this
606 */
607 public function setAdditionalBindings($var)
608 {
609 $arr = GPBUtil::checkRepeatedField($var, \Dudlewebs\WPMCS\Google\Protobuf\Internal\GPBType::MESSAGE, \Dudlewebs\WPMCS\Google\Api\HttpRule::class);
610 $this->additional_bindings = $arr;
611 return $this;
612 }
613 /**
614 * @return string
615 */
616 public function getPattern()
617 {
618 return $this->whichOneof("pattern");
619 }
620 }
621