tiziano88 / elm-protobuf / Protobuf

Runtime library for Google Protocol Buffers.

This is mostly useless on its own, it is meant to support the code generated by the Elm Protocol Buffer compiler.

Decoder Helpers

decode : a -> Json.Decode.Decoder a

Decodes a message.

required : String -> Json.Decode.Decoder a -> a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b

Decodes a required field.

optional : String -> Json.Decode.Decoder a -> Json.Decode.Decoder (Maybe a -> b) -> Json.Decode.Decoder b

Decodes an optional field.

repeated : String -> Json.Decode.Decoder a -> Json.Decode.Decoder (List a -> b) -> Json.Decode.Decoder b

Decodes a repeated field.

field : Json.Decode.Decoder a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b

Decodes a field.

withDefault : a -> Json.Decode.Decoder a -> Json.Decode.Decoder a

Provides a default value for a field.

intDecoder : Json.Decode.Decoder Basics.Int

Decodes an Int from either a string or numeric.

fromResult : Result String a -> Json.Decode.Decoder a

Turns a Result in to a Decoder Taken from https://github.com/elm-community/json-extra/blob/2.7.0/src/Json/Decode/Extra.elm#L388

Encoder Helpers

requiredFieldEncoder : String -> (a -> Json.Encode.Value) -> a -> a -> Maybe ( String, Json.Encode.Value )

Encodes a required field.

optionalEncoder : String -> (a -> Json.Encode.Value) -> Maybe a -> Maybe ( String, Json.Encode.Value )

Encodes an optional field.

repeatedFieldEncoder : String -> (a -> Json.Encode.Value) -> List a -> Maybe ( String, Json.Encode.Value )

Encodes a repeated field.

numericStringEncoder : Basics.Int -> Json.Encode.Value

Encodes an Int as a JSON string, for emitting to int64 proto3 fields

Bytes


type alias Bytes =
List Basics.Int

Bytes field.

bytesFieldDecoder : Json.Decode.Decoder Bytes

Decodes a bytes field. TODO: Implement.

bytesFieldEncoder : Bytes -> Json.Encode.Value

Encodes a bytes field. TODO: Implement.

Well Known Types


type alias Timestamp =
Time.Posix

Timestamp.

timestampDecoder : Json.Decode.Decoder Timestamp

Decodes a Timestamp.

timestampEncoder : Timestamp -> Json.Encode.Value

Encodes a Timestamp.

intValueDecoder : Json.Decode.Decoder Basics.Int

Decodes an IntValue.

intValueEncoder : Basics.Int -> Json.Encode.Value

Encodes an IntValue.

stringValueDecoder : Json.Decode.Decoder String

Decodes a StringValue.

stringValueEncoder : String -> Json.Encode.Value

Encodes a StringValue.

boolValueDecoder : Json.Decode.Decoder Basics.Bool

Encodes a BoolValue.

boolValueEncoder : Basics.Bool -> Json.Encode.Value

Encodes a BoolValue.

bytesValueDecoder : Json.Decode.Decoder Bytes

Decodes a BytesValue.

bytesValueEncoder : Bytes -> Json.Encode.Value

Encodes a BytesValue.

floatValueDecoder : Json.Decode.Decoder Basics.Float

Decodes a FloatValue.

floatValueEncoder : Basics.Float -> Json.Encode.Value

Encodes a FloatValue.