Ei kuvausta

PushRequestPath.php 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: zhangdali
  5. * Date: 2016/12/7
  6. * Time: 下午6:30
  7. */
  8. namespace xmpush;
  9. class PushRequestPath {
  10. // regid message
  11. static function V2_SEND() {
  12. return new static("/v2/send", PushRequestType::MESSAGE);
  13. }
  14. static function V2_REGID_MESSAGE() {
  15. return new static("/v2/message/regid", PushRequestType::MESSAGE);
  16. }
  17. static function V3_REGID_MESSAGE() {
  18. return new static("/v3/message/regid", PushRequestType::MESSAGE);
  19. }
  20. // subscribe topic
  21. static function V2_SUBSCRIBE_TOPIC() {
  22. return new static("/v2/topic/subscribe", PushRequestType::MESSAGE);
  23. }
  24. static function V2_UNSUBSCRIBE_TOPIC() {
  25. return new static("/v2/topic/unsubscribe", PushRequestType::MESSAGE);
  26. }
  27. static function V2_SUBSCRIBE_TOPIC_BY_ALIAS() {
  28. return new static("/v2/topic/subscribe/alias", PushRequestType::MESSAGE);
  29. }
  30. static function V2_UNSUBSCRIBE_TOPIC_BY_ALIAS() {
  31. return new static("/v2/topic/unsubscribe/alias", PushRequestType::MESSAGE);
  32. }
  33. // alias message
  34. static function V2_ALIAS_MESSAGE() {
  35. return new static("/v2/message/alias", PushRequestType::MESSAGE);
  36. }
  37. static function V3_ALIAS_MESSAGE() {
  38. return new static("/v3/message/alias", PushRequestType::MESSAGE);
  39. }
  40. // broadcast message
  41. static function V2_BROADCAST_TO_ALL() {
  42. return new static("/v2/message/all", PushRequestType::MESSAGE);
  43. }
  44. static function V3_BROADCAST_TO_ALL() {
  45. return new static("/v3/message/all", PushRequestType::MESSAGE);
  46. }
  47. static function V2_BROADCAST() {
  48. return new static("/v2/message/topic", PushRequestType::MESSAGE);
  49. }
  50. static function V3_BROADCAST() {
  51. return new static("/v3/message/topic", PushRequestType::MESSAGE);
  52. }
  53. static function V2_MULTI_TOPIC_BROADCAST() {
  54. return new static("/v2/message/multi_topic", PushRequestType::MESSAGE);
  55. }
  56. static function V3_MILTI_TOPIC_BROADCAST() {
  57. return new static("/v3/message/multi_topic", PushRequestType::MESSAGE);
  58. }
  59. static function V2_DELETE_BROADCAST_MESSAGE() {
  60. return new static("/v2/message/delete", PushRequestType::MESSAGE);
  61. }
  62. // user account message
  63. static function V2_USER_ACCOUNT_MESSAGE() {
  64. return new static("/v2/message/user_account", PushRequestType::MESSAGE);
  65. }
  66. // miid message
  67. static function V2_MIID_MESSAGE() {
  68. return new static("/v2/message/miid", PushRequestType::MESSAGE);
  69. }
  70. // multi message
  71. static function V2_SEND_MULTI_MESSAGE_WITH_REGID() {
  72. return new self("/v2/multi_messages/regids", PushRequestType::MESSAGE);
  73. }
  74. static function V2_SEND_MULTI_MESSAGE_WITH_ALIAS() {
  75. return new self("/v2/multi_messages/aliases", PushRequestType::MESSAGE);
  76. }
  77. static function V2_SEND_MULTI_MESSAGE_WITH_ACCOUNT() {
  78. return new self("/v2/multi_messages/user_accounts", PushRequestType::MESSAGE);
  79. }
  80. // validate
  81. static function V1_VALIDATE_REGID() {
  82. return new static("/v1/validation/regids", PushRequestType::MESSAGE);
  83. }
  84. static function V1_GET_ALL_ACCOUNT() {
  85. return new static("/v1/account/all", PushRequestType::MESSAGE);
  86. }
  87. static function V1_GET_ALL_TOPIC() {
  88. return new static("/v1/topic/all", PushRequestType::MESSAGE);
  89. }
  90. static function V1_GET_ALL_ALIAS() {
  91. return new static("/v1/alias/all", PushRequestType::MESSAGE);
  92. }
  93. static function V1_GET_ALL_MIID() {
  94. return new static("/v1/miid/all", PushRequestType::MESSAGE);
  95. }
  96. // trace
  97. static function V1_MESSAGES_STATUS() {
  98. return new static("/v1/trace/messages/status", PushRequestType::MESSAGE);
  99. }
  100. static function V1_MESSAGE_STATUS() {
  101. return new static("/v1/trace/message/status", PushRequestType::MESSAGE);
  102. }
  103. static function V1_GET_MESSAGE_COUNTERS() {
  104. return new static("/v1/stats/message/counters", PushRequestType::MESSAGE);
  105. }
  106. // presence
  107. static function V1_REGID_PRESENCE() {
  108. return new static("/v1/regid/presence", PushRequestType::MESSAGE);
  109. }
  110. static function V2_REGID_PRESENCE() {
  111. return new static("/v1/regid/presence", PushRequestType::MESSAGE);
  112. }
  113. // schedule job
  114. static function V2_DELETE_SCHEDULE_JOB() {
  115. return new static("/v2/schedule_job/delete", PushRequestType::MESSAGE);
  116. }
  117. static function V3_DELETE_SCHEDULE_JOB() {
  118. return new static("/v3/schedule_job/delete", PushRequestType::MESSAGE);
  119. }
  120. static function V2_CHECK_SCHEDULE_JOB_EXIST() {
  121. return new static("/v2/schedule_job/exist", PushRequestType::MESSAGE);
  122. }
  123. static function V2_QUERY_SCHEDULE_JOB() {
  124. return new static("/v2/schedule_job/query", PushRequestType::MESSAGE);
  125. }
  126. // feedback
  127. static function V1_FEEDBACK_INVALID_ALIAS() {
  128. return new static("/v1/feedback/fetch_invalid_aliases", PushRequestType::FEEDBACK);
  129. }
  130. static function V1_FEEDBACK_INVALID_REGID() {
  131. return new static("/v1/feedback/fetch_invalid_regids", PushRequestType::FEEDBACK);
  132. }
  133. static function V1_FEEDBACK_INVALID_MIID() {
  134. return new static("/v1/feedback/fetch_invalid_miid", PushRequestType::FEEDBACK);
  135. }
  136. // emq job
  137. static function V1_EMQ_ACK_INFO() {
  138. return new static("/msg/ack/info", PushRequestType::EMQ);
  139. }
  140. static function V1_EMQ_CLICK_INFO() {
  141. return new static("/msg/click/info", PushRequestType::EMQ);
  142. }
  143. static function V1_EMQ_INVALID_REGID() {
  144. return new static("/app/invalid/regid", PushRequestType::EMQ);
  145. }
  146. /**
  147. * PushRequestPath constructor.
  148. * @param string $path
  149. * @param int $requestType
  150. */
  151. public function __construct($path, $requestType) {
  152. $this->path = $path;
  153. $this->requestType = $requestType;
  154. }
  155. /**
  156. * @return int
  157. */
  158. public function getRequestType() {
  159. return $this->requestType;
  160. }
  161. /**
  162. * @return string
  163. */
  164. public function getPath() {
  165. return $this->path;
  166. }
  167. /**
  168. * @var string
  169. */
  170. private $path;
  171. /**
  172. * @var int
  173. */
  174. private $requestType;
  175. }