requests.hrl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. -include("basic_types.hrl").
  2. -include("types.hrl").
  3. %%% Contains list of API requests, that can be made, using KamfRequest call
  4. %%% Name of record corresponds to method, memebers to params
  5. %%% All this requests are processed by session
  6. -record(session_attach, {
  7. token :: string() %% shared secret, stored in auth_server
  8. }).
  9. -record(session_attach_debug, {
  10. token :: string(), %% shared secret, stored in auth_server
  11. id :: string()
  12. }).
  13. -record(login, {
  14. username :: string(),
  15. password :: string()
  16. }).
  17. -record(logout, {}).
  18. -record(match_me, {
  19. game_type :: binary()
  20. }).
  21. -record(match_found, {
  22. ref :: any(), %% request ref
  23. game_id :: 'GameId'(), %% id of game
  24. is_replacing = false :: boolean(), %% id of game
  25. pid :: pid() %% relay, session should connect to
  26. }).
  27. -record(join_game, {
  28. game :: 'GameId'()
  29. }).
  30. -record(rematch, {
  31. game :: 'GameId'()
  32. }).
  33. -record(get_game_info, {
  34. game :: 'GameId'()
  35. }).
  36. -record(get_player_info, {
  37. player_id :: 'PlayerId'() | 0 %% 0 stands for currently logged in user
  38. }).
  39. -record(get_player_stats, {
  40. player_id :: 'PlayerId'() | 0, %% 0 stands for currently logged in user
  41. game_type :: binary()
  42. }).
  43. -record(subscribe_player_rels, {
  44. players :: list()
  45. }).
  46. -record(unsubscribe_player_rels, {
  47. players :: list()
  48. }).
  49. -record(chat, {
  50. chat_id :: 'GameId'(),
  51. message :: string()
  52. }).
  53. -record(game_action, {
  54. game :: 'GameId'(),
  55. action :: any(),
  56. args = [] :: proplist()
  57. }).
  58. %%%
  59. %%% Events, passed via #KakaMessage
  60. %%%
  61. -record(game_event, {
  62. game :: 'GameId'(),
  63. event :: any(),
  64. args = [] :: proplist()
  65. }).
  66. -record(game_matched, {
  67. ref :: any(),
  68. is_replacing = false :: boolean,
  69. game :: 'GameId'()
  70. }).
  71. -record(game_rematched, {
  72. game :: 'GameId'()
  73. }).
  74. -record(game_crashed, {
  75. game :: 'GameId'()
  76. }).
  77. -record(dummy_player_change, {
  78. player :: 'PlayerId'()
  79. }).
  80. -record(chat_msg, {
  81. chat :: 'GameId'(),
  82. content :: string(),
  83. author_id :: 'PlayerId'(),
  84. author_nick :: string()
  85. }).
  86. -record(social_action, {
  87. game :: 'GameId'(),
  88. type :: 'SocialActionEnum'(),
  89. recipient :: 'PlayerId'() | null
  90. }).
  91. -record(social_action_msg, {
  92. type :: 'SocialActionEnum'(),
  93. game :: 'GameId'(),
  94. initiator :: 'PlayerId'(),
  95. recipient :: 'PlayerId'() | null
  96. }).
  97. -record(pause_game, {
  98. table_id :: integer(),
  99. game :: 'GameId'(),
  100. action :: string()
  101. }).
  102. -record(game_paused, {
  103. table_id :: integer(),
  104. game :: 'GameId'(),
  105. action :: string(),
  106. who :: 'PlayerId'(),
  107. retries :: integer()
  108. }).
  109. -record(disconnect, {
  110. reason_id = null :: null | string(),
  111. reason = null :: null | string()
  112. }).
  113. %% packet as game_event:
  114. -record(player_left, {
  115. player :: 'PlayerId'(),
  116. bot_replaced = false :: boolean(), %% will be replaced by bot?
  117. human_replaced = false :: boolean(), %% will be replaced by human?
  118. replacement = null :: 'PlayerId'() | null %% id of replacement player/bot
  119. }).
  120. -record('TableInfo', {
  121. chat = [] :: list(any()),
  122. viewers = [] :: list('PlayerId'()),
  123. players = [] :: list('PlayerId'()),
  124. game :: atom(),
  125. game_status :: atom()
  126. }).
  127. %%% tests
  128. -record(getobjecttypefromserver, {}).
  129. -record(getstringtypefromserver, {}).
  130. -record(getintegertypefromserver, {}).
  131. -record(getmixedtypesfromserver, {}).
  132. -record('some_named_object', {name1, name2, name3}).
  133. -record(fastping, {}).
  134. -record(slowping, {}).