Add `src/Internal/Api`
							parent
							
								
									206353b583
								
							
						
					
					
						commit
						c673372534
					
				| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
module Internal.Api.GetEvent.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.Request as R
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias GetEventInputV1 =
 | 
			
		||||
    { accessToken : String
 | 
			
		||||
    , baseUrl : String
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
getEventInputV1 : D.Decoder a -> (a -> b) -> GetEventInputV1 -> Task X.Error b
 | 
			
		||||
getEventInputV1 decoder mapping data =
 | 
			
		||||
    R.rawApiCall
 | 
			
		||||
        { headers = R.WithAccessToken data.accessToken
 | 
			
		||||
        , method = "GET"
 | 
			
		||||
        , baseUrl = data.baseUrl
 | 
			
		||||
        , path = "/_matrix/client/v3/rooms/{roomId}/event/{eventId}"
 | 
			
		||||
        , pathParams =
 | 
			
		||||
            [ ( "eventId", data.eventId )
 | 
			
		||||
            , ( "roomId", data.roomId )
 | 
			
		||||
            ]
 | 
			
		||||
        , queryParams = []
 | 
			
		||||
        , bodyParams = []
 | 
			
		||||
        , timeout = Nothing
 | 
			
		||||
        , decoder = \_ -> D.map mapping decoder
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
module Internal.Api.GetEvent.Main exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.Api as Api
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Api as V1_2
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Api as V1_3
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Api as V1_4
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Api as V1_5
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
getEvent : List String -> EventInput -> EventOutput
 | 
			
		||||
getEvent =
 | 
			
		||||
    V.firstVersion V1_2.packet
 | 
			
		||||
        |> V.updateWith V1_3.packet
 | 
			
		||||
        |> V.updateWith V1_4.packet
 | 
			
		||||
        |> V.updateWith V1_5.packet
 | 
			
		||||
        |> V.toFunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias EventOutput =
 | 
			
		||||
    Task X.Error O.ClientEvent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias EventInput =
 | 
			
		||||
    Api.GetEventInputV1
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_2.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.Api as Api
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Convert as C
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.SpecObjects as SO
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion () () Api.GetEventInputV1 O.ClientEvent
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.2"
 | 
			
		||||
    , downcast = \_ -> ()
 | 
			
		||||
    , current = Api.getEventInputV1 SO.clientEventDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_2.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.ClientEvent -> O.ClientEvent
 | 
			
		||||
convert e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map convertUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convertUnsigned : SO.UnsignedData -> O.UnsignedData
 | 
			
		||||
convertUnsigned (SO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map convert u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_2.Objects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_2.SpecObjects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_2.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Config.Leaking as L
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : () -> O.ClientEvent
 | 
			
		||||
upcast _ =
 | 
			
		||||
    { content = E.object []
 | 
			
		||||
    , eventId = L.eventId
 | 
			
		||||
    , originServerTs = L.originServerTs
 | 
			
		||||
    , roomId = L.roomId
 | 
			
		||||
    , sender = L.sender
 | 
			
		||||
    , stateKey = Nothing
 | 
			
		||||
    , contentType = L.eventType
 | 
			
		||||
    , unsigned = Nothing
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_3.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.Api as Api
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Convert as C
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.SpecObjects as SO
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.GetEventInputV1 PO.ClientEvent Api.GetEventInputV1 O.ClientEvent
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.3"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.getEventInputV1 SO.clientEventDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_3.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.ClientEvent -> O.ClientEvent
 | 
			
		||||
convert e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map convertUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convertUnsigned : SO.UnsignedData -> O.UnsignedData
 | 
			
		||||
convertUnsigned (SO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map convert u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_3.Objects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_3.SpecObjects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_3.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.ClientEvent -> O.ClientEvent
 | 
			
		||||
upcast e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map upcastUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcastUnsigned : PO.UnsignedData -> O.UnsignedData
 | 
			
		||||
upcastUnsigned (PO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map upcast u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_4.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.Api as Api
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Convert as C
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.SpecObjects as SO
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.GetEventInputV1 PO.ClientEvent Api.GetEventInputV1 O.ClientEvent
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.4"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.getEventInputV1 SO.clientEventDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_4.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.ClientEvent -> O.ClientEvent
 | 
			
		||||
convert e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map convertUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convertUnsigned : SO.UnsignedData -> O.UnsignedData
 | 
			
		||||
convertUnsigned (SO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map convert u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_4.Objects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_4.SpecObjects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_4.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.ClientEvent -> O.ClientEvent
 | 
			
		||||
upcast e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map upcastUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcastUnsigned : PO.UnsignedData -> O.UnsignedData
 | 
			
		||||
upcastUnsigned (PO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map upcast u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_5.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.Api as Api
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Convert as C
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.SpecObjects as SO
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.GetEventInputV1 PO.ClientEvent Api.GetEventInputV1 O.ClientEvent
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.5"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.getEventInputV1 SO.clientEventDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_5.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.ClientEvent -> O.ClientEvent
 | 
			
		||||
convert e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map convertUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convertUnsigned : SO.UnsignedData -> O.UnsignedData
 | 
			
		||||
convertUnsigned (SO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map convert u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_5.Objects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_5.SpecObjects exposing
 | 
			
		||||
    ( ClientEvent
 | 
			
		||||
    , UnsignedData(..)
 | 
			
		||||
    , clientEventDecoder
 | 
			
		||||
    , encodeClientEvent
 | 
			
		||||
    , encodeUnsignedData
 | 
			
		||||
    , unsignedDataDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Internal.Tools.Timestamp exposing (Timestamp, encodeTimestamp, timestampDecoder)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Client Event containing all data on an event.
 | 
			
		||||
-}
 | 
			
		||||
type alias ClientEvent =
 | 
			
		||||
    { content : E.Value
 | 
			
		||||
    , eventId : String
 | 
			
		||||
    , originServerTs : Timestamp
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , sender : String
 | 
			
		||||
    , stateKey : Maybe String
 | 
			
		||||
    , contentType : String
 | 
			
		||||
    , unsigned : Maybe UnsignedData
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeClientEvent : ClientEvent -> E.Value
 | 
			
		||||
encodeClientEvent data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "content", Just <| data.content )
 | 
			
		||||
        , ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        , ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
 | 
			
		||||
        , ( "room_id", Just <| E.string data.roomId )
 | 
			
		||||
        , ( "sender", Just <| E.string data.sender )
 | 
			
		||||
        , ( "state_key", Maybe.map E.string data.stateKey )
 | 
			
		||||
        , ( "type", Just <| E.string data.contentType )
 | 
			
		||||
        , ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
clientEventDecoder : D.Decoder ClientEvent
 | 
			
		||||
clientEventDecoder =
 | 
			
		||||
    D.map8
 | 
			
		||||
        (\a b c d e f g h ->
 | 
			
		||||
            { content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "content" D.value)
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
        (D.field "origin_server_ts" timestampDecoder)
 | 
			
		||||
        (D.field "room_id" D.string)
 | 
			
		||||
        (D.field "sender" D.string)
 | 
			
		||||
        (opField "state_key" D.string)
 | 
			
		||||
        (D.field "type" D.string)
 | 
			
		||||
        (opField "unsigned" (D.lazy (\_ -> unsignedDataDecoder)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Extra information about the event.
 | 
			
		||||
-}
 | 
			
		||||
type UnsignedData
 | 
			
		||||
    = UnsignedData
 | 
			
		||||
        { age : Maybe Int
 | 
			
		||||
        , prevContent : Maybe E.Value
 | 
			
		||||
        , redactedBecause : Maybe ClientEvent
 | 
			
		||||
        , transactionId : Maybe String
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeUnsignedData : UnsignedData -> E.Value
 | 
			
		||||
encodeUnsignedData (UnsignedData data) =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "age", Maybe.map E.int data.age )
 | 
			
		||||
        , ( "prev_content", data.prevContent )
 | 
			
		||||
        , ( "redacted_because", Maybe.map encodeClientEvent data.redactedBecause )
 | 
			
		||||
        , ( "transaction_id", Maybe.map E.string data.transactionId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
unsignedDataDecoder : D.Decoder UnsignedData
 | 
			
		||||
unsignedDataDecoder =
 | 
			
		||||
    D.map4
 | 
			
		||||
        (\a b c d ->
 | 
			
		||||
            UnsignedData { age = a, prevContent = b, redactedBecause = c, transactionId = d }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "age" D.int)
 | 
			
		||||
        (opField "prev_content" D.value)
 | 
			
		||||
        (opField "redacted_because" clientEventDecoder)
 | 
			
		||||
        (opField "transaction_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  ClientEvent:
 | 
			
		||||
    description: Client Event containing all data on an event.
 | 
			
		||||
    fields:
 | 
			
		||||
      content:
 | 
			
		||||
        type: value
 | 
			
		||||
        required: true
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      origin_server_ts:
 | 
			
		||||
        type: timestamp
 | 
			
		||||
        required: true
 | 
			
		||||
      room_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      sender:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      state_key:
 | 
			
		||||
        type: string
 | 
			
		||||
      type:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
      unsigned:
 | 
			
		||||
        type: UnsignedData
 | 
			
		||||
  UnsignedData:
 | 
			
		||||
    anti_recursion: true
 | 
			
		||||
    description: Extra information about the event.
 | 
			
		||||
    fields:
 | 
			
		||||
      age:
 | 
			
		||||
        type: int
 | 
			
		||||
      prev_content:
 | 
			
		||||
        type: value
 | 
			
		||||
      redacted_because:
 | 
			
		||||
        type: ClientEvent
 | 
			
		||||
      transaction_id:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
module Internal.Api.GetEvent.V1_5.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.GetEvent.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.GetEvent.V1_5.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.ClientEvent -> O.ClientEvent
 | 
			
		||||
upcast e =
 | 
			
		||||
    { content = e.content
 | 
			
		||||
    , eventId = e.eventId
 | 
			
		||||
    , originServerTs = e.originServerTs
 | 
			
		||||
    , roomId = e.roomId
 | 
			
		||||
    , sender = e.sender
 | 
			
		||||
    , stateKey = e.stateKey
 | 
			
		||||
    , contentType = e.contentType
 | 
			
		||||
    , unsigned = Maybe.map upcastUnsigned e.unsigned
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcastUnsigned : PO.UnsignedData -> O.UnsignedData
 | 
			
		||||
upcastUnsigned (PO.UnsignedData u) =
 | 
			
		||||
    O.UnsignedData
 | 
			
		||||
        { age = u.age
 | 
			
		||||
        , prevContent = u.prevContent
 | 
			
		||||
        , redactedBecause = Maybe.map upcast u.redactedBecause
 | 
			
		||||
        , transactionId = u.transactionId
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.Request as R
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias JoinedMembersInputV1 =
 | 
			
		||||
    { accessToken : String
 | 
			
		||||
    , baseUrl : String
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
joinedMembersInputV1 : D.Decoder a -> (a -> b) -> JoinedMembersInputV1 -> Task X.Error b
 | 
			
		||||
joinedMembersInputV1 decoder mapping data =
 | 
			
		||||
    R.rawApiCall
 | 
			
		||||
        { headers = R.WithAccessToken data.accessToken
 | 
			
		||||
        , method = "GET"
 | 
			
		||||
        , baseUrl = data.baseUrl
 | 
			
		||||
        , path = "/_matrix/client/v3/rooms/{roomId}/joined_members"
 | 
			
		||||
        , pathParams =
 | 
			
		||||
            [ ( "roomId", data.roomId )
 | 
			
		||||
            ]
 | 
			
		||||
        , queryParams = []
 | 
			
		||||
        , bodyParams = []
 | 
			
		||||
        , timeout = Nothing
 | 
			
		||||
        , decoder = \_ -> D.map mapping decoder
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.Main exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.Api as Api
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Api as V1_2
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Api as V1_3
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Api as V1_4
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Api as V1_5
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
joinedMembers : List String -> JoinedMembersInput -> JoinedMembersOutput
 | 
			
		||||
joinedMembers =
 | 
			
		||||
    V.firstVersion V1_2.packet
 | 
			
		||||
        |> V.updateWith V1_3.packet
 | 
			
		||||
        |> V.updateWith V1_4.packet
 | 
			
		||||
        |> V.updateWith V1_5.packet
 | 
			
		||||
        |> V.toFunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias JoinedMembersInput =
 | 
			
		||||
    Api.JoinedMembersInputV1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias JoinedMembersOutput =
 | 
			
		||||
    Task X.Error O.RoomMemberList
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_2.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.Api as Api
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Convert as C
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.SpecObjects as SO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion () () Api.JoinedMembersInputV1 O.RoomMemberList
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.2"
 | 
			
		||||
    , downcast = \_ -> ()
 | 
			
		||||
    , current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_2.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_2.Objects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_2.SpecObjects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_2.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Dict
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : () -> O.RoomMemberList
 | 
			
		||||
upcast _ =
 | 
			
		||||
    { joined = Dict.empty }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_3.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.Api as Api
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Convert as C
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.SpecObjects as SO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.3"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_3.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_3.Objects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_3.SpecObjects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_3.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_4.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.Api as Api
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Convert as C
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.SpecObjects as SO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.4"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_4.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_4.Objects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_4.SpecObjects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_4.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_5.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.Api as Api
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Convert as C
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.SpecObjects as SO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.5"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_5.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_5.Objects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_5.SpecObjects exposing
 | 
			
		||||
    ( RoomMember
 | 
			
		||||
    , RoomMemberList
 | 
			
		||||
    , encodeRoomMember
 | 
			
		||||
    , encodeRoomMemberList
 | 
			
		||||
    , roomMemberDecoder
 | 
			
		||||
    , roomMemberListDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Dict exposing (Dict)
 | 
			
		||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| User information of joined users.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMember =
 | 
			
		||||
    { avatarUrl : Maybe String
 | 
			
		||||
    , displayName : Maybe String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMember : RoomMember -> E.Value
 | 
			
		||||
encodeRoomMember data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "avatar_url", Maybe.map E.string data.avatarUrl )
 | 
			
		||||
        , ( "display_name", Maybe.map E.string data.displayName )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberDecoder : D.Decoder RoomMember
 | 
			
		||||
roomMemberDecoder =
 | 
			
		||||
    D.map2
 | 
			
		||||
        (\a b ->
 | 
			
		||||
            { avatarUrl = a, displayName = b }
 | 
			
		||||
        )
 | 
			
		||||
        (opField "avatar_url" D.string)
 | 
			
		||||
        (opField "display_name" D.string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| The dictionary containing all room member data.
 | 
			
		||||
-}
 | 
			
		||||
type alias RoomMemberList =
 | 
			
		||||
    { joined : Dict String RoomMember
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeRoomMemberList : RoomMemberList -> E.Value
 | 
			
		||||
encodeRoomMemberList data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
roomMemberListDecoder : D.Decoder RoomMemberList
 | 
			
		||||
roomMemberListDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { joined = a }
 | 
			
		||||
        )
 | 
			
		||||
        (opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  RoomMemberList:
 | 
			
		||||
    description: The dictionary containing all room member data.
 | 
			
		||||
    fields:
 | 
			
		||||
      joined:
 | 
			
		||||
        type: "{RoomMember}"
 | 
			
		||||
        required: false
 | 
			
		||||
        default: Dict.empty
 | 
			
		||||
  RoomMember:
 | 
			
		||||
    description: User information of joined users.
 | 
			
		||||
    fields:
 | 
			
		||||
      avatar_url:
 | 
			
		||||
        type: string
 | 
			
		||||
      display_name:
 | 
			
		||||
        type: string
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.JoinedMembers.V1_5.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.RoomMemberList -> O.RoomMemberList
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,284 @@
 | 
			
		|||
module Internal.Api.Request exposing (..)
 | 
			
		||||
 | 
			
		||||
import Http
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
import Process
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
import Time
 | 
			
		||||
import Url.Builder as UrlBuilder
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Make a raw API call to a Matrix API.
 | 
			
		||||
-}
 | 
			
		||||
rawApiCall :
 | 
			
		||||
    { headers : Headers
 | 
			
		||||
    , method : String
 | 
			
		||||
    , baseUrl : String
 | 
			
		||||
    , path : String
 | 
			
		||||
    , pathParams : List ( String, String )
 | 
			
		||||
    , queryParams : List QueryParam
 | 
			
		||||
    , bodyParams : List BodyParam
 | 
			
		||||
    , timeout : Maybe Float
 | 
			
		||||
    , decoder : Int -> D.Decoder a
 | 
			
		||||
    }
 | 
			
		||||
    -> Task X.Error a
 | 
			
		||||
rawApiCall data =
 | 
			
		||||
    Http.task
 | 
			
		||||
        { method = data.method
 | 
			
		||||
        , headers = fromHeaders data.headers
 | 
			
		||||
        , url = buildUrl data.baseUrl data.path data.pathParams data.queryParams
 | 
			
		||||
        , body = toBody data.bodyParams
 | 
			
		||||
        , resolver = rawApiCallResolver data.decoder
 | 
			
		||||
        , timeout = data.timeout
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
withRateLimits : Int -> Task X.Error a -> Task X.Error a
 | 
			
		||||
withRateLimits timeout task =
 | 
			
		||||
    Time.now
 | 
			
		||||
        |> Task.onError
 | 
			
		||||
            (\_ -> X.CouldntGetTimestamp |> X.SDKException |> Task.fail)
 | 
			
		||||
        |> Task.andThen
 | 
			
		||||
            (\now ->
 | 
			
		||||
                task
 | 
			
		||||
                    |> Task.onError
 | 
			
		||||
                        (\err ->
 | 
			
		||||
                            case err of
 | 
			
		||||
                                X.ServerException (X.M_LIMIT_EXCEEDED data) ->
 | 
			
		||||
                                    case data.retryAfterMs of
 | 
			
		||||
                                        Just t ->
 | 
			
		||||
                                            Process.sleep (toFloat t)
 | 
			
		||||
                                                |> Task.andThen (\_ -> Time.now)
 | 
			
		||||
                                                |> Task.andThen
 | 
			
		||||
                                                    (\newNow ->
 | 
			
		||||
                                                        let
 | 
			
		||||
                                                            diff : Int
 | 
			
		||||
                                                            diff =
 | 
			
		||||
                                                                timeout - (Time.posixToMillis newNow - Time.posixToMillis now)
 | 
			
		||||
                                                        in
 | 
			
		||||
                                                        if diff <= 0 then
 | 
			
		||||
                                                            Task.fail err
 | 
			
		||||
 | 
			
		||||
                                                        else
 | 
			
		||||
                                                            withRateLimits diff task
 | 
			
		||||
                                                    )
 | 
			
		||||
 | 
			
		||||
                                        Nothing ->
 | 
			
		||||
                                            Task.fail err
 | 
			
		||||
 | 
			
		||||
                                _ ->
 | 
			
		||||
                                    Task.fail err
 | 
			
		||||
                        )
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Potential headers to go along with a Matrix API call.
 | 
			
		||||
-}
 | 
			
		||||
type Headers
 | 
			
		||||
    = NoHeaders
 | 
			
		||||
    | WithAccessToken String
 | 
			
		||||
    | WithContentType String
 | 
			
		||||
    | WithBoth { accessToken : String, contentType : String }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Turn Headers into useful values
 | 
			
		||||
-}
 | 
			
		||||
fromHeaders : Headers -> List Http.Header
 | 
			
		||||
fromHeaders h =
 | 
			
		||||
    (case h of
 | 
			
		||||
        NoHeaders ->
 | 
			
		||||
            [ ( "Content-Type", "application/json" ) ]
 | 
			
		||||
 | 
			
		||||
        WithAccessToken token ->
 | 
			
		||||
            [ ( "Content-Type", "application/json" ), ( "Authorization", "Bearer " ++ token ) ]
 | 
			
		||||
 | 
			
		||||
        WithContentType contentType ->
 | 
			
		||||
            [ ( "Content-Type", contentType ) ]
 | 
			
		||||
 | 
			
		||||
        WithBoth data ->
 | 
			
		||||
            [ ( "Content-Type", data.contentType ), ( "Authorization", "Bearer " ++ data.accessToken ) ]
 | 
			
		||||
    )
 | 
			
		||||
        |> List.map (\( a, b ) -> Http.header a b)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| -}
 | 
			
		||||
type QueryParam
 | 
			
		||||
    = QueryParamString String String
 | 
			
		||||
    | OpQueryParamString String (Maybe String)
 | 
			
		||||
    | QueryParamInt String Int
 | 
			
		||||
    | OpQueryParamInt String (Maybe Int)
 | 
			
		||||
    | QueryParamBool String Bool
 | 
			
		||||
    | OpQueryParamBool String (Maybe Bool)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fromQueryParam : QueryParam -> Maybe UrlBuilder.QueryParameter
 | 
			
		||||
fromQueryParam param =
 | 
			
		||||
    case param of
 | 
			
		||||
        QueryParamString key value ->
 | 
			
		||||
            Just <| UrlBuilder.string key value
 | 
			
		||||
 | 
			
		||||
        OpQueryParamString key value ->
 | 
			
		||||
            Maybe.map (UrlBuilder.string key) value
 | 
			
		||||
 | 
			
		||||
        QueryParamInt key value ->
 | 
			
		||||
            Just <| UrlBuilder.int key value
 | 
			
		||||
 | 
			
		||||
        OpQueryParamInt key value ->
 | 
			
		||||
            Maybe.map (UrlBuilder.int key) value
 | 
			
		||||
 | 
			
		||||
        QueryParamBool key value ->
 | 
			
		||||
            if value then
 | 
			
		||||
                Just <| UrlBuilder.string key "true"
 | 
			
		||||
 | 
			
		||||
            else
 | 
			
		||||
                Just <| UrlBuilder.string key "false"
 | 
			
		||||
 | 
			
		||||
        OpQueryParamBool key value ->
 | 
			
		||||
            Maybe.andThen (QueryParamBool key >> fromQueryParam) value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fromQueryParams : List QueryParam -> List UrlBuilder.QueryParameter
 | 
			
		||||
fromQueryParams =
 | 
			
		||||
    List.map fromQueryParam
 | 
			
		||||
        >> List.filterMap identity
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
buildUrl : String -> String -> List ( String, String ) -> List QueryParam -> String
 | 
			
		||||
buildUrl baseUrl path pathParams queryParams =
 | 
			
		||||
    let
 | 
			
		||||
        fullPath : String
 | 
			
		||||
        fullPath =
 | 
			
		||||
            List.foldl
 | 
			
		||||
                (\( a, b ) -> String.replace ("{" ++ a ++ "}") b)
 | 
			
		||||
                path
 | 
			
		||||
                pathParams
 | 
			
		||||
                |> (\s ->
 | 
			
		||||
                        if String.startsWith "/" s then
 | 
			
		||||
                            String.dropLeft 1 s
 | 
			
		||||
 | 
			
		||||
                        else
 | 
			
		||||
                            s
 | 
			
		||||
                   )
 | 
			
		||||
    in
 | 
			
		||||
    UrlBuilder.crossOrigin baseUrl [ fullPath ] (fromQueryParams queryParams)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Type that gathers all parameters that go in the request body.
 | 
			
		||||
-}
 | 
			
		||||
type BodyParam
 | 
			
		||||
    = OptionalString String (Maybe String)
 | 
			
		||||
    | RequiredString String String
 | 
			
		||||
    | OptionalInt String (Maybe Int)
 | 
			
		||||
    | RequiredInt String Int
 | 
			
		||||
    | OptionalValue String (Maybe E.Value)
 | 
			
		||||
    | RequiredValue String E.Value
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeBodyParam : BodyParam -> ( String, Maybe E.Value )
 | 
			
		||||
encodeBodyParam b =
 | 
			
		||||
    case b of
 | 
			
		||||
        OptionalString h s ->
 | 
			
		||||
            ( h, Maybe.map E.string s )
 | 
			
		||||
 | 
			
		||||
        RequiredString h s ->
 | 
			
		||||
            ( h, Just <| E.string s )
 | 
			
		||||
 | 
			
		||||
        OptionalInt h i ->
 | 
			
		||||
            ( h, Maybe.map E.int i )
 | 
			
		||||
 | 
			
		||||
        RequiredInt h i ->
 | 
			
		||||
            ( h, Just <| E.int i )
 | 
			
		||||
 | 
			
		||||
        OptionalValue h v ->
 | 
			
		||||
            ( h, v )
 | 
			
		||||
 | 
			
		||||
        RequiredValue h v ->
 | 
			
		||||
            ( h, Just v )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
toBody : List BodyParam -> Http.Body
 | 
			
		||||
toBody params =
 | 
			
		||||
    case params of
 | 
			
		||||
        (RequiredValue "*" v) :: [] ->
 | 
			
		||||
            Http.jsonBody v
 | 
			
		||||
 | 
			
		||||
        _ ->
 | 
			
		||||
            List.map encodeBodyParam params
 | 
			
		||||
                |> maybeObject
 | 
			
		||||
                |> Http.jsonBody
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| Create a body object based on optionally provided values.
 | 
			
		||||
-}
 | 
			
		||||
maybeObject : List ( String, Maybe E.Value ) -> E.Value
 | 
			
		||||
maybeObject =
 | 
			
		||||
    List.filterMap
 | 
			
		||||
        (\( name, value ) ->
 | 
			
		||||
            case value of
 | 
			
		||||
                Just v ->
 | 
			
		||||
                    Just ( name, v )
 | 
			
		||||
 | 
			
		||||
                _ ->
 | 
			
		||||
                    Nothing
 | 
			
		||||
        )
 | 
			
		||||
        >> E.object
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
rawApiCallResolver : (Int -> D.Decoder a) -> Http.Resolver X.Error a
 | 
			
		||||
rawApiCallResolver decoder =
 | 
			
		||||
    Http.stringResolver
 | 
			
		||||
        (\response ->
 | 
			
		||||
            case response of
 | 
			
		||||
                Http.BadUrl_ s ->
 | 
			
		||||
                    Http.BadUrl s
 | 
			
		||||
                        |> X.InternetException
 | 
			
		||||
                        |> Err
 | 
			
		||||
 | 
			
		||||
                Http.Timeout_ ->
 | 
			
		||||
                    Http.Timeout
 | 
			
		||||
                        |> X.InternetException
 | 
			
		||||
                        |> Err
 | 
			
		||||
 | 
			
		||||
                Http.NetworkError_ ->
 | 
			
		||||
                    Http.NetworkError
 | 
			
		||||
                        |> X.InternetException
 | 
			
		||||
                        |> Err
 | 
			
		||||
 | 
			
		||||
                Http.BadStatus_ metadata body ->
 | 
			
		||||
                    decodeServerResponse (decoder metadata.statusCode) body
 | 
			
		||||
 | 
			
		||||
                Http.GoodStatus_ metadata body ->
 | 
			
		||||
                    decodeServerResponse (decoder metadata.statusCode) body
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
decodeServerResponse : D.Decoder a -> String -> Result X.Error a
 | 
			
		||||
decodeServerResponse decoder body =
 | 
			
		||||
    case D.decodeString D.value body of
 | 
			
		||||
        Err e ->
 | 
			
		||||
            e
 | 
			
		||||
                |> D.errorToString
 | 
			
		||||
                |> X.ServerReturnsBadJSON
 | 
			
		||||
                |> X.SDKException
 | 
			
		||||
                |> Err
 | 
			
		||||
 | 
			
		||||
        Ok _ ->
 | 
			
		||||
            case D.decodeString decoder body of
 | 
			
		||||
                Ok v ->
 | 
			
		||||
                    Ok v
 | 
			
		||||
 | 
			
		||||
                Err err ->
 | 
			
		||||
                    -- The response is not valid!
 | 
			
		||||
                    -- Check if it is a valid error type as defined in spec.
 | 
			
		||||
                    case D.decodeString X.errorCatches body of
 | 
			
		||||
                        Ok v ->
 | 
			
		||||
                            Err (X.ServerException v)
 | 
			
		||||
 | 
			
		||||
                        Err _ ->
 | 
			
		||||
                            err
 | 
			
		||||
                                |> D.errorToString
 | 
			
		||||
                                |> X.ServerReturnsBadJSON
 | 
			
		||||
                                |> X.SDKException
 | 
			
		||||
                                |> Err
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.Request as R
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendMessageEventInputV1 =
 | 
			
		||||
    { accessToken : String
 | 
			
		||||
    , baseUrl : String
 | 
			
		||||
    , content : D.Value
 | 
			
		||||
    , eventType : String
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , transactionId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sendMessageEventV1 : D.Decoder a -> (a -> b) -> SendMessageEventInputV1 -> Task X.Error b
 | 
			
		||||
sendMessageEventV1 decoder mapping data =
 | 
			
		||||
    R.rawApiCall
 | 
			
		||||
        { headers = R.WithAccessToken data.accessToken
 | 
			
		||||
        , method = "PUT"
 | 
			
		||||
        , baseUrl = data.baseUrl
 | 
			
		||||
        , path = "/_matrix/client/v3/rooms/{roomId}/send/{eventType}/{txnId}"
 | 
			
		||||
        , pathParams =
 | 
			
		||||
            [ ( "eventType", data.eventType )
 | 
			
		||||
            , ( "roomId", data.roomId )
 | 
			
		||||
            , ( "txnId", data.transactionId )
 | 
			
		||||
            ]
 | 
			
		||||
        , queryParams = []
 | 
			
		||||
        , bodyParams = [ R.RequiredValue "*" data.content ]
 | 
			
		||||
        , timeout = Nothing
 | 
			
		||||
        , decoder = \_ -> D.map mapping decoder
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.Main exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.Api as Api
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Api as V1_2
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Api as V1_3
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Api as V1_4
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Api as V1_5
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sendMessageEvent : List String -> SendMessageEventInput -> SendMessageEventOutput
 | 
			
		||||
sendMessageEvent =
 | 
			
		||||
    V.firstVersion V1_2.packet
 | 
			
		||||
        |> V.updateWith V1_3.packet
 | 
			
		||||
        |> V.updateWith V1_4.packet
 | 
			
		||||
        |> V.updateWith V1_5.packet
 | 
			
		||||
        |> V.toFunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendMessageEventInput =
 | 
			
		||||
    Api.SendMessageEventInputV1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendMessageEventOutput =
 | 
			
		||||
    Task X.Error O.EventResponse
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_2.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.Api as Api
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Convert as C
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion () () Api.SendMessageEventInputV1 O.EventResponse
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.2"
 | 
			
		||||
    , downcast = \_ -> ()
 | 
			
		||||
    , current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_2.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.EventResponse -> O.EventResponse
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_2.Objects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_2.SpecObjects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_2.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
 | 
			
		||||
import Internal.Config.Leaking as L
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : () -> O.EventResponse
 | 
			
		||||
upcast _ =
 | 
			
		||||
    { eventId = L.eventId }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_3.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.Api as Api
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Convert as C
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.3"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_3.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.EventResponse -> O.EventResponse
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_3.Objects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_3.SpecObjects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.3
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_3.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_2.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.EventResponse -> O.EventResponse
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_4.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.Api as Api
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Convert as C
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.4"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_4.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.EventResponse -> O.EventResponse
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_4.Objects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_4.SpecObjects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.4
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_4.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_3.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.EventResponse -> O.EventResponse
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_5.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.Api as Api
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Convert as C
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.5"
 | 
			
		||||
    , downcast = identity
 | 
			
		||||
    , current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_5.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.EventResponse -> O.EventResponse
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_5.Objects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'Objects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: Objects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_5.SpecObjects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.5
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendMessageEvent.V1_5.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_4.Objects as PO
 | 
			
		||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : PO.EventResponse -> O.EventResponse
 | 
			
		||||
upcast =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
module Internal.Api.SendStateKey.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.Request as R
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendStateKeyInputV1 =
 | 
			
		||||
    { accessToken : String
 | 
			
		||||
    , baseUrl : String
 | 
			
		||||
    , content : D.Value
 | 
			
		||||
    , eventType : String
 | 
			
		||||
    , roomId : String
 | 
			
		||||
    , stateKey : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sendStateKeyV1 : D.Decoder a -> (a -> b) -> SendStateKeyInputV1 -> Task X.Error b
 | 
			
		||||
sendStateKeyV1 decoder mapping data =
 | 
			
		||||
    R.rawApiCall
 | 
			
		||||
        { headers = R.WithAccessToken data.accessToken
 | 
			
		||||
        , method = "PUT"
 | 
			
		||||
        , baseUrl = data.baseUrl
 | 
			
		||||
        , path = "/_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey}"
 | 
			
		||||
        , pathParams =
 | 
			
		||||
            [ ( "eventType", data.eventType )
 | 
			
		||||
            , ( "roomId", data.roomId )
 | 
			
		||||
            , ( "stateKey", data.stateKey )
 | 
			
		||||
            ]
 | 
			
		||||
        , queryParams = []
 | 
			
		||||
        , bodyParams = [ R.RequiredValue "*" data.content ]
 | 
			
		||||
        , timeout = Nothing
 | 
			
		||||
        , decoder = \_ -> D.map mapping decoder
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
module Internal.Api.SendStateKey.Main exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendStateKey.Api as Api
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Api as V1_2
 | 
			
		||||
import Internal.Api.SendStateKey.V1_3.Api as V1_3
 | 
			
		||||
import Internal.Api.SendStateKey.V1_4.Api as V1_4
 | 
			
		||||
import Internal.Api.SendStateKey.V1_5.Api as V1_5
 | 
			
		||||
import Internal.Api.SendStateKey.V1_5.Objects as O
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
import Internal.Tools.Exceptions as X
 | 
			
		||||
import Task exposing (Task)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sendStateKey : List String -> SendStateKeyInput -> SendStateKeyOutput
 | 
			
		||||
sendStateKey =
 | 
			
		||||
    V.firstVersion V1_2.packet
 | 
			
		||||
        |> V.updateWith V1_3.packet
 | 
			
		||||
        |> V.updateWith V1_4.packet
 | 
			
		||||
        |> V.updateWith V1_5.packet
 | 
			
		||||
        |> V.toFunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendStateKeyInput =
 | 
			
		||||
    Api.SendStateKeyInputV1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
type alias SendStateKeyOutput =
 | 
			
		||||
    Task X.Error O.EventResponse
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
module Internal.Api.SendStateKey.V1_2.Api exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendStateKey.Api as Api
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Convert as C
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Upcast as U
 | 
			
		||||
import Internal.Api.VersionControl as V
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
packet : V.SingleVersion () () Api.SendStateKeyInputV1 O.EventResponse
 | 
			
		||||
packet =
 | 
			
		||||
    { version = "v1.2"
 | 
			
		||||
    , downcast = \_ -> ()
 | 
			
		||||
    , current = Api.sendStateKeyV1 O.eventResponseDecoder C.convert
 | 
			
		||||
    , upcast = U.upcast
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendStateKey.V1_2.Convert exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Objects as O
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.SpecObjects as SO
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
convert : SO.EventResponse -> O.EventResponse
 | 
			
		||||
convert =
 | 
			
		||||
    identity
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendStateKey.V1_2.Objects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
module Internal.Api.SendStateKey.V1_2.SpecObjects exposing
 | 
			
		||||
    ( EventResponse
 | 
			
		||||
    , encodeEventResponse
 | 
			
		||||
    , eventResponseDecoder
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
{-| Automatically generated 'SpecObjects'
 | 
			
		||||
 | 
			
		||||
Last generated at Unix time 1673279712
 | 
			
		||||
 | 
			
		||||
-}
 | 
			
		||||
 | 
			
		||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
 | 
			
		||||
import Json.Decode as D
 | 
			
		||||
import Json.Encode as E
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{-| A response confirming that an event has been sent.
 | 
			
		||||
-}
 | 
			
		||||
type alias EventResponse =
 | 
			
		||||
    { eventId : String
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
encodeEventResponse : EventResponse -> E.Value
 | 
			
		||||
encodeEventResponse data =
 | 
			
		||||
    maybeObject
 | 
			
		||||
        [ ( "event_id", Just <| E.string data.eventId )
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
eventResponseDecoder : D.Decoder EventResponse
 | 
			
		||||
eventResponseDecoder =
 | 
			
		||||
    D.map
 | 
			
		||||
        (\a ->
 | 
			
		||||
            { eventId = a }
 | 
			
		||||
        )
 | 
			
		||||
        (D.field "event_id" D.string)
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
version: v1.2
 | 
			
		||||
name: SpecObjects
 | 
			
		||||
objects:
 | 
			
		||||
  EventResponse:
 | 
			
		||||
    description: A response confirming that an event has been sent.
 | 
			
		||||
    fields:
 | 
			
		||||
      event_id:
 | 
			
		||||
        type: string
 | 
			
		||||
        required: true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
module Internal.Api.SendStateKey.V1_2.Upcast exposing (..)
 | 
			
		||||
 | 
			
		||||
import Internal.Api.SendStateKey.V1_2.Objects as O
 | 
			
		||||
import Internal.Config.Leaking as L
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
upcast : () -> O.EventResponse
 | 
			
		||||
upcast _ =
 | 
			
		||||
    { eventId = L.eventId }
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue