requests.go 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package gomatrix
  2. // ReqRegister is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register
  3. type ReqRegister struct {
  4. Username string `json:"username,omitempty"`
  5. BindEmail bool `json:"bind_email,omitempty"`
  6. Password string `json:"password,omitempty"`
  7. DeviceID string `json:"device_id,omitempty"`
  8. InitialDeviceDisplayName string `json:"initial_device_display_name"`
  9. Auth interface{} `json:"auth,omitempty"`
  10. }
  11. // ReqLogin is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-login
  12. type ReqLogin struct {
  13. Type string `json:"type"`
  14. Password string `json:"password,omitempty"`
  15. Medium string `json:"medium,omitempty"`
  16. User string `json:"user,omitempty"`
  17. Address string `json:"address,omitempty"`
  18. Token string `json:"token,omitempty"`
  19. DeviceID string `json:"device_id,omitempty"`
  20. InitialDeviceDisplayName string `json:"initial_device_display_name,omitempty"`
  21. }
  22. // ReqCreateRoom is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
  23. type ReqCreateRoom struct {
  24. Visibility string `json:"visibility,omitempty"`
  25. RoomAliasName string `json:"room_alias_name,omitempty"`
  26. Name string `json:"name,omitempty"`
  27. Topic string `json:"topic,omitempty"`
  28. Invite []string `json:"invite,omitempty"`
  29. Invite3PID []ReqInvite3PID `json:"invite_3pid,omitempty"`
  30. CreationContent map[string]interface{} `json:"creation_content,omitempty"`
  31. InitialState []*Event `json:"initial_state,omitempty"`
  32. Preset string `json:"preset,omitempty"`
  33. IsDirect bool `json:"is_direct,omitempty"`
  34. }
  35. // ReqRedact is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
  36. type ReqRedact struct {
  37. Reason string `json:"reason,omitempty"`
  38. }
  39. // ReqInvite3PID is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#id57
  40. // It is also a JSON object used in https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
  41. type ReqInvite3PID struct {
  42. IDServer string `json:"id_server"`
  43. Medium string `json:"medium"`
  44. Address string `json:"address"`
  45. }
  46. // ReqInviteUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite
  47. type ReqInviteUser struct {
  48. UserID string `json:"user_id"`
  49. }
  50. // ReqKickUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick
  51. type ReqKickUser struct {
  52. Reason string `json:"reason,omitempty"`
  53. UserID string `json:"user_id"`
  54. }
  55. // ReqBanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban
  56. type ReqBanUser struct {
  57. Reason string `json:"reason,omitempty"`
  58. UserID string `json:"user_id"`
  59. }
  60. // ReqUnbanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban
  61. type ReqUnbanUser struct {
  62. UserID string `json:"user_id"`
  63. }
  64. // ReqTyping is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid
  65. type ReqTyping struct {
  66. Typing bool `json:"typing"`
  67. Timeout int64 `json:"timeout,omitempty"`
  68. }
  69. type ReqPresence struct {
  70. Presence string `json:"presence"`
  71. }