[{"name":"Matrix","comment":"\n\n\n# Matrix SDK\n\nThis library forms a mere basis from which an entire functional SDK is\ndeveloped for the Matrix protocol.\n\nIt is generally quite unusual to regularly publish iterative beta versions on\nthe public registry, but it is also generally quite unusual to exclusively\nsupport a monolithic public registry. (:\n\n\n## Vault\n\n@docs Vault, fromUserId, fromUsername\n\n\n## Keeping the Vault up-to-date\n\n@docs VaultUpdate, update, sync, logs\n\n\n## Exploring the Vault\n\n@docs rooms, fromRoomId\n\n\n## Account data\n\n@docs getAccountData, setAccountData\n\n\n## Debugging\n\n@docs addAccessToken, sendMessageEvent\n\n","unions":[],"aliases":[{"name":"Vault","comment":" The Vault type stores all relevant information about the Matrix API.\n\nIf you make sure that the data type stays up-to-date, you can use it to explore\nthe latest information about an account.\n\n","args":[],"type":"Types.Vault"},{"name":"VaultUpdate","comment":" The VaultUpdate type is the central type that keeps the Vault up-to-date.\n","args":[],"type":"Types.VaultUpdate"}],"values":[{"name":"addAccessToken","comment":" Adds a custom access token to the Vault. This can be done if no password is\nprovided or known.\n","type":"String.String -> Matrix.Vault -> Matrix.Vault"},{"name":"fromRoomId","comment":" Get a room based on its room ID, if the user is a member of that room.\n","type":"String.String -> Matrix.Vault -> Maybe.Maybe Types.Room"},{"name":"fromUserId","comment":" Use a fully-fledged Matrix ID to connect.\n\n    case Matrix.fromUserId \"@alice:example.org\" of\n        Just vault ->\n            \"We got a vault!\"\n\n        Nothing ->\n            \"Invalid username\"\n\n","type":"String.String -> Maybe.Maybe Matrix.Vault"},{"name":"fromUsername","comment":" Using a username and an address, create a Vault.\n\nThe username can either be the localpart or the full Matrix ID. For example,\nyou can either insert `alice` or `@alice:example.org`.\n\n","type":"{ username : String.String, host : String.String, port_ : Maybe.Maybe Basics.Int } -> Matrix.Vault"},{"name":"getAccountData","comment":" Get global account data.\n","type":"String.String -> Matrix.Vault -> Maybe.Maybe Json.Encode.Value"},{"name":"logs","comment":" The VaultUpdate is a complex type that helps update the Vault. However,\nit also contains a human output!\n\nUsing this function, you can get a human output that describes everything that\nthe VaultUpdate has to tell the Vault.\n\nThe `channel` field describes the context of the log, allowing you to filter\nfurther. For example:\n\n  - `debug` is a comprehensive channel describing everything the Elm runtime has\n    executed.\n  - `warn` contains warnings that aren't breaking, but relevant.\n  - `securityWarn` warns about potential security issues or potential attacks.\n  - `error` has errors that were encountered.\n  - `caughtError` has errors that were dealt with successfully.\n\n","type":"Matrix.VaultUpdate -> List.List { channel : String.String, content : String.String }"},{"name":"rooms","comment":" Get a list of all the rooms that the user has joined.\n","type":"Matrix.Vault -> List.List Types.Room"},{"name":"sendMessageEvent","comment":" Send a message event to a room.\n\nThis function can be used in a scenario where the user does not want to sync\nthe client, or is unable to. This function doesn't check whether the given room\nexists and the user is able to send a message to, and instead just sends the\nrequest to the Matrix API.\n\nThe fields stand for the following:\n\n  - `content` is the JSON object that is sent to the Matrix room.\n  - `eventType` is the event type that is sent to the Matrix room.\n  - `roomId` is the Matrix room ID.\n  - `toMsg` is the `msg` type that is returned after the message has been sent.\n  - `transactionId` is a unique identifier that helps the Matrix server\n    distringuish messages. If you send the same message with the same transactionId,\n    the server promises to register it only once.\n  - `vault` is the Matrix Vault that contains all the latest and most relevant\n    information.\n\n","type":"{ content : Json.Encode.Value, eventType : String.String, roomId : String.String, toMsg : Matrix.VaultUpdate -> msg, transactionId : String.String, vault : Matrix.Vault } -> Platform.Cmd.Cmd msg"},{"name":"setAccountData","comment":" Set global account data.\n","type":"{ content : Json.Encode.Value, eventType : String.String, room : Matrix.Vault, toMsg : Types.VaultUpdate -> msg } -> Platform.Cmd.Cmd msg"},{"name":"sync","comment":" Synchronize the Vault with the Matrix API.\n\nEffectively, this task asks the Matrix API to provide the latest information,\nwhich will be returned as your VaultUpdate.\n\n","type":"(Matrix.VaultUpdate -> msg) -> Matrix.Vault -> Platform.Cmd.Cmd msg"},{"name":"update","comment":" Using new VaultUpdate information, update the Vault accordingly.\n\nThis allows us to change our perception of the Matrix environment: has anyone\nsent a new message? Did someone send us an invite for a new room?\n\n","type":"Matrix.VaultUpdate -> Matrix.Vault -> Matrix.Vault"}],"binops":[]},{"name":"Matrix.Event","comment":"\n\n\n# Matrix Events\n\nThis module contains all the functions necessary to view and manipulate Matrix\nevents.\n\n\n## Event\n\n@docs Event, content, eventType, stateKey\n\n\n## Metadata\n\n@docs eventId, roomId, sender, originServerTs\n\n\n## Optional data\n\nOccasionally, the Event might bring some extra information. Given how this\ninformation isn't always applicable, it doesn't always exist.\n\n@docs previousContent, redactedBecause\n\n","unions":[],"aliases":[{"name":"Event","comment":" In Matrix, the primary form of communication is to send JSON values to one\nanother. These JSON values, together with their metadata, are bundled into Event\ntypes. They contain information like:\n\n  - Who sent the JSON value\n  - How they intend you to decode it\n  - When they sent it\n  - In what room they sent it\n\n","args":[],"type":"Types.Event"}],"values":[{"name":"content","comment":" Receive the body of an Event, as created by the user that sent it.\n","type":"Matrix.Event.Event -> Json.Encode.Value"},{"name":"eventId","comment":" Determine the globally unique identifier for an event.\n","type":"Matrix.Event.Event -> String.String"},{"name":"eventType","comment":" To give a hint what the event's [content](#content) might look like, users\ncan use this eventType value to hint at how the JSON might be decoded.\n\nStandard examples of event types are `m.room.message`, `m.room.member` and\n`me.noordstar.game.chess.move`.\n\n","type":"Matrix.Event.Event -> String.String"},{"name":"originServerTs","comment":" Determine the timestamp of at what time the event was originally received by\nthe original homeserver.\n\nGenerally, this timestamp offers a relatively accurate indicator of when a\nmessage was sent. However, this number isn't completely reliable! The timestamp\ncan be far in the past due to long network lag, and a (malicious) homeserver can\nspoof this number to make it seem like something was sent ridiculously far in\nthe past - or even in the future.\n\n","type":"Matrix.Event.Event -> Time.Posix"},{"name":"previousContent","comment":" Determine the previous `content` value for this event. This field is only a\n`Just value` if the event is a state event, and the Matrix Vault has permission\nto see the previous content.\n","type":"Matrix.Event.Event -> Maybe.Maybe Json.Encode.Value"},{"name":"redactedBecause","comment":" If the event has been redacted, the homeserver can display the event that\nredacted it here.\n","type":"Matrix.Event.Event -> Maybe.Maybe Matrix.Event.Event"},{"name":"roomId","comment":" Unique id assigned to the Matrix room. You can use this room id to reference\nor look up rooms.\n","type":"Matrix.Event.Event -> String.String"},{"name":"sender","comment":" Determine the fully-qualified ID of the user who sent an event.\n","type":"Matrix.Event.Event -> Types.User"},{"name":"stateKey","comment":" Determine an event's state key.\n\nIt is present if, and only if, the event is a _state_ event. The key makes the\npiece of state unique in the room. Note that it is often `Just \"\"`. If it is not\npresent, its value is `Nothing`.\n\nState keys starting with an `@` are reserved for referencing user IDs, such as\nroom members. With the exception of a few events, state events set with a given\nuser'd ID as the state key can only be set by that user.\n\n","type":"Matrix.Event.Event -> Maybe.Maybe String.String"}],"binops":[]},{"name":"Matrix.Room","comment":"\n\n\n# Room\n\nWhat is usually called a chat, a channel, a conversation or a group chat on\nother platforms, the term used in Matrix is a \"room\". A room is a conversation\nwhere a group of users talk to each other.\n\n@docs Room, mostRecentEvents, roomId\n\nThis module exposes various functions that help you inspect various aspects of\na room.\n\n\n## Account data\n\nAccount data is personal information that the user stores about this Matrix\nroom. This may include information like:\n\n  - What type of room this is\n  - A list of members in the room to ignore\n  - A list of currently ongoing chess matches in the room\n  - Personal notes the user may be taking\n\nYou may consider the account data as a `Dict String Json.Value` type. Account\ndata is linked to the user account: other logged in devices can see the account\ndata too, as the server synchronizes it, but the server shouldn´t show it to\nother users.\n\n@docs getAccountData, setAccountData\n\n\n## Sending events\n\nBesides reading the latest events, one can also send new events to the Matrix\nroom. These events are JSON objects that can be shaped in any way or form that\nyou like. To help other users with decoding your JSON objects, you pass an\n`eventType` string which helps them figure out the nature of your JSON object.\n\n@docs sendMessageEvent, sendStateEvent\n\n\n## Moderating users\n\n@docs invite, kick, ban\n\n","unions":[],"aliases":[{"name":"Room","comment":" The Matrix Room type representing a room that the Matrix user has joined.\n","args":[],"type":"Types.Room"}],"values":[{"name":"ban","comment":" Ban a user from a room.\n","type":"{ reason : Maybe.Maybe String.String, room : Matrix.Room.Room, toMsg : Types.VaultUpdate -> msg, user : Types.User } -> Platform.Cmd.Cmd msg"},{"name":"getAccountData","comment":" Get a piece of account data linked to a certain string key.\n","type":"String.String -> Matrix.Room.Room -> Maybe.Maybe Json.Encode.Value"},{"name":"invite","comment":" Invite a user to a room.\n","type":"{ reason : Maybe.Maybe String.String, room : Matrix.Room.Room, toMsg : Types.VaultUpdate -> msg, user : Types.User } -> Platform.Cmd.Cmd msg"},{"name":"kick","comment":" Kick a user from a room.\n","type":"{ reason : Maybe.Maybe String.String, room : Matrix.Room.Room, toMsg : Types.VaultUpdate -> msg, user : Types.User } -> Platform.Cmd.Cmd msg"},{"name":"mostRecentEvents","comment":" Get a list of the most recent events sent in the room.\n","type":"Matrix.Room.Room -> List.List Types.Event"},{"name":"roomId","comment":" Get a room's room id. This is an opaque string that distinguishes rooms from\neach other.\n","type":"Matrix.Room.Room -> String.String"},{"name":"sendMessageEvent","comment":" Send a message event to a given room.\n","type":"{ content : Json.Encode.Value, eventType : String.String, room : Matrix.Room.Room, toMsg : Types.VaultUpdate -> msg, transactionId : String.String } -> Platform.Cmd.Cmd msg"},{"name":"sendStateEvent","comment":" Send a state event to a given room.\n","type":"{ content : Json.Encode.Value, eventType : String.String, room : Matrix.Room.Room, stateKey : String.String, toMsg : Types.VaultUpdate -> msg } -> Platform.Cmd.Cmd msg"},{"name":"setAccountData","comment":" Set account data to a Matrix room.\n","type":"{ content : Json.Encode.Value, eventType : String.String, room : Matrix.Room.Room, toMsg : Types.VaultUpdate -> msg } -> Platform.Cmd.Cmd msg"}],"binops":[]},{"name":"Matrix.Settings","comment":" The Matrix Vault has lots of configurable variables that you rarely want to\ninteract with. Usually, you configure these variables only when creating a new\nVault, or when a user explicitly changes one of their preferred settings.\n\n\n## Access token\n\nThe Vault is able to log in on its own, but sometimes you would rather have the\nVault use an access token than log in to get one on its own. For this case, you\ncan use this option to insert an access token into the Vault.\n\nAs long as the access token remains valid, the Vault will use this provided\naccess token.\n\n@docs setAccessToken, removeAccessToken\n\n\n## Device name\n\nThe default device name that is being communicated with the Matrix API.\n\nThis is mostly useful for users who are logged in with multiple sessions. They\nwill see device names like \"Element for Android\" or \"Element on iOS\". For the\nElm SDK, they will by default see the Elm SDK with its version included. If you\nare writing a custom client, however, you are free to change this to something\nmore meaningful to the user.\n\n@docs getDeviceName, setDeviceName\n\n\n## Sync time\n\nWhenever the Matrix API has nothing new to report, the Elm SDK is kept on\nhold until something new happens. The `syncTime` indicates a timeout to how long\nthe Elm SDK tolerates being held on hold.\n\n  - ↗️ A high value is good because it significantly reduces traffic between the\n    user and the homeserver.\n  - ↘️ A low value is good because it reduces the risk of\n    the connection ending abruptly or unexpectedly.\n\nNowadays, most libraries use 30 seconds as the standard, as does the Elm SDK.\nThe value is in miliseconds, so it is set at 30,000.\n\n@docs getSyncTime, setSyncTime\n\n\n## Password\n\nWhen a Vault wants to access the Matrix API, it needs an access token. This can\neither be provided directly, or the Vault can get one itself by using a password\nto log in.\n\n@docs setPassword\n\nFor security reasons, it is not possible to read whatever password is stored in\nthe Vault. An attacker with access to the memory might be able to find it,\nhowever, so the Vault offers ways to remove the password from memory.\n\n@docs removePassword, removePasswordOnLogin\n\n","unions":[],"aliases":[],"values":[{"name":"getDeviceName","comment":" Determine the device name.\n","type":"Types.Vault -> String.String"},{"name":"getSyncTime","comment":" Determine the sync timeout value.\n","type":"Types.Vault -> Basics.Int"},{"name":"removeAccessToken","comment":" Remove an access token that has been inserted using the\n[setAccessToken](Matrix-Settings#setAccessToken) function.\n\nThis should generally not be necessary, but it can be nice security-wise.\n\n","type":"Types.Vault -> Types.Vault"},{"name":"removePassword","comment":" Remove a password that is stored in the Matrix Vault.\n","type":"Types.Vault -> Types.Vault"},{"name":"removePasswordOnLogin","comment":" Remove password from the Vault as soon as a valid access token has been\nreceived from the Matrix API.\n","type":"Basics.Bool -> Types.Vault -> Types.Vault"},{"name":"setAccessToken","comment":" Insert a suggested access token.\n","type":"String.String -> Types.Vault -> Types.Vault"},{"name":"setDeviceName","comment":" Override the device name.\n","type":"String.String -> Types.Vault -> Types.Vault"},{"name":"setPassword","comment":" Set a password for the given user.\n","type":"String.String -> Types.Vault -> Types.Vault"},{"name":"setSyncTime","comment":" Override the sync timeout value.\n","type":"Basics.Int -> Types.Vault -> Types.Vault"}],"binops":[]},{"name":"Matrix.User","comment":" Matrix users are identified by their unique ID. In the Matrix API, this is a\nstring that looks as follows:\n\n    @alice:example.org\n     \\---/ \\---------/\n       |        |\n       |        |\n    localpart  domain\n\nSince it is very easy to abuse Matrix user IDs to sneak in arbitrary values,\nthe Elm SDK parses them and makes sure they are safe. As a result, you might\nneed this module to get the right information from a user!\n\n\n## User\n\n@docs User, toString\n\n\n## Info\n\nSometimes, you are more interested in the username itself. These functions can\nhelp you decipher, disambiguate and categorize users based on their username.\n\n@docs localpart, domain\n\n\n## Manipulate\n\n@docs get\n\n","unions":[],"aliases":[{"name":"User","comment":" The User type represents a Matrix user.\n\nIt contains information like:\n\n  - Their username on Matrix\n  - The server that hosts their account\n  - Access tokens needed to talk to the server\n\nIt does **NOT** contain information like:\n\n  - Their nickname\n  - Their profile picture\n  - Your private room with them\n\nYou can get all that information by looking it up in the [Vault](Matrix#Vault).\n\n**Note:** Please do not store this user type as a variable in your model! You\nshould always maintain a single source of truth in Elm, and the User type\ncontains various credentials and API tokens that might expire if you don't\nupdate them from the Vault.\n\nIf you need to remember specific users, you can best compare their identifying\nstring using [toString](Matrix-User#toString) or you can use\n[get](Matrix-User#get) with the Vault to get the user type.\n\n","args":[],"type":"Types.User"}],"values":[{"name":"domain","comment":" The domain is the name of the server that the user connects to. Server names\nare case-sensitive, so if the strings are equal, the users are on the same\nserver!\n\nAs a result, you can use the user domain for:\n\n  - When multiple users in a room have the same localpart on different servers\n  - Finding other users from a potentially malicious homeserver\n  - Counting homeservers in a room\n\nSee the following examples:\n\n    domain (get vault \"@alice:example.org\") -- \"example.org\"\n\n    domain (get vault \"@bob:127.0.0.1\") -- \"127.0.0.1\"\n\n    domain (get vault \"@charlie:[2001:db8::]\") -- \"[2001:db8::]\"\n\n","type":"Matrix.User.User -> String.String"},{"name":"get","comment":" Get a specific user by their unique identifier.\n\nThe Vault is needed as an input because the `User` type also stores various\ncredentials needed to talk to the Matrix API.\n\n    get vault \"@alice:example.org\" -- Just (User \"alice\" \"example.org\")\n\n    get vault \"@bob:127.0.0.1\" -- Just (User \"bob\" \"127.0.0.1\")\n\n    get vault \"@charlie:[2001:db8::]\" -- Just (User \"charlie\" \"2001:db8::\")\n\n    get vault \"@evil:#mp#ss#bl#.c#m\" -- Nothing\n\n    get vault \"\" -- Nothing\n\n","type":"Types.Vault -> String.String -> Maybe.Maybe Matrix.User.User"},{"name":"localpart","comment":" The localpart is the user's unique username. Every homeserver has their own\nusername registry, so you might occasionally find distinct users with the same\nlocalpart.\n\nThe localpart is often used as a user's name in a room if they haven't set up\na custom name.\n\nSee the following examples:\n\n    localpart (get vault \"@alice:example.org\") -- \"alice\"\n\n    localpart (get vault \"@bob:127.0.0.1\") -- \"bob\"\n\n    localpart (get vault \"@charlie:[2001:db8::]\") -- \"charlie\"\n\n","type":"Matrix.User.User -> String.String"},{"name":"toString","comment":" Get the uniquely identifying string for this user. Since the strings are\ncase-sensitive, you can run a simple string comparison to compare usernames.\n","type":"Matrix.User.User -> String.String"}],"binops":[]}]