Documentation ¶
Index ¶
- type ABitOfEverythingNested
- type ABitOfEverythingServiceApi
- func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, ...) (*ExamplepbABitOfEverything, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, ...) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) GetRepeatedQuery(pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, ...) (*ExamplepbABitOfEverythingRepeated, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEverything, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
- func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
- type APIClient
- func (c *APIClient) CallAPI(path string, method string, postBody interface{}, ...) (*resty.Response, error)
- func (c *APIClient) ParameterToString(obj interface{}, collectionFormat string) string
- func (c *APIClient) SelectHeaderAccept(accepts []string) string
- func (c *APIClient) SelectHeaderContentType(contentTypes []string) string
- type APIResponse
- type CamelCaseServiceNameApi
- type Configuration
- type EchoRpcApi
- type EchoServiceApi
- type ExamplepbABitOfEverything
- type ExamplepbABitOfEverythingRepeated
- type ExamplepbBody
- type ExamplepbNumericEnum
- type ExamplepbUpdateV2Request
- type MessagePathEnumNestedPathEnum
- type NestedDeepEnum
- type PathenumPathEnum
- type ProtobufEmpty
- type ProtobufFieldMask
- type SubStringMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABitOfEverythingNested ¶
type ABitOfEverythingNested struct { // name is nested field. Name string `json:"name,omitempty"` Amount int64 `json:"amount,omitempty"` Ok NestedDeepEnum `json:"ok,omitempty"` }
Nested is nested type.
type ABitOfEverythingServiceApi ¶
type ABitOfEverythingServiceApi struct {
Configuration *Configuration
}
func NewABitOfEverythingServiceApi ¶
func NewABitOfEverythingServiceApi() *ABitOfEverythingServiceApi
func NewABitOfEverythingServiceApiWithBasePath ¶
func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythingServiceApi
func (ABitOfEverythingServiceApi) Create ¶
func (a ABitOfEverythingServiceApi) Create(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string, enumValue string, pathEnumValue string, nestedPathEnumValue string) (*ExamplepbABitOfEverything, *APIResponse, error)
*
- Create a new ABitOfEverything
- This API creates a new ABitOfEverything *
- @param floatValue
- @param doubleValue
- @param int64Value
- @param uint64Value
- @param int32Value
- @param fixed64Value
- @param fixed32Value
- @param boolValue
- @param stringValue
- @param uint32Value
- @param sfixed32Value
- @param sfixed64Value
- @param sint32Value
- @param sint64Value
- @param nonConventionalNameValue
- @param enumValue
- @param pathEnumValue
- @param nestedPathEnumValue
- @return *ExamplepbABitOfEverything
func (ABitOfEverythingServiceApi) CreateBody ¶
func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error)
*
* * * @param body * @return *ExamplepbABitOfEverything
func (ABitOfEverythingServiceApi) DeepPathEcho ¶
func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body ExamplepbABitOfEverything) (*ExamplepbABitOfEverything, *APIResponse, error)
*
* * * @param singleNestedName name is nested field. * @param body * @return *ExamplepbABitOfEverything
func (ABitOfEverythingServiceApi) Delete ¶
func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param uuid * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) ErrorWithDetails ¶ added in v1.4.0
func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResponse, error)
*
* * * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) GetMessageWithBody ¶ added in v1.3.1
func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param id * @param body * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) GetQuery ¶ added in v1.2.0
func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param uuid * @param singleNestedName name is nested field. * @param singleNestedAmount * @param singleNestedOk - FALSE: FALSE is false. - TRUE: TRUE is true. * @param floatValue * @param doubleValue * @param int64Value * @param uint64Value * @param int32Value * @param fixed64Value * @param fixed32Value * @param boolValue * @param stringValue * @param bytesValue * @param uint32Value * @param enumValue - ZERO: ZERO means 0 - ONE: ONE means 1 * @param pathEnumValue * @param nestedPathEnumValue * @param sfixed32Value * @param sfixed64Value * @param sint32Value * @param sint64Value * @param repeatedStringValue * @param oneofString * @param nonConventionalNameValue * @param timestampValue * @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1 * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) GetRepeatedQuery ¶ added in v1.5.0
func (a ABitOfEverythingServiceApi) GetRepeatedQuery(pathRepeatedFloatValue []float32, pathRepeatedDoubleValue []float64, pathRepeatedInt64Value []string, pathRepeatedUint64Value []string, pathRepeatedInt32Value []int32, pathRepeatedFixed64Value []string, pathRepeatedFixed32Value []int64, pathRepeatedBoolValue []bool, pathRepeatedStringValue []string, pathRepeatedBytesValue []string, pathRepeatedUint32Value []int64, pathRepeatedEnumValue []string, pathRepeatedSfixed32Value []int32, pathRepeatedSfixed64Value []string, pathRepeatedSint32Value []int32, pathRepeatedSint64Value []string) (*ExamplepbABitOfEverythingRepeated, *APIResponse, error)
*
* * * @param pathRepeatedFloatValue repeated values. they are comma-separated in path * @param pathRepeatedDoubleValue * @param pathRepeatedInt64Value * @param pathRepeatedUint64Value * @param pathRepeatedInt32Value * @param pathRepeatedFixed64Value * @param pathRepeatedFixed32Value * @param pathRepeatedBoolValue * @param pathRepeatedStringValue * @param pathRepeatedBytesValue * @param pathRepeatedUint32Value * @param pathRepeatedEnumValue * @param pathRepeatedSfixed32Value * @param pathRepeatedSfixed64Value * @param pathRepeatedSint32Value * @param pathRepeatedSint64Value * @return *ExamplepbABitOfEverythingRepeated
func (ABitOfEverythingServiceApi) Lookup ¶
func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEverything, *APIResponse, error)
*
* * * @param uuid * @return *ExamplepbABitOfEverything
func (ABitOfEverythingServiceApi) PatchWithFieldMaskInBody ¶ added in v1.6.0
func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param abeUuid * @param body * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) PostWithEmptyBody ¶ added in v1.4.0
func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param name * @param body * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) Timeout ¶
func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, error)
*
* * * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) Update ¶
func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param uuid * @param body * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) UpdateV2 ¶ added in v1.6.0
func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param abeUuid * @param body * @return *ProtobufEmpty
func (ABitOfEverythingServiceApi) UpdateV22 ¶ added in v1.6.0
func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error)
*
* * * @param abeUuid * @param body * @return *ProtobufEmpty
type APIClient ¶ added in v1.3.0
type APIClient struct {
// contains filtered or unexported fields
}
func (*APIClient) ParameterToString ¶ added in v1.3.0
func (*APIClient) SelectHeaderAccept ¶ added in v1.3.0
func (*APIClient) SelectHeaderContentType ¶ added in v1.3.0
type APIResponse ¶ added in v1.3.0
type APIResponse struct { *http.Response `json:"-"` Message string `json:"message,omitempty"` // Operation is the name of the swagger operation. Operation string `json:"operation,omitempty"` // RequestURL is the request URL. This value is always available, even if the // embedded *http.Response is nil. RequestURL string `json:"url,omitempty"` // Method is the HTTP method used for the request. This value is always // available, even if the embedded *http.Response is nil. Method string `json:"method,omitempty"` // Payload holds the contents of the response body (which may be nil or empty). // This is provided here as the raw response.Body() reader will have already // been drained. Payload []byte `json:"-"` }
func NewAPIResponse ¶ added in v1.3.0
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶ added in v1.3.0
func NewAPIResponseWithError(errorMessage string) *APIResponse
type CamelCaseServiceNameApi ¶ added in v1.4.0
type CamelCaseServiceNameApi struct {
Configuration *Configuration
}
func NewCamelCaseServiceNameApi ¶ added in v1.4.0
func NewCamelCaseServiceNameApi() *CamelCaseServiceNameApi
func NewCamelCaseServiceNameApiWithBasePath ¶ added in v1.4.0
func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNameApi
func (CamelCaseServiceNameApi) Empty ¶ added in v1.4.0
func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error)
*
- Create a new ABitOfEverything
- This API creates a new ABitOfEverything *
- @return *ProtobufEmpty
type Configuration ¶ added in v1.3.0
type Configuration struct { Username string `json:"userName,omitempty"` Password string `json:"password,omitempty"` APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"` APIKey map[string]string `json:"APIKey,omitempty"` Debug bool `json:"debug,omitempty"` DebugFile string `json:"debugFile,omitempty"` OAuthToken string `json:"oAuthToken,omitempty"` BasePath string `json:"basePath,omitempty"` Host string `json:"host,omitempty"` Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` UserAgent string `json:"userAgent,omitempty"` APIClient *APIClient Transport *http.Transport Timeout *time.Duration `json:"timeout,omitempty"` }
func NewConfiguration ¶ added in v1.3.0
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶ added in v1.3.0
func (c *Configuration) AddDefaultHeader(key string, value string)
func (*Configuration) GetAPIKeyWithPrefix ¶ added in v1.3.0
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string
func (*Configuration) GetBasicAuthEncodedString ¶ added in v1.3.0
func (c *Configuration) GetBasicAuthEncodedString() string
type EchoRpcApi ¶ added in v1.4.0
type EchoRpcApi struct {
Configuration *Configuration
}
func NewEchoRpcApi ¶ added in v1.4.0
func NewEchoRpcApi() *EchoRpcApi
func NewEchoRpcApiWithBasePath ¶ added in v1.4.0
func NewEchoRpcApiWithBasePath(basePath string) *EchoRpcApi
func (EchoRpcApi) Echo ¶ added in v1.4.0
func (a EchoRpcApi) Echo(value string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param value
- @return *SubStringMessage
func (EchoRpcApi) Echo2 ¶ added in v1.4.0
func (a EchoRpcApi) Echo2(body string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param body
- @return *SubStringMessage
func (EchoRpcApi) Echo3 ¶ added in v1.4.0
func (a EchoRpcApi) Echo3(value string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param value
- @return *SubStringMessage
type EchoServiceApi ¶ added in v1.4.0
type EchoServiceApi struct {
Configuration *Configuration
}
func NewEchoServiceApi ¶ added in v1.4.0
func NewEchoServiceApi() *EchoServiceApi
func NewEchoServiceApiWithBasePath ¶ added in v1.4.0
func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi
func (EchoServiceApi) Echo ¶ added in v1.4.0
func (a EchoServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param value
- @return *SubStringMessage
func (EchoServiceApi) Echo2 ¶ added in v1.4.0
func (a EchoServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param body
- @return *SubStringMessage
func (EchoServiceApi) Echo3 ¶ added in v1.4.0
func (a EchoServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error)
*
- Summary: Echo rpc
- Description Echo *
- @param value
- @return *SubStringMessage
type ExamplepbABitOfEverything ¶
type ExamplepbABitOfEverything struct { SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` Uuid string `json:"uuid"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` FloatValue float32 `json:"float_value,omitempty"` DoubleValue float64 `json:"double_value,omitempty"` Int64Value string `json:"int64_value,omitempty"` Uint64Value string `json:"uint64_value,omitempty"` Int32Value int32 `json:"int32_value,omitempty"` Fixed64Value string `json:"fixed64_value,omitempty"` Fixed32Value int64 `json:"fixed32_value,omitempty"` BoolValue bool `json:"bool_value,omitempty"` StringValue string `json:"string_value,omitempty"` BytesValue string `json:"bytes_value,omitempty"` Uint32Value int64 `json:"uint32_value,omitempty"` EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` PathEnumValue PathenumPathEnum `json:"path_enum_value,omitempty"` NestedPathEnumValue MessagePathEnumNestedPathEnum `json:"nested_path_enum_value,omitempty"` Sfixed32Value int32 `json:"sfixed32_value,omitempty"` Sfixed64Value string `json:"sfixed64_value,omitempty"` Sint32Value int32 `json:"sint32_value,omitempty"` Sint64Value string `json:"sint64_value,omitempty"` RepeatedStringValue []string `json:"repeated_string_value,omitempty"` OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` OneofString string `json:"oneof_string,omitempty"` MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` TimestampValue time.Time `json:"timestamp_value,omitempty"` RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` }
Intentionaly complicated message type to cover many features of Protobuf.
type ExamplepbABitOfEverythingRepeated ¶ added in v1.5.0
type ExamplepbABitOfEverythingRepeated struct { PathRepeatedFloatValue []float32 `json:"path_repeated_float_value,omitempty"` PathRepeatedDoubleValue []float64 `json:"path_repeated_double_value,omitempty"` PathRepeatedInt64Value []string `json:"path_repeated_int64_value,omitempty"` PathRepeatedUint64Value []string `json:"path_repeated_uint64_value,omitempty"` PathRepeatedInt32Value []int32 `json:"path_repeated_int32_value,omitempty"` PathRepeatedFixed64Value []string `json:"path_repeated_fixed64_value,omitempty"` PathRepeatedFixed32Value []int64 `json:"path_repeated_fixed32_value,omitempty"` PathRepeatedBoolValue []bool `json:"path_repeated_bool_value,omitempty"` PathRepeatedStringValue []string `json:"path_repeated_string_value,omitempty"` PathRepeatedBytesValue []string `json:"path_repeated_bytes_value,omitempty"` PathRepeatedUint32Value []int64 `json:"path_repeated_uint32_value,omitempty"` PathRepeatedEnumValue []ExamplepbNumericEnum `json:"path_repeated_enum_value,omitempty"` PathRepeatedSfixed32Value []int32 `json:"path_repeated_sfixed32_value,omitempty"` PathRepeatedSfixed64Value []string `json:"path_repeated_sfixed64_value,omitempty"` PathRepeatedSint32Value []int32 `json:"path_repeated_sint32_value,omitempty"` PathRepeatedSint64Value []string `json:"path_repeated_sint64_value,omitempty"` }
type ExamplepbBody ¶ added in v1.3.1
type ExamplepbBody struct {
Name string `json:"name,omitempty"`
}
type ExamplepbNumericEnum ¶
type ExamplepbNumericEnum struct { }
NumericEnum is one or zero. - ZERO: ZERO means 0 - ONE: ONE means 1
func (ExamplepbNumericEnum) String ¶ added in v1.5.0
func (e ExamplepbNumericEnum) String() string
String returns a string representation of "NumericEnum"
func (ExamplepbNumericEnum) UnmarshalJSON ¶ added in v1.5.0
func (e ExamplepbNumericEnum) UnmarshalJSON(b []byte) error
UnmarshalJSON does a no-op unmarshal to ExamplepbNumericEnum. It just validates that the input is sane.
type ExamplepbUpdateV2Request ¶ added in v1.6.0
type ExamplepbUpdateV2Request struct { Abe ExamplepbABitOfEverything `json:"abe,omitempty"` UpdateMask ProtobufFieldMask `json:"update_mask,omitempty"` }
type MessagePathEnumNestedPathEnum ¶ added in v1.5.0
type MessagePathEnumNestedPathEnum struct { }
func (MessagePathEnumNestedPathEnum) String ¶ added in v1.5.0
func (e MessagePathEnumNestedPathEnum) String() string
String returns a string representation of "MessagePathEnum"
func (MessagePathEnumNestedPathEnum) UnmarshalJSON ¶ added in v1.5.0
func (e MessagePathEnumNestedPathEnum) UnmarshalJSON(b []byte) error
UnmarshalJSON does a no-op unmarshal to MessagePathEnumNestedPathEnum. It just validates that the input is sane.
type NestedDeepEnum ¶
type NestedDeepEnum struct { }
DeepEnum is one or zero. - FALSE: FALSE is false. - TRUE: TRUE is true.
type PathenumPathEnum ¶ added in v1.5.0
type PathenumPathEnum struct { }
func (PathenumPathEnum) String ¶ added in v1.5.0
func (e PathenumPathEnum) String() string
String returns a string representation of "PathEnum"
func (PathenumPathEnum) UnmarshalJSON ¶ added in v1.5.0
func (e PathenumPathEnum) UnmarshalJSON(b []byte) error
UnmarshalJSON does a no-op unmarshal to PathenumPathEnum. It just validates that the input is sane.
type ProtobufEmpty ¶
type ProtobufEmpty struct { }
service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
type ProtobufFieldMask ¶ added in v1.6.0
type ProtobufFieldMask struct { // The set of field mask paths. Paths []string `json:"paths,omitempty"` }
paths: \"f.a\" paths: \"f.b.d\" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, the existing repeated values in the target resource will be overwritten by the new values. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then the existing sub-message in the target resource is overwritten. Given the target message: f { b { d : 1 x : 2 } c : 1 } And an update message: f { b { d : 10 } } then if the field mask is: paths: \"f.b\" then the result will be: f { b { d : 10 } c : 1 } However, if the update mask was: paths: \"f.b.d\" then the result would be: f { b { d : 10 x : 2 } c : 1 } In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: \"user.display_name\" paths: \"photo\" } In JSON, the same mask is represented as below: { mask: \"user.displayName,photo\" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: \"name\" } Or: mask { paths: \"sub_message\" } Note that oneof type names (\"test_oneof\" in this case) cannot be used in paths.
type SubStringMessage ¶
type SubStringMessage struct {
Value string `json:"value,omitempty"`
}
Source Files ¶
- a_bit_of_everything_nested.go
- a_bit_of_everything_service_api.go
- api_client.go
- api_response.go
- camel_case_service_name_api.go
- configuration.go
- echo_rpc_api.go
- echo_service_api.go
- enum_helper.go
- examplepb_a_bit_of_everything.go
- examplepb_a_bit_of_everything_repeated.go
- examplepb_body.go
- examplepb_numeric_enum.go
- examplepb_update_v2_request.go
- message_path_enum_nested_path_enum.go
- nested_deep_enum.go
- pathenum_path_enum.go
- protobuf_empty.go
- protobuf_field_mask.go
- sub_string_message.go