-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ex04.elm
66 lines (37 loc) · 1.7 KB
/
Ex04.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module Ex04 exposing (..)
{-| Protobuf library for decoding and encoding structures found in package `Ex04` along with helpers. This file was generated automatically by `protoc-gen-elmer`. Do not edit.
Records:
- Response
Unions: (none)
Each type defined has a: decoder, encoder and an empty (zero value) function. In addition to this enums have valuesOf, to and from (string) functions. All functions take the form `decodeDerivedIdent` where `decode` is the purpose and `DerivedIdent` comes from the Protobuf ident.
Elm identifiers are derived directly from the Protobuf ID (a full ident). The package maps to a module and the rest of the ID is the type. Since Protobuf names are hierachical (separated by a dot `.`), each namespace is mapped to an underscore `_` in an Elm ID. A Protobuf namespaced ident (parts between a dot `.`) are then cased to follow Elm naming conventions and do not include any undescores `_`. For example the enum `my.pkg.MyMessage.URLOptions` maps to the Elm module `My.Pkg` with ID `MyMessage_UrlOptions`.
# Types
@docs Response
# Empty (zero values)
@docs emptyResponse
# Decoders
@docs decodeResponse
# Encoders
@docs encodeResponse
-}
-- // Code generated protoc-gen-elmer DO NOT EDIT \\
import Google.Protobuf
import Protobuf.Decode as PD
import Protobuf.Elmer
import Protobuf.Encode as PE
type alias Response =
{ message : String
}
emptyResponse : Response
emptyResponse =
Response ""
decodeResponse : PD.Decoder Response
decodeResponse =
PD.message emptyResponse
[ PD.optional 1 PD.string (\v m -> { m | message = v })
]
encodeResponse : Response -> PE.Encoder
encodeResponse v =
PE.message <|
[ ( 1, PE.string v.message )
]