eriktim / elm-protocol-buffers / Google.Protobuf

This module contains the Well-Known Types of Protocol Buffers. For the official and complete documentation, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf.

Models

Any


type alias Any =
{ typeUrl : String
, value : Bytes 
}

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

Api


type alias Api =
{ name : String
, methods : List Method
, options : List Option
, version : String
, sourceContext : Maybe SourceContext
, mixins : List Mixin
, syntax : Syntax 
}

Api is a light-weight descriptor for an API Interface.


type alias Method =
{ name : String
, requestTypeUrl : String
, requestStreaming : Basics.Bool
, responseTypeUrl : String
, responseStreaming : Basics.Bool
, options : List Option
, syntax : Syntax 
}

Method represents a method of an API interface.


type alias Mixin =
{ name : String
, root : String 
}

Declares an API Interface to be included in this interface.

Duration


type alias Duration =
{ seconds : Basics.Int
, nanos : Basics.Int 
}

A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp.

Warning: Range is only +/-68 years instead of the specified +/-10,000 as 64 bit integers are currently not supported.

Empty


type alias Empty =
{}

A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method.

FieldMask


type alias FieldMask =
{ paths : List String }

FieldMask represents a set of symbolic field paths.

SourceContext


type alias SourceContext =
{ fileName : String }

SourceContext represents information about the source of a protobuf element, like the file in which it is defined.

Struct


type alias Struct =
{ fields : StructFields }

Struct represents a structured data value, consisting of fields which map to dynamically typed values.


type StructFields
    = StructFields (Dict String (Maybe Value))

Wrapper type to work with recursive aliases.


type alias Value =
{ kind : ValueKind }

Value represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of that variants, absence of any variant indicates an error.


type ValueKind
    = ValueKind (Maybe KindType)

Wrapper type to work with recursive aliases.


type KindType
    = KindNullValue NullValue
    | KindNumberValue Basics.Float
    | KindStringValue String
    | KindBoolValue Basics.Bool
    | KindStructValue Struct
    | KindListValue ListValue

The kind of value.


type NullValue
    = NullValue
    | NullValueUnrecognized_ Basics.Int

NullValue is a singleton enumeration to represent the null value for the Value type union.


type alias ListValue =
{ values : ListValueValues }

ListValue is a wrapper around a repeated field of values.


type ListValueValues
    = ListValueValues (List Value)

Wrapper type to work with recursive aliases.

Timestamp


type alias Timestamp =
{ seconds : Basics.Int
, nanos : Basics.Int 
}

A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one.

All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap second table is needed for interpretation, using a 24-hour linear smear.

Warning: Range is only from 1901-12-13T20:45:52Z to 2038-01-19T03:14:07Z instead of the specified 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z as 64 bit integers are currently not supported.

Type


type alias Type =
{ name : String
, fields : List Field
, oneofs : List String
, options : List Option
, sourceContext : Maybe SourceContext
, syntax : Syntax 
}

A protocol buffer message type.


type alias Field =
{ kind : Kind
, cardinality : Cardinality
, number : Basics.Int
, name : String
, typeUrl : String
, oneofIndex : Basics.Int
, packed : Basics.Bool
, options : List Option
, jsonName : String
, defaultValue : String 
}

A single field of a message type.


type Kind
    = TypeUnknown
    | TypeDouble
    | TypeFloat
    | TypeInt64
    | TypeUint64
    | TypeInt32
    | TypeFixed64
    | TypeFixed32
    | TypeBool
    | TypeString
    | TypeGroup
    | TypeMessage
    | TypeBytes
    | TypeUint32
    | TypeEnum
    | TypeSfixed32
    | TypeSfixed64
    | TypeSint32
    | TypeSint64
    | KindUnrecognized_ Basics.Int

Basic field types.


type Cardinality
    = CardinalityUnknown
    | CardinalityOptional
    | CardinalityRequired
    | CardinalityRepeated
    | CardinalityUnrecognized_ Basics.Int

Whether a field is optional, required, or repeated.


type alias Enum =
{ name : String
, enumvalue : List EnumValue
, options : List Option
, sourceContext : Maybe SourceContext
, syntax : Syntax 
}

Enum type definition.


type alias EnumValue =
{ name : String
, number : Basics.Int
, options : List Option 
}

Enum value definition.


type alias Option =
{ name : String
, value : Maybe Any 
}

A protocol buffer option, which can be attached to a message, field, enumeration, etc.


type Syntax
    = SyntaxProto2
    | SyntaxProto3
    | SyntaxUnrecognized_ Basics.Int

The syntax in which a protocol buffer element is defined.

Wrappers

Int64Value and UInt64Value are not provided here as explained in the known limitations.


type alias DoubleValue =
{ value : Basics.Float }

Wrapper message for double.


type alias FloatValue =
{ value : Basics.Float }

Wrapper message for float.


type alias Int32Value =
{ value : Basics.Int }

Wrapper message for int32.


type alias UInt32Value =
{ value : Basics.Int }

Wrapper message for uint32.


type alias BoolValue =
{ value : Basics.Bool }

Wrapper message for bool.


type alias StringValue =
{ value : String }

Wrapper message for string.


type alias BytesValue =
{ value : Bytes }

Wrapper message for bytes.

Decoders

The package exposes decoders for all top-level well-known types.

anyDecoder : Protobuf.Decode.Decoder Any

apiDecoder : Protobuf.Decode.Decoder Api

methodDecoder : Protobuf.Decode.Decoder Method

mixinDecoder : Protobuf.Decode.Decoder Mixin

durationDecoder : Protobuf.Decode.Decoder Duration

emptyDecoder : Protobuf.Decode.Decoder Empty

fieldMaskDecoder : Protobuf.Decode.Decoder FieldMask

sourceContextDecoder : Protobuf.Decode.Decoder SourceContext

structDecoder : Protobuf.Decode.Decoder Struct

valueDecoder : Protobuf.Decode.Decoder Value

listValueDecoder : Protobuf.Decode.Decoder ListValue

timestampDecoder : Protobuf.Decode.Decoder Timestamp

typeDecoder : Protobuf.Decode.Decoder Type

fieldDecoder : Protobuf.Decode.Decoder Field

kindDecoder : Protobuf.Decode.Decoder Kind

cardinalityDecoder : Protobuf.Decode.Decoder Cardinality

enumDecoder : Protobuf.Decode.Decoder Enum

enumValueDecoder : Protobuf.Decode.Decoder EnumValue

optionDecoder : Protobuf.Decode.Decoder Option

syntaxDecoder : Protobuf.Decode.Decoder Syntax

doubleValueDecoder : Protobuf.Decode.Decoder DoubleValue

floatValueDecoder : Protobuf.Decode.Decoder FloatValue

int32ValueDecoder : Protobuf.Decode.Decoder Int32Value

uInt32ValueDecoder : Protobuf.Decode.Decoder UInt32Value

boolValueDecoder : Protobuf.Decode.Decoder BoolValue

stringValueDecoder : Protobuf.Decode.Decoder StringValue

bytesValueDecoder : Protobuf.Decode.Decoder BytesValue

Encoders

The package exposes encoders for all top-level well-known types.

toAnyEncoder : Any -> Protobuf.Encode.Encoder

toApiEncoder : Api -> Protobuf.Encode.Encoder

toMethodEncoder : Method -> Protobuf.Encode.Encoder

toMixinEncoder : Mixin -> Protobuf.Encode.Encoder

toDurationEncoder : Duration -> Protobuf.Encode.Encoder

toEmptyEncoder : Empty -> Protobuf.Encode.Encoder

toFieldMaskEncoder : FieldMask -> Protobuf.Encode.Encoder

toSourceContextEncoder : SourceContext -> Protobuf.Encode.Encoder

toStructEncoder : Struct -> Protobuf.Encode.Encoder

toValueEncoder : Value -> Protobuf.Encode.Encoder

toListValueEncoder : ListValue -> Protobuf.Encode.Encoder

toTimestampEncoder : Timestamp -> Protobuf.Encode.Encoder

toTypeEncoder : Type -> Protobuf.Encode.Encoder

toFieldEncoder : Field -> Protobuf.Encode.Encoder

toKindEncoder : Kind -> Protobuf.Encode.Encoder

toCardinalityEncoder : Cardinality -> Protobuf.Encode.Encoder

toEnumEncoder : Enum -> Protobuf.Encode.Encoder

toEnumValueEncoder : EnumValue -> Protobuf.Encode.Encoder

toOptionEncoder : Option -> Protobuf.Encode.Encoder

toSyntaxEncoder : Syntax -> Protobuf.Encode.Encoder

toDoubleValueEncoder : DoubleValue -> Protobuf.Encode.Encoder

toFloatValueEncoder : FloatValue -> Protobuf.Encode.Encoder

toInt32ValueEncoder : Int32Value -> Protobuf.Encode.Encoder

toUInt32ValueEncoder : UInt32Value -> Protobuf.Encode.Encoder

toBoolValueEncoder : BoolValue -> Protobuf.Encode.Encoder

toStringValueEncoder : StringValue -> Protobuf.Encode.Encoder

toBytesValueEncoder : BytesValue -> Protobuf.Encode.Encoder