You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

820 lines
27 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>matrix - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package matrix</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "github.com/matrix-org/go-neb/matrix"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. </dl>
  58. </div>
  59. <!-- The package's Name is printed as title by the top-level template -->
  60. <div id="pkg-overview" class="toggleVisible">
  61. <div class="collapsed">
  62. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  63. </div>
  64. <div class="expanded">
  65. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  66. <p>
  67. Package matrix provides an HTTP client that can interact with a Homeserver via r0 APIs (/sync).
  68. </p>
  69. <p>
  70. It is NOT safe to access the field (or any sub-fields of) &#39;Rooms&#39; concurrently. In essence, this
  71. structure MUST be treated as read-only. The matrix client will update this structure as new events
  72. arrive from the homeserver.
  73. </p>
  74. <p>
  75. Internally, the client has 1 goroutine for polling the server, and 1 goroutine for processing data
  76. returned. The polling goroutine communicates to the processing goroutine by a buffered channel
  77. which feedback loops if processing takes a while as it will delay more data from being pulled down
  78. if the buffer gets full. Modification of the &#39;Rooms&#39; field of the client is done EXCLUSIVELY on the
  79. processing goroutine.
  80. </p>
  81. </div>
  82. </div>
  83. <div id="pkg-index" class="toggleVisible">
  84. <div class="collapsed">
  85. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  86. </div>
  87. <div class="expanded">
  88. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  89. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  90. <div id="manual-nav">
  91. <dl>
  92. <dd><a href="index.html#Client">type Client</a></dd>
  93. <dd>&nbsp; &nbsp; <a href="index.html#NewClient">func NewClient(httpClient *http.Client, homeserverURL *url.URL, accessToken, userID string) *Client</a></dd>
  94. <dd>&nbsp; &nbsp; <a href="index.html#Client.JoinRoom">func (cli *Client) JoinRoom(roomIDorAlias, serverName, invitingUserID string) (string, error)</a></dd>
  95. <dd>&nbsp; &nbsp; <a href="index.html#Client.SendMessageEvent">func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON interface{}) (string, error)</a></dd>
  96. <dd>&nbsp; &nbsp; <a href="index.html#Client.SendText">func (cli *Client) SendText(roomID, text string) (string, error)</a></dd>
  97. <dd>&nbsp; &nbsp; <a href="index.html#Client.SetDisplayName">func (cli *Client) SetDisplayName(displayName string) error</a></dd>
  98. <dd>&nbsp; &nbsp; <a href="index.html#Client.StopSync">func (cli *Client) StopSync()</a></dd>
  99. <dd>&nbsp; &nbsp; <a href="index.html#Client.Sync">func (cli *Client) Sync()</a></dd>
  100. <dd>&nbsp; &nbsp; <a href="index.html#Client.UploadLink">func (cli *Client) UploadLink(link string) (string, error)</a></dd>
  101. <dd>&nbsp; &nbsp; <a href="index.html#Client.UploadToContentRepo">func (cli *Client) UploadToContentRepo(content io.Reader, contentType string, contentLength int64) (string, error)</a></dd>
  102. <dd><a href="index.html#Event">type Event</a></dd>
  103. <dd>&nbsp; &nbsp; <a href="index.html#Event.Body">func (event *Event) Body() (body string, ok bool)</a></dd>
  104. <dd>&nbsp; &nbsp; <a href="index.html#Event.MessageType">func (event *Event) MessageType() (msgtype string, ok bool)</a></dd>
  105. <dd><a href="index.html#HTMLMessage">type HTMLMessage</a></dd>
  106. <dd>&nbsp; &nbsp; <a href="index.html#GetHTMLMessage">func GetHTMLMessage(msgtype, htmlText string) HTMLMessage</a></dd>
  107. <dd><a href="index.html#ImageInfo">type ImageInfo</a></dd>
  108. <dd><a href="index.html#ImageMessage">type ImageMessage</a></dd>
  109. <dd><a href="index.html#NextBatchStorer">type NextBatchStorer</a></dd>
  110. <dd><a href="index.html#OnEventListener">type OnEventListener</a></dd>
  111. <dd><a href="index.html#Room">type Room</a></dd>
  112. <dd>&nbsp; &nbsp; <a href="index.html#NewRoom">func NewRoom(roomID string) *Room</a></dd>
  113. <dd>&nbsp; &nbsp; <a href="index.html#Room.GetMembershipState">func (room Room) GetMembershipState(userID string) string</a></dd>
  114. <dd>&nbsp; &nbsp; <a href="index.html#Room.GetStateEvent">func (room Room) GetStateEvent(eventType string, stateKey string) *Event</a></dd>
  115. <dd>&nbsp; &nbsp; <a href="index.html#Room.UpdateState">func (room Room) UpdateState(event *Event)</a></dd>
  116. <dd><a href="index.html#StarterLinkMessage">type StarterLinkMessage</a></dd>
  117. <dd>&nbsp; &nbsp; <a href="index.html#StarterLinkMessage.MarshalJSON">func (m StarterLinkMessage) MarshalJSON() ([]byte, error)</a></dd>
  118. <dd><a href="index.html#TextMessage">type TextMessage</a></dd>
  119. <dd><a href="index.html#Worker">type Worker</a></dd>
  120. <dd>&nbsp; &nbsp; <a href="index.html#Worker.OnEventType">func (worker *Worker) OnEventType(eventType string, callback OnEventListener)</a></dd>
  121. </dl>
  122. </div><!-- #manual-nav -->
  123. <h4>Package files</h4>
  124. <p>
  125. <span style="font-size:90%">
  126. <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go">matrix.go</a>
  127. <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/responses.go">responses.go</a>
  128. <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go">types.go</a>
  129. <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/worker.go">worker.go</a>
  130. </span>
  131. </p>
  132. </div><!-- .expanded -->
  133. </div><!-- #pkg-index -->
  134. <div id="pkg-callgraph" class="toggle" style="display: none">
  135. <div class="collapsed">
  136. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  137. </div> <!-- .expanded -->
  138. <div class="expanded">
  139. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  140. <p>
  141. In the call graph viewer below, each node
  142. is a function belonging to this package
  143. and its children are the functions it
  144. calls&mdash;perhaps dynamically.
  145. </p>
  146. <p>
  147. The root nodes are the entry points of the
  148. package: functions that may be called from
  149. outside the package.
  150. There may be non-exported or anonymous
  151. functions among them if they are called
  152. dynamically from another package.
  153. </p>
  154. <p>
  155. Click a node to visit that function's source code.
  156. From there you can visit its callers by
  157. clicking its declaring <code>func</code>
  158. token.
  159. </p>
  160. <p>
  161. Functions may be omitted if they were
  162. determined to be unreachable in the
  163. particular programs or tests that were
  164. analyzed.
  165. </p>
  166. <!-- Zero means show all package entry points. -->
  167. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  168. </div>
  169. </div> <!-- #pkg-callgraph -->
  170. <h2 id="Client">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=1682:2113#L41">Client</a></h2>
  171. <pre>type Client struct {
  172. HomeserverURL *<a href="../../../../net/url/index.html">url</a>.<a href="../../../../net/url/index.html#URL">URL</a>
  173. Prefix <a href="../../../../builtin/index.html#string">string</a>
  174. UserID <a href="../../../../builtin/index.html#string">string</a>
  175. AccessToken <a href="../../../../builtin/index.html#string">string</a>
  176. Rooms map[<a href="../../../../builtin/index.html#string">string</a>]*<a href="index.html#Room">Room</a>
  177. Worker *<a href="index.html#Worker">Worker</a>
  178. NextBatchStorer <a href="index.html#NextBatchStorer">NextBatchStorer</a>
  179. ClientConfig <a href="../api/index.html">api</a>.<a href="../api/index.html#ClientConfig">ClientConfig</a>
  180. <span class="comment">// contains filtered or unexported fields</span>
  181. }</pre>
  182. <p>
  183. Client represents a Matrix client.
  184. </p>
  185. <h3 id="NewClient">func <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=13316:13415#L417">NewClient</a></h3>
  186. <pre>func NewClient(httpClient *<a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#Client">Client</a>, homeserverURL *<a href="../../../../net/url/index.html">url</a>.<a href="../../../../net/url/index.html#URL">URL</a>, accessToken, userID <a href="../../../../builtin/index.html#string">string</a>) *<a href="index.html#Client">Client</a></pre>
  187. <p>
  188. NewClient creates a new Matrix Client ready for syncing
  189. </p>
  190. <h3 id="Client.JoinRoom">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=3258:3351#L89">JoinRoom</a></h3>
  191. <pre>func (cli *<a href="index.html#Client">Client</a>) JoinRoom(roomIDorAlias, serverName, invitingUserID <a href="../../../../builtin/index.html#string">string</a>) (<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  192. <p>
  193. JoinRoom joins the client to a room ID or alias. If serverName is specified, this will be added as a query param
  194. to instruct the homeserver to join via that server. If invitingUserID is specified, the inviting user ID will be
  195. inserted into the content of the join request. Returns a room ID.
  196. </p>
  197. <h3 id="Client.SendMessageEvent">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=4448:4557#L127">SendMessageEvent</a></h3>
  198. <pre>func (cli *<a href="index.html#Client">Client</a>) SendMessageEvent(roomID <a href="../../../../builtin/index.html#string">string</a>, eventType <a href="../../../../builtin/index.html#string">string</a>, contentJSON interface{}) (<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  199. <p>
  200. SendMessageEvent sends a message event into a room, returning the event_id on success.
  201. contentJSON should be a pointer to something that can be encoded as JSON using json.Marshal.
  202. </p>
  203. <h3 id="Client.SendText">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=5050:5114#L142">SendText</a></h3>
  204. <pre>func (cli *<a href="index.html#Client">Client</a>) SendText(roomID, text <a href="../../../../builtin/index.html#string">string</a>) (<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  205. <p>
  206. SendText sends an m.room.message event into the given room with a msgtype of m.text
  207. </p>
  208. <h3 id="Client.SetDisplayName">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=4005:4064#L116">SetDisplayName</a></h3>
  209. <pre>func (cli *<a href="index.html#Client">Client</a>) SetDisplayName(displayName <a href="../../../../builtin/index.html#string">string</a>) <a href="../../../../builtin/index.html#error">error</a></pre>
  210. <p>
  211. SetDisplayName sets the user&#39;s profile display name
  212. </p>
  213. <h3 id="Client.StopSync">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=10765:10794#L319">StopSync</a></h3>
  214. <pre>func (cli *<a href="index.html#Client">Client</a>) StopSync()</pre>
  215. <p>
  216. StopSync stops the ongoing sync started by Sync.
  217. </p>
  218. <h3 id="Client.Sync">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=6659:6684#L192">Sync</a></h3>
  219. <pre>func (cli *<a href="index.html#Client">Client</a>) Sync()</pre>
  220. <p>
  221. Sync starts syncing with the provided Homeserver. This function will be invoked continually.
  222. If Sync is called twice then the first sync will be stopped.
  223. </p>
  224. <h3 id="Client.UploadLink">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=5269:5327#L148">UploadLink</a></h3>
  225. <pre>func (cli *<a href="index.html#Client">Client</a>) UploadLink(link <a href="../../../../builtin/index.html#string">string</a>) (<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  226. <p>
  227. UploadLink uploads an HTTP URL and then returns an MXC URI.
  228. </p>
  229. <h3 id="Client.UploadToContentRepo">func (*Client) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=5643:5757#L160">UploadToContentRepo</a></h3>
  230. <pre>func (cli *<a href="index.html#Client">Client</a>) UploadToContentRepo(content <a href="../../../../io/index.html">io</a>.<a href="../../../../io/index.html#Reader">Reader</a>, contentType <a href="../../../../builtin/index.html#string">string</a>, contentLength <a href="../../../../builtin/index.html#int64">int64</a>) (<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  231. <p>
  232. UploadToContentRepo uploads the given bytes to the content repository and returns an MXC URI.
  233. </p>
  234. <h2 id="Event">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=1576:2340#L50">Event</a></h2>
  235. <pre>type Event struct {
  236. StateKey <a href="../../../../builtin/index.html#string">string</a> `json:&#34;state_key&#34;` <span class="comment">// The state key for the event. Only present on State Events.</span>
  237. Sender <a href="../../../../builtin/index.html#string">string</a> `json:&#34;sender&#34;` <span class="comment">// The user ID of the sender of the event</span>
  238. Type <a href="../../../../builtin/index.html#string">string</a> `json:&#34;type&#34;` <span class="comment">// The event type</span>
  239. Timestamp <a href="../../../../builtin/index.html#int">int</a> `json:&#34;origin_server_ts&#34;` <span class="comment">// The unix timestamp when this message was sent by the origin server</span>
  240. ID <a href="../../../../builtin/index.html#string">string</a> `json:&#34;event_id&#34;` <span class="comment">// The unique ID of this event</span>
  241. RoomID <a href="../../../../builtin/index.html#string">string</a> `json:&#34;room_id&#34;` <span class="comment">// The room the event was sent to. May be nil (e.g. for presence)</span>
  242. Content map[<a href="../../../../builtin/index.html#string">string</a>]interface{} `json:&#34;content&#34;` <span class="comment">// The JSON content of the event.</span>
  243. }</pre>
  244. <p>
  245. Event represents a single Matrix event.
  246. </p>
  247. <h3 id="Event.Body">func (*Event) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=2444:2493#L62">Body</a></h3>
  248. <pre>func (event *<a href="index.html#Event">Event</a>) Body() (body <a href="../../../../builtin/index.html#string">string</a>, ok <a href="../../../../builtin/index.html#bool">bool</a>)</pre>
  249. <p>
  250. Body returns the value of the &#34;body&#34; key in the event content if it is
  251. present and is a string.
  252. </p>
  253. <h3 id="Event.MessageType">func (*Event) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=2712:2771#L73">MessageType</a></h3>
  254. <pre>func (event *<a href="index.html#Event">Event</a>) MessageType() (msgtype <a href="../../../../builtin/index.html#string">string</a>, ok <a href="../../../../builtin/index.html#bool">bool</a>)</pre>
  255. <p>
  256. MessageType returns the value of the &#34;msgtype&#34; key in the event content if
  257. it is present and is a string.
  258. </p>
  259. <h2 id="HTMLMessage">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=3509:3695#L105">HTMLMessage</a></h2>
  260. <pre>type HTMLMessage struct {
  261. Body <a href="../../../../builtin/index.html#string">string</a> `json:&#34;body&#34;`
  262. MsgType <a href="../../../../builtin/index.html#string">string</a> `json:&#34;msgtype&#34;`
  263. Format <a href="../../../../builtin/index.html#string">string</a> `json:&#34;format&#34;`
  264. FormattedBody <a href="../../../../builtin/index.html#string">string</a> `json:&#34;formatted_body&#34;`
  265. }</pre>
  266. <p>
  267. An HTMLMessage is the contents of a Matrix HTML formated message event.
  268. </p>
  269. <h3 id="GetHTMLMessage">func <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=3885:3942#L116">GetHTMLMessage</a></h3>
  270. <pre>func GetHTMLMessage(msgtype, htmlText <a href="../../../../builtin/index.html#string">string</a>) <a href="index.html#HTMLMessage">HTMLMessage</a></pre>
  271. <p>
  272. GetHTMLMessage returns an HTMLMessage with the body set to a stripped version of the provided HTML, in addition
  273. to the provided HTML.
  274. </p>
  275. <h2 id="ImageInfo">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=3085:3232#L89">ImageInfo</a></h2>
  276. <pre>type ImageInfo struct {
  277. Height <a href="../../../../builtin/index.html#uint">uint</a> `json:&#34;h&#34;`
  278. Width <a href="../../../../builtin/index.html#uint">uint</a> `json:&#34;w&#34;`
  279. Mimetype <a href="../../../../builtin/index.html#string">string</a> `json:&#34;mimetype&#34;`
  280. Size <a href="../../../../builtin/index.html#uint">uint</a> `json:&#34;size&#34;`
  281. }</pre>
  282. <p>
  283. ImageInfo contains info about an image
  284. </p>
  285. <h2 id="ImageMessage">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=3270:3432#L97">ImageMessage</a></h2>
  286. <pre>type ImageMessage struct {
  287. MsgType <a href="../../../../builtin/index.html#string">string</a> `json:&#34;msgtype&#34;`
  288. Body <a href="../../../../builtin/index.html#string">string</a> `json:&#34;body&#34;`
  289. URL <a href="../../../../builtin/index.html#string">string</a> `json:&#34;url&#34;`
  290. Info <a href="index.html#ImageInfo">ImageInfo</a> `json:&#34;info&#34;`
  291. }</pre>
  292. <p>
  293. ImageMessage is an m.image event
  294. </p>
  295. <h2 id="NextBatchStorer">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/matrix.go?s=1167:1409#L27">NextBatchStorer</a></h2>
  296. <pre>type NextBatchStorer interface {
  297. <span class="comment">// Save a next_batch token for a given user. Best effort.</span>
  298. Save(userID, nextBatch <a href="../../../../builtin/index.html#string">string</a>)
  299. <span class="comment">// Load a next_batch token for a given user. Return an empty string if no token exists.</span>
  300. Load(userID <a href="../../../../builtin/index.html#string">string</a>) <a href="../../../../builtin/index.html#string">string</a>
  301. }</pre>
  302. <p>
  303. NextBatchStorer controls loading/saving of next_batch tokens for users
  304. </p>
  305. <h2 id="OnEventListener">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/worker.go?s=431:464#L6">OnEventListener</a></h2>
  306. <pre>type OnEventListener func(*<a href="index.html#Event">Event</a>)</pre>
  307. <p>
  308. OnEventListener can be used with Worker.OnEventType to be informed of incoming events.
  309. </p>
  310. <h2 id="Room">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=104:198#L1">Room</a></h2>
  311. <pre>type Room struct {
  312. ID <a href="../../../../builtin/index.html#string">string</a>
  313. State map[<a href="../../../../builtin/index.html#string">string</a>]map[<a href="../../../../builtin/index.html#string">string</a>]*<a href="index.html#Event">Event</a>
  314. Timeline []<a href="index.html#Event">Event</a>
  315. }</pre>
  316. <p>
  317. Room represents a single Matrix room.
  318. </p>
  319. <h3 id="NewRoom">func <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=1358:1391#L41">NewRoom</a></h3>
  320. <pre>func NewRoom(roomID <a href="../../../../builtin/index.html#string">string</a>) *<a href="index.html#Room">Room</a></pre>
  321. <p>
  322. NewRoom creates a new Room with the given ID
  323. </p>
  324. <h3 id="Room.GetMembershipState">func (Room) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=977:1034#L25">GetMembershipState</a></h3>
  325. <pre>func (room <a href="index.html#Room">Room</a>) GetMembershipState(userID <a href="../../../../builtin/index.html#string">string</a>) <a href="../../../../builtin/index.html#string">string</a></pre>
  326. <p>
  327. GetMembershipState returns the membership state of the given user ID in this room. If there is
  328. no entry for this member, &#39;leave&#39; is returned for consistency with left users.
  329. </p>
  330. <h3 id="Room.GetStateEvent">func (Room) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=625:697#L17">GetStateEvent</a></h3>
  331. <pre>func (room <a href="index.html#Room">Room</a>) GetStateEvent(eventType <a href="../../../../builtin/index.html#string">string</a>, stateKey <a href="../../../../builtin/index.html#string">string</a>) *<a href="index.html#Event">Event</a></pre>
  332. <p>
  333. GetStateEvent returns the state event for the given type/state_key combo, or nil.
  334. </p>
  335. <h3 id="Room.UpdateState">func (Room) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=339:381#L8">UpdateState</a></h3>
  336. <pre>func (room <a href="index.html#Room">Room</a>) UpdateState(event *<a href="index.html#Event">Event</a>)</pre>
  337. <p>
  338. UpdateState updates the room&#39;s current state with the given Event. This will clobber events based
  339. on the type/state_key combination.
  340. </p>
  341. <h2 id="StarterLinkMessage">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=4231:4291#L126">StarterLinkMessage</a></h2>
  342. <pre>type StarterLinkMessage struct {
  343. Body <a href="../../../../builtin/index.html#string">string</a>
  344. Link <a href="../../../../builtin/index.html#string">string</a>
  345. }</pre>
  346. <p>
  347. StarterLinkMessage represents a message with a starter_link custom data.
  348. </p>
  349. <h3 id="StarterLinkMessage.MarshalJSON">func (StarterLinkMessage) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=4362:4419#L132">MarshalJSON</a></h3>
  350. <pre>func (m <a href="index.html#StarterLinkMessage">StarterLinkMessage</a>) MarshalJSON() ([]<a href="../../../../builtin/index.html#byte">byte</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  351. <p>
  352. MarshalJSON converts this message into actual event content JSON.
  353. </p>
  354. <h2 id="TextMessage">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/types.go?s=2951:3041#L83">TextMessage</a></h2>
  355. <pre>type TextMessage struct {
  356. MsgType <a href="../../../../builtin/index.html#string">string</a> `json:&#34;msgtype&#34;`
  357. Body <a href="../../../../builtin/index.html#string">string</a> `json:&#34;body&#34;`
  358. }</pre>
  359. <p>
  360. TextMessage is the contents of a Matrix formated message event.
  361. </p>
  362. <h2 id="Worker">type <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/worker.go?s=225:339#L1">Worker</a></h2>
  363. <pre>type Worker struct {
  364. <span class="comment">// contains filtered or unexported fields</span>
  365. }</pre>
  366. <p>
  367. Worker processes incoming events and updates the Matrix client&#39;s data structures. It also informs
  368. any attached listeners of the new events.
  369. </p>
  370. <h3 id="Worker.OnEventType">func (*Worker) <a href="http://localhost:6060/src/github.com/matrix-org/go-neb/matrix/worker.go?s=709:786#L17">OnEventType</a></h3>
  371. <pre>func (worker *<a href="index.html#Worker">Worker</a>) OnEventType(eventType <a href="../../../../builtin/index.html#string">string</a>, callback <a href="index.html#OnEventListener">OnEventListener</a>)</pre>
  372. <p>
  373. OnEventType allows callers to be notified when there are new events for the given event type.
  374. There are no duplicate checks.
  375. </p>
  376. <div id="footer">
  377. Build version go1.6.<br>
  378. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  379. the content of this page is licensed under the
  380. Creative Commons Attribution 3.0 License,
  381. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  382. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  383. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  384. </div>
  385. </div><!-- .container -->
  386. </div><!-- #page -->
  387. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  388. <script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script>
  389. <script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script>
  390. <script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script>
  391. <script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script>
  392. </body>
  393. </html>