1<?php 2# Generated by the protocol buffer compiler. DO NOT EDIT! 3# source: google/protobuf/field_mask.proto 4 5namespace Google\Protobuf; 6 7use Google\Protobuf\Internal\GPBType; 8use Google\Protobuf\Internal\RepeatedField; 9use Google\Protobuf\Internal\GPBUtil; 10 11/** 12 * `FieldMask` represents a set of symbolic field paths, for example: 13 * paths: "f.a" 14 * paths: "f.b.d" 15 * Here `f` represents a field in some root message, `a` and `b` 16 * fields in the message found in `f`, and `d` a field found in the 17 * message in `f.b`. 18 * Field masks are used to specify a subset of fields that should be 19 * returned by a get operation or modified by an update operation. 20 * Field masks also have a custom JSON encoding (see below). 21 * # Field Masks in Projections 22 * When used in the context of a projection, a response message or 23 * sub-message is filtered by the API to only contain those fields as 24 * specified in the mask. For example, if the mask in the previous 25 * example is applied to a response message as follows: 26 * f { 27 * a : 22 28 * b { 29 * d : 1 30 * x : 2 31 * } 32 * y : 13 33 * } 34 * z: 8 35 * The result will not contain specific values for fields x,y and z 36 * (their value will be set to the default, and omitted in proto text 37 * output): 38 * f { 39 * a : 22 40 * b { 41 * d : 1 42 * } 43 * } 44 * A repeated field is not allowed except at the last position of a 45 * paths string. 46 * If a FieldMask object is not present in a get operation, the 47 * operation applies to all fields (as if a FieldMask of all fields 48 * had been specified). 49 * Note that a field mask does not necessarily apply to the 50 * top-level response message. In case of a REST get operation, the 51 * field mask applies directly to the response, but in case of a REST 52 * list operation, the mask instead applies to each individual message 53 * in the returned resource list. In case of a REST custom method, 54 * other definitions may be used. Where the mask applies will be 55 * clearly documented together with its declaration in the API. In 56 * any case, the effect on the returned resource/resources is required 57 * behavior for APIs. 58 * # Field Masks in Update Operations 59 * A field mask in update operations specifies which fields of the 60 * targeted resource are going to be updated. The API is required 61 * to only change the values of the fields as specified in the mask 62 * and leave the others untouched. If a resource is passed in to 63 * describe the updated values, the API ignores the values of all 64 * fields not covered by the mask. 65 * If a repeated field is specified for an update operation, the existing 66 * repeated values in the target resource will be overwritten by the new values. 67 * Note that a repeated field is only allowed in the last position of a `paths` 68 * string. 69 * If a sub-message is specified in the last position of the field mask for an 70 * update operation, then the existing sub-message in the target resource is 71 * overwritten. Given the target message: 72 * f { 73 * b { 74 * d : 1 75 * x : 2 76 * } 77 * c : 1 78 * } 79 * And an update message: 80 * f { 81 * b { 82 * d : 10 83 * } 84 * } 85 * then if the field mask is: 86 * paths: "f.b" 87 * then the result will be: 88 * f { 89 * b { 90 * d : 10 91 * } 92 * c : 1 93 * } 94 * However, if the update mask was: 95 * paths: "f.b.d" 96 * then the result would be: 97 * f { 98 * b { 99 * d : 10 100 * x : 2 101 * } 102 * c : 1 103 * } 104 * In order to reset a field's value to the default, the field must 105 * be in the mask and set to the default value in the provided resource. 106 * Hence, in order to reset all fields of a resource, provide a default 107 * instance of the resource and set all fields in the mask, or do 108 * not provide a mask as described below. 109 * If a field mask is not present on update, the operation applies to 110 * all fields (as if a field mask of all fields has been specified). 111 * Note that in the presence of schema evolution, this may mean that 112 * fields the client does not know and has therefore not filled into 113 * the request will be reset to their default. If this is unwanted 114 * behavior, a specific service may require a client to always specify 115 * a field mask, producing an error if not. 116 * As with get operations, the location of the resource which 117 * describes the updated values in the request message depends on the 118 * operation kind. In any case, the effect of the field mask is 119 * required to be honored by the API. 120 * ## Considerations for HTTP REST 121 * The HTTP kind of an update operation which uses a field mask must 122 * be set to PATCH instead of PUT in order to satisfy HTTP semantics 123 * (PUT must only be used for full updates). 124 * # JSON Encoding of Field Masks 125 * In JSON, a field mask is encoded as a single string where paths are 126 * separated by a comma. Fields name in each path are converted 127 * to/from lower-camel naming conventions. 128 * As an example, consider the following message declarations: 129 * message Profile { 130 * User user = 1; 131 * Photo photo = 2; 132 * } 133 * message User { 134 * string display_name = 1; 135 * string address = 2; 136 * } 137 * In proto a field mask for `Profile` may look as such: 138 * mask { 139 * paths: "user.display_name" 140 * paths: "photo" 141 * } 142 * In JSON, the same mask is represented as below: 143 * { 144 * mask: "user.displayName,photo" 145 * } 146 * # Field Masks and Oneof Fields 147 * Field masks treat fields in oneofs just as regular fields. Consider the 148 * following message: 149 * message SampleMessage { 150 * oneof test_oneof { 151 * string name = 4; 152 * SubMessage sub_message = 9; 153 * } 154 * } 155 * The field mask can be: 156 * mask { 157 * paths: "name" 158 * } 159 * Or: 160 * mask { 161 * paths: "sub_message" 162 * } 163 * Note that oneof type names ("test_oneof" in this case) cannot be used in 164 * paths. 165 * ## Field Mask Verification 166 * The implementation of any API method which has a FieldMask type field in the 167 * request should verify the included field paths, and return an 168 * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. 169 * 170 * Generated from protobuf message <code>google.protobuf.FieldMask</code> 171 */ 172class FieldMask extends \Google\Protobuf\Internal\Message 173{ 174 /** 175 * The set of field mask paths. 176 * 177 * Generated from protobuf field <code>repeated string paths = 1;</code> 178 */ 179 private $paths; 180 181 /** 182 * Constructor. 183 * 184 * @param array $data { 185 * Optional. Data for populating the Message object. 186 * 187 * @type string[]|\Google\Protobuf\Internal\RepeatedField $paths 188 * The set of field mask paths. 189 * } 190 */ 191 public function __construct($data = NULL) { 192 \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); 193 parent::__construct($data); 194 } 195 196 /** 197 * The set of field mask paths. 198 * 199 * Generated from protobuf field <code>repeated string paths = 1;</code> 200 * @return \Google\Protobuf\Internal\RepeatedField 201 */ 202 public function getPaths() 203 { 204 return $this->paths; 205 } 206 207 /** 208 * The set of field mask paths. 209 * 210 * Generated from protobuf field <code>repeated string paths = 1;</code> 211 * @param string[]|\Google\Protobuf\Internal\RepeatedField $var 212 * @return $this 213 */ 214 public function setPaths($var) 215 { 216 $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); 217 $this->paths = $arr; 218 219 return $this; 220 } 221 222} 223 224