lila/modules/hub/src/main/actorApi.scala

158 lines
4.0 KiB
Scala
Raw Normal View History

2013-03-21 13:16:10 -06:00
package lila.hub
package actorApi
2013-03-26 04:04:13 -06:00
import play.api.libs.json._
2013-12-28 06:53:10 -07:00
import akka.actor.ActorRef
2013-03-21 13:16:10 -06:00
2013-03-26 04:04:13 -06:00
case class SendTo(userId: String, message: JsObject)
object SendTo {
2013-03-31 12:36:48 -06:00
def apply[A: Writes](userId: String, typ: String, data: A): SendTo =
2013-03-26 04:04:13 -06:00
SendTo(userId, Json.obj("t" -> typ, "d" -> data))
}
case class SendTos(userIds: Set[String], message: JsObject)
object SendTos {
def apply[A: Writes](userIds: Set[String], typ: String, data: A): SendTos =
SendTos(userIds, Json.obj("t" -> typ, "d" -> data))
}
2013-03-30 15:30:47 -06:00
2013-10-10 02:25:30 -06:00
sealed abstract class RemindDeploy(val key: String)
case object RemindDeployPre extends RemindDeploy("deployPre")
case object RemindDeployPost extends RemindDeploy("deployPost")
case class Deploy(event: RemindDeploy, html: String)
2013-06-07 08:04:31 -06:00
2013-05-29 09:46:21 -06:00
package map {
2013-12-27 15:12:20 -07:00
case class Get(id: String)
case class Tell(id: String, msg: Any)
case class TellAll(msg: Any)
case class Ask(id: String, msg: Any)
case object Size
2013-05-29 09:46:21 -06:00
}
2013-05-18 22:08:09 -06:00
case class WithUserIds(f: Iterable[String] ⇒ Unit)
2013-04-15 05:29:58 -06:00
2013-05-18 21:31:06 -06:00
case object GetUids
2013-05-12 09:27:28 -06:00
2013-12-27 15:12:20 -07:00
package chat {
2013-12-28 06:53:10 -07:00
case class Input(uid: String, json: JsObject)
case class System(chanTyp: String, chanId: Option[String], text: String)
2013-12-27 15:12:20 -07:00
}
package report {
case class Cheater(userId: String, text: String)
2014-01-16 01:46:01 -07:00
case class Check(userId: String)
}
package mod {
case class MarkCheater(userId: String)
}
2013-06-05 05:55:16 -06:00
package setup {
2013-12-27 15:12:20 -07:00
case class RemindChallenge(gameId: String, from: String, to: String)
case class DeclineChallenge(gameId: String)
2013-06-05 05:55:16 -06:00
}
2013-03-31 12:36:48 -06:00
package captcha {
2013-12-27 15:12:20 -07:00
case object AnyCaptcha
case class GetCaptcha(id: String)
case class ValidCaptcha(id: String, solution: String)
2013-03-31 12:36:48 -06:00
}
2013-04-01 08:31:08 -06:00
package lobby {
2013-12-27 15:12:20 -07:00
case class ReloadTournaments(html: String)
case object NewForumPost
2013-04-01 08:31:08 -06:00
}
package timeline {
2013-12-27 15:12:20 -07:00
case class ReloadTimeline(user: String)
2013-05-24 10:27:42 -06:00
2013-12-27 15:12:20 -07:00
sealed trait Atom
case class Follow(u1: String, u2: String) extends Atom
case class TeamJoin(userId: String, teamId: String) extends Atom
case class TeamCreate(userId: String, teamId: String) extends Atom
case class ForumPost(userId: String, topicName: String, postId: String) extends Atom
2013-05-24 10:27:42 -06:00
2013-12-27 15:12:20 -07:00
object atomFormat {
2013-05-24 10:27:42 -06:00
2013-12-27 15:12:20 -07:00
implicit val followFormat = Json.format[Follow]
implicit val teamJoinFormat = Json.format[TeamJoin]
implicit val teamCreateFormat = Json.format[TeamCreate]
implicit val forumPostFormat = Json.format[ForumPost]
}
2013-05-24 10:27:42 -06:00
2013-12-27 15:12:20 -07:00
object propagation {
sealed trait Propagation
case class Users(users: List[String]) extends Propagation
case class Friends(user: String) extends Propagation
case class StaffFriends(user: String) extends Propagation
}
2013-05-24 14:37:27 -06:00
2013-12-27 15:12:20 -07:00
import propagation._
2013-05-24 14:37:27 -06:00
2013-12-27 15:12:20 -07:00
case class Propagate(data: Atom, propagations: List[Propagation] = Nil) {
def toUsers(ids: List[String]) = copy(propagations = Users(ids) :: propagations)
def toFriendsOf(id: String) = copy(propagations = Friends(id) :: propagations)
def toStaffFriendsOf(id: String) = copy(propagations = StaffFriends(id) :: propagations)
}
}
2013-05-08 12:30:55 -06:00
package game {
2013-12-27 15:12:20 -07:00
case object Count
2013-05-08 12:30:55 -06:00
}
package message {
2013-12-27 15:12:20 -07:00
case class LichessThread(to: String, subject: String, message: String)
}
package router {
2013-12-27 15:12:20 -07:00
case class Abs(route: Any)
case class Nolang(route: Any)
case object Homepage
case class TeamShow(id: String)
2014-01-07 18:43:20 -07:00
case class User(username: String)
2013-12-27 15:12:20 -07:00
case class Player(fullId: String)
case class Watcher(gameId: String, color: String)
case class Replay(gameId: String, color: String)
case class Pgn(gameId: String)
case class Tourney(tourId: String)
}
package forum {
2013-12-27 15:12:20 -07:00
case class MakeTeam(id: String, name: String)
}
2013-04-05 06:07:25 -06:00
package ai {
2013-12-27 15:12:20 -07:00
case object GetLoad
case class Analyse(uciMoves: List[String], initialFen: Option[String])
2013-04-05 06:07:25 -06:00
}
2013-04-08 13:21:03 -06:00
package monitor {
2013-12-27 15:12:20 -07:00
case object AddRequest
case object Update
2013-04-08 13:21:03 -06:00
}
package round {
2013-12-27 15:12:20 -07:00
case class MoveEvent(
gameId: String,
fen: String,
move: String,
ip: String,
meta: String) // x, +, #, +x, #x
case class FinishGame(gameId: String)
2013-04-08 13:21:03 -06:00
}
package bookmark {
2013-12-27 15:12:20 -07:00
case class Toggle(gameId: String, userId: String)
case class Remove(gameIds: List[String])
}
package relation {
2013-12-27 15:12:20 -07:00
case class ReloadOnlineFriends(userId: String)
case class GetOnlineFriends(userId: String)
case class OnlineFriends(usernames: List[String], nb: Int)
2013-12-29 06:08:28 -07:00
case class Block(u1: String, u2: String)
case class UnBlock(u1: String, u2: String)
}