models

package
v0.0.0-...-cbe41fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICollectionMetadata

type APICollectionMetadata struct {

	// ts when the collection was created
	// Format: date-time
	CreatedAt strfmt.DateTime `json:"CreatedAt,omitempty"`

	// ts when the collection was deleted
	// Format: date-time
	DeletedAt strfmt.DateTime `json:"DeletedAt,omitempty"`

	// cid (aka collectionId) would be used to naming ${collectionId} field, that field should be url safe
	// otherwise an error would be returned.
	// leave it empty would generate a random uuid for ${collectionId}
	CollectionID string `json:"collectionId,omitempty"`

	// pid is used to isolate resources (by projects), making the collections are belonged to a specific project
	ProjectID string `json:"projectId,omitempty"`
}

APICollectionMetadata api collection metadata

swagger:model apiCollectionMetadata

func (*APICollectionMetadata) ContextValidate

func (m *APICollectionMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this api collection metadata based on context it is used

func (*APICollectionMetadata) MarshalBinary

func (m *APICollectionMetadata) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APICollectionMetadata) UnmarshalBinary

func (m *APICollectionMetadata) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APICollectionMetadata) Validate

func (m *APICollectionMetadata) Validate(formats strfmt.Registry) error

Validate validates this api collection metadata

type APICollectionType

type APICollectionType string

APICollectionType api collection type

swagger:model apiCollectionType

const (

	// APICollectionTypeCOLLECTIONTYPENONE captures enum value "COLLECTION_TYPE_NONE"
	APICollectionTypeCOLLECTIONTYPENONE APICollectionType = "COLLECTION_TYPE_NONE"

	// APICollectionTypeCOLLECTIONTYPEREGULARFILES captures enum value "COLLECTION_TYPE_REGULAR_FILES"
	APICollectionTypeCOLLECTIONTYPEREGULARFILES APICollectionType = "COLLECTION_TYPE_REGULAR_FILES"

	// APICollectionTypeCOLLECTIONTYPETIMESERIES captures enum value "COLLECTION_TYPE_TIMESERIES"
	APICollectionTypeCOLLECTIONTYPETIMESERIES APICollectionType = "COLLECTION_TYPE_TIMESERIES"

	// APICollectionTypeCOLLECTIONTYPETRANSACTION captures enum value "COLLECTION_TYPE_TRANSACTION"
	APICollectionTypeCOLLECTIONTYPETRANSACTION APICollectionType = "COLLECTION_TYPE_TRANSACTION"

	// APICollectionTypeCOLLECTIONTYPEVECTOR captures enum value "COLLECTION_TYPE_VECTOR"
	APICollectionTypeCOLLECTIONTYPEVECTOR APICollectionType = "COLLECTION_TYPE_VECTOR"

	// APICollectionTypeCOLLECTIONTYPEPROXY captures enum value "COLLECTION_TYPE_PROXY"
	APICollectionTypeCOLLECTIONTYPEPROXY APICollectionType = "COLLECTION_TYPE_PROXY"
)

func NewAPICollectionType

func NewAPICollectionType(value APICollectionType) *APICollectionType

func (APICollectionType) ContextValidate

func (m APICollectionType) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this api collection type based on context it is used

func (APICollectionType) Pointer

func (m APICollectionType) Pointer() *APICollectionType

Pointer returns a pointer to a freshly-allocated APICollectionType.

func (APICollectionType) Validate

func (m APICollectionType) Validate(formats strfmt.Registry) error

Validate validates this api collection type

type APICreateCollectionRequest

type APICreateCollectionRequest struct {

	// collection Id
	CollectionID string `json:"collectionId,omitempty"`

	// collection type
	CollectionType *APICollectionType `json:"collectionType,omitempty"`

	// description
	Description string `json:"description,omitempty"`

	// project Id
	ProjectID string `json:"projectId,omitempty"`

	// schemas
	Schemas []*APISchemaField `json:"schemas"`
}

APICreateCollectionRequest api create collection request

swagger:model apiCreateCollectionRequest

func (*APICreateCollectionRequest) ContextValidate

func (m *APICreateCollectionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api create collection request based on the context it is used

func (*APICreateCollectionRequest) MarshalBinary

func (m *APICreateCollectionRequest) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APICreateCollectionRequest) UnmarshalBinary

func (m *APICreateCollectionRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APICreateCollectionRequest) Validate

func (m *APICreateCollectionRequest) Validate(formats strfmt.Registry) error

Validate validates this api create collection request

type APICreateCollectionResponse

type APICreateCollectionResponse struct {

	// metadata
	Metadata *APICollectionMetadata `json:"Metadata,omitempty"`

	// collection type
	CollectionType *APICollectionType `json:"collectionType,omitempty"`

	// description
	Description string `json:"description,omitempty"`

	// schemas
	Schemas []*APISchemaField `json:"schemas"`
}

APICreateCollectionResponse api create collection response

swagger:model apiCreateCollectionResponse

func (*APICreateCollectionResponse) ContextValidate

func (m *APICreateCollectionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api create collection response based on the context it is used

func (*APICreateCollectionResponse) MarshalBinary

func (m *APICreateCollectionResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APICreateCollectionResponse) UnmarshalBinary

func (m *APICreateCollectionResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APICreateCollectionResponse) Validate

func (m *APICreateCollectionResponse) Validate(formats strfmt.Registry) error

Validate validates this api create collection response

type APICreateDocumentRequest

type APICreateDocumentRequest struct {

	// collection Id
	CollectionID string `json:"collectionId,omitempty"`

	// data represents rawdata for any kind of formating
	// Format: byte
	Data strfmt.Base64 `json:"data,omitempty"`

	// dataformat
	Dataformat *APIDataFormat `json:"dataformat,omitempty"`

	// document Id
	DocumentID string `json:"documentId,omitempty"`

	// project Id
	ProjectID string `json:"projectId,omitempty"`
}

APICreateDocumentRequest api create document request

swagger:model apiCreateDocumentRequest

func (*APICreateDocumentRequest) ContextValidate

func (m *APICreateDocumentRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api create document request based on the context it is used

func (*APICreateDocumentRequest) MarshalBinary

func (m *APICreateDocumentRequest) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APICreateDocumentRequest) UnmarshalBinary

func (m *APICreateDocumentRequest) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APICreateDocumentRequest) Validate

func (m *APICreateDocumentRequest) Validate(formats strfmt.Registry) error

Validate validates this api create document request

type APICreateDocumentResponse

type APICreateDocumentResponse struct {

	// metadata
	Metadata *APIDataMetadata `json:"Metadata,omitempty"`
}

APICreateDocumentResponse api create document response

swagger:model apiCreateDocumentResponse

func (*APICreateDocumentResponse) ContextValidate

func (m *APICreateDocumentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api create document response based on the context it is used

func (*APICreateDocumentResponse) MarshalBinary

func (m *APICreateDocumentResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APICreateDocumentResponse) UnmarshalBinary

func (m *APICreateDocumentResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APICreateDocumentResponse) Validate

func (m *APICreateDocumentResponse) Validate(formats strfmt.Registry) error

Validate validates this api create document response

type APIDataFormat

type APIDataFormat string

APIDataFormat api data format

swagger:model apiDataFormat

const (

	// APIDataFormatDATAFORMATUNKNOWN captures enum value "DATA_FORMAT_UNKNOWN"
	APIDataFormatDATAFORMATUNKNOWN APIDataFormat = "DATA_FORMAT_UNKNOWN"

	// APIDataFormatDATAFORMATAUTO captures enum value "DATA_FORMAT_AUTO"
	APIDataFormatDATAFORMATAUTO APIDataFormat = "DATA_FORMAT_AUTO"

	// APIDataFormatDATAFORMATJSON captures enum value "DATA_FORMAT_JSON"
	APIDataFormatDATAFORMATJSON APIDataFormat = "DATA_FORMAT_JSON"

	// APIDataFormatDATAFORMATCSV captures enum value "DATA_FORMAT_CSV"
	APIDataFormatDATAFORMATCSV APIDataFormat = "DATA_FORMAT_CSV"

	// APIDataFormatDATAFORMATXML captures enum value "DATA_FORMAT_XML"
	APIDataFormatDATAFORMATXML APIDataFormat = "DATA_FORMAT_XML"

	// APIDataFormatDATAFORMATURL captures enum value "DATA_FORMAT_URL"
	APIDataFormatDATAFORMATURL APIDataFormat = "DATA_FORMAT_URL"

	// APIDataFormatDATAFORMATMEDIA captures enum value "DATA_FORMAT_MEDIA"
	APIDataFormatDATAFORMATMEDIA APIDataFormat = "DATA_FORMAT_MEDIA"
)

func NewAPIDataFormat

func NewAPIDataFormat(value APIDataFormat) *APIDataFormat

func (APIDataFormat) ContextValidate

func (m APIDataFormat) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this api data format based on context it is used

func (APIDataFormat) Pointer

func (m APIDataFormat) Pointer() *APIDataFormat

Pointer returns a pointer to a freshly-allocated APIDataFormat.

func (APIDataFormat) Validate

func (m APIDataFormat) Validate(formats strfmt.Registry) error

Validate validates this api data format

type APIDataMetadata

type APIDataMetadata struct {

	// ts when the record was created
	// Format: date-time
	CreatedAt strfmt.DateTime `json:"CreatedAt,omitempty"`

	// ts when the record was deleted
	// Format: date-time
	DeletedAt strfmt.DateTime `json:"DeletedAt,omitempty"`

	// cid is collection id from collection data
	CollectionID string `json:"collectionId,omitempty"`

	// dataformat
	Dataformat *APIDataFormat `json:"dataformat,omitempty"`

	// did (aka dataid) would be used to naming ${documentId} field, that field should be url safe
	DocumentID string `json:"documentId,omitempty"`

	// pid is project id
	ProjectID string `json:"projectId,omitempty"`
}

APIDataMetadata api data metadata

swagger:model apiDataMetadata

func (*APIDataMetadata) ContextValidate

func (m *APIDataMetadata) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api data metadata based on the context it is used

func (*APIDataMetadata) MarshalBinary

func (m *APIDataMetadata) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APIDataMetadata) UnmarshalBinary

func (m *APIDataMetadata) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APIDataMetadata) Validate

func (m *APIDataMetadata) Validate(formats strfmt.Registry) error

Validate validates this api data metadata

type APIDeleteCollectionResponse

type APIDeleteCollectionResponse interface{}

APIDeleteCollectionResponse api delete collection response

swagger:model apiDeleteCollectionResponse

type APIDeleteDocumentResponse

type APIDeleteDocumentResponse interface{}

APIDeleteDocumentResponse api delete document response

swagger:model apiDeleteDocumentResponse

type APIGetCollectionResponse

type APIGetCollectionResponse struct {

	// metadata
	Metadata *APICollectionMetadata `json:"Metadata,omitempty"`

	// collection type
	CollectionType *APICollectionType `json:"collectionType,omitempty"`

	// description
	Description string `json:"description,omitempty"`

	// schemas
	Schemas []*APISchemaField `json:"schemas"`
}

APIGetCollectionResponse api get collection response

swagger:model apiGetCollectionResponse

func (*APIGetCollectionResponse) ContextValidate

func (m *APIGetCollectionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api get collection response based on the context it is used

func (*APIGetCollectionResponse) MarshalBinary

func (m *APIGetCollectionResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APIGetCollectionResponse) UnmarshalBinary

func (m *APIGetCollectionResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APIGetCollectionResponse) Validate

func (m *APIGetCollectionResponse) Validate(formats strfmt.Registry) error

Validate validates this api get collection response

type APIGetDocumentResponse

type APIGetDocumentResponse struct {

	// metadata
	Metadata *APIDataMetadata `json:"Metadata,omitempty"`

	// data
	// Format: byte
	Data strfmt.Base64 `json:"data,omitempty"`
}

APIGetDocumentResponse api get document response

swagger:model apiGetDocumentResponse

func (*APIGetDocumentResponse) ContextValidate

func (m *APIGetDocumentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api get document response based on the context it is used

func (*APIGetDocumentResponse) MarshalBinary

func (m *APIGetDocumentResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APIGetDocumentResponse) UnmarshalBinary

func (m *APIGetDocumentResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APIGetDocumentResponse) Validate

func (m *APIGetDocumentResponse) Validate(formats strfmt.Registry) error

Validate validates this api get document response

type APIHTTPBody

type APIHTTPBody struct {

	// The HTTP Content-Type header value specifying the content type of the body.
	ContentType string `json:"contentType,omitempty"`

	// The HTTP request/response body as raw binary.
	// Format: byte
	Data strfmt.Base64 `json:"data,omitempty"`

	// Application specific response metadata. Must be set in the first response
	// for streaming APIs.
	Extensions []*ProtobufAny `json:"extensions"`
}

APIHTTPBody Message that represents an arbitrary HTTP body. It should only be used for payload formats that can't be represented as JSON, such as raw binary or an HTML page.

This message can be used both in streaming and non-streaming API methods in the request as well as the response.

It can be used as a top-level request field, which is convenient if one wants to extract parameters from either the URL or HTTP template into the request fields and also want access to the raw HTTP body.

Example:

message GetResourceRequest {
  // A unique request id.
  string request_id = 1;

  // The raw HTTP body is bound to this field.
  google.api.HttpBody http_body = 2;

}

service ResourceService {
  rpc GetResource(GetResourceRequest)
    returns (google.api.HttpBody);
  rpc UpdateResource(google.api.HttpBody)
    returns (google.protobuf.Empty);

}

Example with streaming methods:

service CaldavService {
  rpc GetCalendar(stream google.api.HttpBody)
    returns (stream google.api.HttpBody);
  rpc UpdateCalendar(stream google.api.HttpBody)
    returns (stream google.api.HttpBody);

}

Use of this type only changes how the request and response bodies are handled, all other features will continue to work unchanged.

swagger:model apiHttpBody

func (*APIHTTPBody) ContextValidate

func (m *APIHTTPBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api Http body based on the context it is used

func (*APIHTTPBody) MarshalBinary

func (m *APIHTTPBody) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APIHTTPBody) UnmarshalBinary

func (m *APIHTTPBody) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APIHTTPBody) Validate

func (m *APIHTTPBody) Validate(formats strfmt.Registry) error

Validate validates this api Http body

type APIListCollectionsResponse

type APIListCollectionsResponse interface{}

APIListCollectionsResponse api list collections response

swagger:model apiListCollectionsResponse

type APIQueryDocumentResponse

type APIQueryDocumentResponse struct {

	// docs
	Docs *APIGetDocumentResponse `json:"docs,omitempty"`
}

APIQueryDocumentResponse api query document response

swagger:model apiQueryDocumentResponse

func (*APIQueryDocumentResponse) ContextValidate

func (m *APIQueryDocumentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api query document response based on the context it is used

func (*APIQueryDocumentResponse) MarshalBinary

func (m *APIQueryDocumentResponse) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APIQueryDocumentResponse) UnmarshalBinary

func (m *APIQueryDocumentResponse) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APIQueryDocumentResponse) Validate

func (m *APIQueryDocumentResponse) Validate(formats strfmt.Registry) error

Validate validates this api query document response

type APISchemaField

type APISchemaField struct {

	// datatype
	Datatype *APISchemaFieldDataType `json:"datatype,omitempty"`

	// example
	Example *APISchemaFieldExampleValue `json:"example,omitempty"`

	// name
	Name string `json:"name,omitempty"`
}

APISchemaField api schema field

swagger:model apiSchemaField

func (*APISchemaField) ContextValidate

func (m *APISchemaField) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this api schema field based on the context it is used

func (*APISchemaField) MarshalBinary

func (m *APISchemaField) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APISchemaField) UnmarshalBinary

func (m *APISchemaField) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APISchemaField) Validate

func (m *APISchemaField) Validate(formats strfmt.Registry) error

Validate validates this api schema field

type APISchemaFieldDataType

type APISchemaFieldDataType string

APISchemaFieldDataType api schema field data type

swagger:model apiSchemaFieldDataType

const (

	// APISchemaFieldDataTypeSCHEMAFIELDDATATYPENONE captures enum value "SCHEMA_FIELD_DATA_TYPE_NONE"
	APISchemaFieldDataTypeSCHEMAFIELDDATATYPENONE APISchemaFieldDataType = "SCHEMA_FIELD_DATA_TYPE_NONE"

	// APISchemaFieldDataTypeSCHEMAFIELDDATATYPESTRING captures enum value "SCHEMA_FIELD_DATA_TYPE_STRING"
	APISchemaFieldDataTypeSCHEMAFIELDDATATYPESTRING APISchemaFieldDataType = "SCHEMA_FIELD_DATA_TYPE_STRING"

	// APISchemaFieldDataTypeSCHEMAFIELDDATATYPENUMBER captures enum value "SCHEMA_FIELD_DATA_TYPE_NUMBER"
	APISchemaFieldDataTypeSCHEMAFIELDDATATYPENUMBER APISchemaFieldDataType = "SCHEMA_FIELD_DATA_TYPE_NUMBER"

	// APISchemaFieldDataTypeSCHEMAFIELDDATATYPEINTEGER captures enum value "SCHEMA_FIELD_DATA_TYPE_INTEGER"
	APISchemaFieldDataTypeSCHEMAFIELDDATATYPEINTEGER APISchemaFieldDataType = "SCHEMA_FIELD_DATA_TYPE_INTEGER"

	// APISchemaFieldDataTypeSCHEMAFIELDDATATYPEBOOL captures enum value "SCHEMA_FIELD_DATA_TYPE_BOOL"
	APISchemaFieldDataTypeSCHEMAFIELDDATATYPEBOOL APISchemaFieldDataType = "SCHEMA_FIELD_DATA_TYPE_BOOL"
)

func NewAPISchemaFieldDataType

func NewAPISchemaFieldDataType(value APISchemaFieldDataType) *APISchemaFieldDataType

func (APISchemaFieldDataType) ContextValidate

func (m APISchemaFieldDataType) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this api schema field data type based on context it is used

func (APISchemaFieldDataType) Pointer

Pointer returns a pointer to a freshly-allocated APISchemaFieldDataType.

func (APISchemaFieldDataType) Validate

func (m APISchemaFieldDataType) Validate(formats strfmt.Registry) error

Validate validates this api schema field data type

type APISchemaFieldExampleValue

type APISchemaFieldExampleValue struct {

	// bool value
	BoolValue bool `json:"boolValue,omitempty"`

	// integer value
	IntegerValue string `json:"integerValue,omitempty"`

	// number value
	NumberValue float64 `json:"numberValue,omitempty"`

	// string value
	StringValue string `json:"stringValue,omitempty"`
}

APISchemaFieldExampleValue api schema field example value

swagger:model apiSchemaFieldExampleValue

func (*APISchemaFieldExampleValue) ContextValidate

func (m *APISchemaFieldExampleValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this api schema field example value based on context it is used

func (*APISchemaFieldExampleValue) MarshalBinary

func (m *APISchemaFieldExampleValue) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*APISchemaFieldExampleValue) UnmarshalBinary

func (m *APISchemaFieldExampleValue) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*APISchemaFieldExampleValue) Validate

func (m *APISchemaFieldExampleValue) Validate(formats strfmt.Registry) error

Validate validates this api schema field example value

type ProtobufAny

type ProtobufAny struct {

	// A URL/resource name that uniquely identifies the type of the serialized
	// protocol buffer message. This string must contain at least
	// one "/" character. The last segment of the URL's path must represent
	// the fully qualified name of the type (as in
	// `path/google.protobuf.Duration`). The name should be in a canonical form
	// (e.g., leading "." is not accepted).
	//
	// In practice, teams usually precompile into the binary all types that they
	// expect it to use in the context of Any. However, for URLs which use the
	// scheme `http`, `https`, or no scheme, one can optionally set up a type
	// server that maps type URLs to message definitions as follows:
	//
	// * If no scheme is provided, `https` is assumed.
	// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
	//   value in binary format, or produce an error.
	// * Applications are allowed to cache lookup results based on the
	//   URL, or have them precompiled into a binary to avoid any
	//   lookup. Therefore, binary compatibility needs to be preserved
	//   on changes to types. (Use versioned type names to manage
	//   breaking changes.)
	//
	// Note: this functionality is not currently available in the official
	// protobuf release, and it is not used for type URLs beginning with
	// type.googleapis.com.
	//
	// Schemes other than `http`, `https` (or the empty scheme) might be
	// used with implementation specific semantics.
	AtType string `json:"@type,omitempty"`
}

ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message.

Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type.

Example 1: Pack and unpack a message in C++.

Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
  ...
}

Example 2: Pack and unpack a message in Java.

Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
  foo = any.unpack(Foo.class);
}
// or ...
if (any.isSameTypeAs(Foo.getDefaultInstance())) {
  foo = any.unpack(Foo.getDefaultInstance());
}

Example 3: Pack and unpack a message in Python.

foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
  any.Unpack(foo)
  ...

Example 4: Pack and unpack a message in Go

foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
  ...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
  ...
}

The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z".

JSON

The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example:

package google.profile;
message Person {
  string first_name = 1;
  string last_name = 2;
}

{
  "@type": "type.googleapis.com/google.profile.Person",
  "firstName": <string>,
  "lastName": <string>
}

If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]):

{
  "@type": "type.googleapis.com/google.protobuf.Duration",
  "value": "1.212s"
}

swagger:model protobufAny

func (*ProtobufAny) ContextValidate

func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validates this protobuf any based on context it is used

func (*ProtobufAny) MarshalBinary

func (m *ProtobufAny) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*ProtobufAny) UnmarshalBinary

func (m *ProtobufAny) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*ProtobufAny) Validate

func (m *ProtobufAny) Validate(formats strfmt.Registry) error

Validate validates this protobuf any

type RPCStatus

type RPCStatus struct {

	// code
	Code int32 `json:"code,omitempty"`

	// details
	Details []*ProtobufAny `json:"details"`

	// message
	Message string `json:"message,omitempty"`
}

RPCStatus rpc status

swagger:model rpcStatus

func (*RPCStatus) ContextValidate

func (m *RPCStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error

ContextValidate validate this rpc status based on the context it is used

func (*RPCStatus) MarshalBinary

func (m *RPCStatus) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*RPCStatus) UnmarshalBinary

func (m *RPCStatus) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*RPCStatus) Validate

func (m *RPCStatus) Validate(formats strfmt.Registry) error

Validate validates this rpc status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL