PageRenderTime 26ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Twilio/Rest/Video/V1/RoomOptions.php

http://github.com/twilio/twilio-php
PHP | 300 lines | 103 code | 24 blank | 173 comment | 0 complexity | c868d4948c7ea1332900f9f95b7e34f5 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Video\V1;
  9. use Twilio\Options;
  10. use Twilio\Values;
  11. abstract class RoomOptions {
  12. /**
  13. * @param bool $enableTurn Enable Twilio's Network Traversal TURN service
  14. * @param string $type The type of room
  15. * @param string $uniqueName An application-defined string that uniquely
  16. * identifies the resource
  17. * @param string $statusCallback The URL to send status information to your
  18. * application
  19. * @param string $statusCallbackMethod The HTTP method we should use to call
  20. * status_callback
  21. * @param int $maxParticipants The maximum number of concurrent Participants
  22. * allowed in the room
  23. * @param bool $recordParticipantsOnConnect Whether to start recording when
  24. * Participants connect
  25. * @param string[] $videoCodecs An array of the video codecs that are supported
  26. * when publishing a track in the room
  27. * @param string $mediaRegion The region for the media server in Group Rooms
  28. * @param array $recordingRules A collection of Recording Rules
  29. * @param bool $audioOnly Indicates whether the room will only contain audio
  30. * track participants for group rooms.
  31. * @return CreateRoomOptions Options builder
  32. */
  33. public static function create(bool $enableTurn = Values::NONE, string $type = Values::NONE, string $uniqueName = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, int $maxParticipants = Values::NONE, bool $recordParticipantsOnConnect = Values::NONE, array $videoCodecs = Values::ARRAY_NONE, string $mediaRegion = Values::NONE, array $recordingRules = Values::ARRAY_NONE, bool $audioOnly = Values::NONE): CreateRoomOptions {
  34. return new CreateRoomOptions($enableTurn, $type, $uniqueName, $statusCallback, $statusCallbackMethod, $maxParticipants, $recordParticipantsOnConnect, $videoCodecs, $mediaRegion, $recordingRules, $audioOnly);
  35. }
  36. /**
  37. * @param string $status Read only the rooms with this status
  38. * @param string $uniqueName Read only rooms with this unique_name
  39. * @param \DateTime $dateCreatedAfter Read only rooms that started on or after
  40. * this date, given as YYYY-MM-DD
  41. * @param \DateTime $dateCreatedBefore Read only rooms that started before this
  42. * date, given as YYYY-MM-DD
  43. * @return ReadRoomOptions Options builder
  44. */
  45. public static function read(string $status = Values::NONE, string $uniqueName = Values::NONE, \DateTime $dateCreatedAfter = Values::NONE, \DateTime $dateCreatedBefore = Values::NONE): ReadRoomOptions {
  46. return new ReadRoomOptions($status, $uniqueName, $dateCreatedAfter, $dateCreatedBefore);
  47. }
  48. }
  49. class CreateRoomOptions extends Options {
  50. /**
  51. * @param bool $enableTurn Enable Twilio's Network Traversal TURN service
  52. * @param string $type The type of room
  53. * @param string $uniqueName An application-defined string that uniquely
  54. * identifies the resource
  55. * @param string $statusCallback The URL to send status information to your
  56. * application
  57. * @param string $statusCallbackMethod The HTTP method we should use to call
  58. * status_callback
  59. * @param int $maxParticipants The maximum number of concurrent Participants
  60. * allowed in the room
  61. * @param bool $recordParticipantsOnConnect Whether to start recording when
  62. * Participants connect
  63. * @param string[] $videoCodecs An array of the video codecs that are supported
  64. * when publishing a track in the room
  65. * @param string $mediaRegion The region for the media server in Group Rooms
  66. * @param array $recordingRules A collection of Recording Rules
  67. * @param bool $audioOnly Indicates whether the room will only contain audio
  68. * track participants for group rooms.
  69. */
  70. public function __construct(bool $enableTurn = Values::NONE, string $type = Values::NONE, string $uniqueName = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, int $maxParticipants = Values::NONE, bool $recordParticipantsOnConnect = Values::NONE, array $videoCodecs = Values::ARRAY_NONE, string $mediaRegion = Values::NONE, array $recordingRules = Values::ARRAY_NONE, bool $audioOnly = Values::NONE) {
  71. $this->options['enableTurn'] = $enableTurn;
  72. $this->options['type'] = $type;
  73. $this->options['uniqueName'] = $uniqueName;
  74. $this->options['statusCallback'] = $statusCallback;
  75. $this->options['statusCallbackMethod'] = $statusCallbackMethod;
  76. $this->options['maxParticipants'] = $maxParticipants;
  77. $this->options['recordParticipantsOnConnect'] = $recordParticipantsOnConnect;
  78. $this->options['videoCodecs'] = $videoCodecs;
  79. $this->options['mediaRegion'] = $mediaRegion;
  80. $this->options['recordingRules'] = $recordingRules;
  81. $this->options['audioOnly'] = $audioOnly;
  82. }
  83. /**
  84. * Deprecated, now always considered to be true.
  85. *
  86. * @param bool $enableTurn Enable Twilio's Network Traversal TURN service
  87. * @return $this Fluent Builder
  88. */
  89. public function setEnableTurn(bool $enableTurn): self {
  90. $this->options['enableTurn'] = $enableTurn;
  91. return $this;
  92. }
  93. /**
  94. * The type of room. Can be: `go`, `peer-to-peer`, `group-small`, or `group`. The default value is `group`.
  95. *
  96. * @param string $type The type of room
  97. * @return $this Fluent Builder
  98. */
  99. public function setType(string $type): self {
  100. $this->options['type'] = $type;
  101. return $this;
  102. }
  103. /**
  104. * An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`.
  105. *
  106. * @param string $uniqueName An application-defined string that uniquely
  107. * identifies the resource
  108. * @return $this Fluent Builder
  109. */
  110. public function setUniqueName(string $uniqueName): self {
  111. $this->options['uniqueName'] = $uniqueName;
  112. return $this;
  113. }
  114. /**
  115. * The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info.
  116. *
  117. * @param string $statusCallback The URL to send status information to your
  118. * application
  119. * @return $this Fluent Builder
  120. */
  121. public function setStatusCallback(string $statusCallback): self {
  122. $this->options['statusCallback'] = $statusCallback;
  123. return $this;
  124. }
  125. /**
  126. * The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`.
  127. *
  128. * @param string $statusCallbackMethod The HTTP method we should use to call
  129. * status_callback
  130. * @return $this Fluent Builder
  131. */
  132. public function setStatusCallbackMethod(string $statusCallbackMethod): self {
  133. $this->options['statusCallbackMethod'] = $statusCallbackMethod;
  134. return $this;
  135. }
  136. /**
  137. * The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants.
  138. *
  139. * @param int $maxParticipants The maximum number of concurrent Participants
  140. * allowed in the room
  141. * @return $this Fluent Builder
  142. */
  143. public function setMaxParticipants(int $maxParticipants): self {
  144. $this->options['maxParticipants'] = $maxParticipants;
  145. return $this;
  146. }
  147. /**
  148. * Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.***
  149. *
  150. * @param bool $recordParticipantsOnConnect Whether to start recording when
  151. * Participants connect
  152. * @return $this Fluent Builder
  153. */
  154. public function setRecordParticipantsOnConnect(bool $recordParticipantsOnConnect): self {
  155. $this->options['recordParticipantsOnConnect'] = $recordParticipantsOnConnect;
  156. return $this;
  157. }
  158. /**
  159. * An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms***
  160. *
  161. * @param string[] $videoCodecs An array of the video codecs that are supported
  162. * when publishing a track in the room
  163. * @return $this Fluent Builder
  164. */
  165. public function setVideoCodecs(array $videoCodecs): self {
  166. $this->options['videoCodecs'] = $videoCodecs;
  167. return $this;
  168. }
  169. /**
  170. * The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-address-whitelisting#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.***
  171. *
  172. * @param string $mediaRegion The region for the media server in Group Rooms
  173. * @return $this Fluent Builder
  174. */
  175. public function setMediaRegion(string $mediaRegion): self {
  176. $this->options['mediaRegion'] = $mediaRegion;
  177. return $this;
  178. }
  179. /**
  180. * A collection of Recording Rules that describe how to include or exclude matching tracks for recording
  181. *
  182. * @param array $recordingRules A collection of Recording Rules
  183. * @return $this Fluent Builder
  184. */
  185. public function setRecordingRules(array $recordingRules): self {
  186. $this->options['recordingRules'] = $recordingRules;
  187. return $this;
  188. }
  189. /**
  190. * When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only.
  191. *
  192. * @param bool $audioOnly Indicates whether the room will only contain audio
  193. * track participants for group rooms.
  194. * @return $this Fluent Builder
  195. */
  196. public function setAudioOnly(bool $audioOnly): self {
  197. $this->options['audioOnly'] = $audioOnly;
  198. return $this;
  199. }
  200. /**
  201. * Provide a friendly representation
  202. *
  203. * @return string Machine friendly representation
  204. */
  205. public function __toString(): string {
  206. $options = \http_build_query(Values::of($this->options), '', ' ');
  207. return '[Twilio.Video.V1.CreateRoomOptions ' . $options . ']';
  208. }
  209. }
  210. class ReadRoomOptions extends Options {
  211. /**
  212. * @param string $status Read only the rooms with this status
  213. * @param string $uniqueName Read only rooms with this unique_name
  214. * @param \DateTime $dateCreatedAfter Read only rooms that started on or after
  215. * this date, given as YYYY-MM-DD
  216. * @param \DateTime $dateCreatedBefore Read only rooms that started before this
  217. * date, given as YYYY-MM-DD
  218. */
  219. public function __construct(string $status = Values::NONE, string $uniqueName = Values::NONE, \DateTime $dateCreatedAfter = Values::NONE, \DateTime $dateCreatedBefore = Values::NONE) {
  220. $this->options['status'] = $status;
  221. $this->options['uniqueName'] = $uniqueName;
  222. $this->options['dateCreatedAfter'] = $dateCreatedAfter;
  223. $this->options['dateCreatedBefore'] = $dateCreatedBefore;
  224. }
  225. /**
  226. * Read only the rooms with this status. Can be: `in-progress` (default) or `completed`
  227. *
  228. * @param string $status Read only the rooms with this status
  229. * @return $this Fluent Builder
  230. */
  231. public function setStatus(string $status): self {
  232. $this->options['status'] = $status;
  233. return $this;
  234. }
  235. /**
  236. * Read only rooms with the this `unique_name`.
  237. *
  238. * @param string $uniqueName Read only rooms with this unique_name
  239. * @return $this Fluent Builder
  240. */
  241. public function setUniqueName(string $uniqueName): self {
  242. $this->options['uniqueName'] = $uniqueName;
  243. return $this;
  244. }
  245. /**
  246. * Read only rooms that started on or after this date, given as `YYYY-MM-DD`.
  247. *
  248. * @param \DateTime $dateCreatedAfter Read only rooms that started on or after
  249. * this date, given as YYYY-MM-DD
  250. * @return $this Fluent Builder
  251. */
  252. public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self {
  253. $this->options['dateCreatedAfter'] = $dateCreatedAfter;
  254. return $this;
  255. }
  256. /**
  257. * Read only rooms that started before this date, given as `YYYY-MM-DD`.
  258. *
  259. * @param \DateTime $dateCreatedBefore Read only rooms that started before this
  260. * date, given as YYYY-MM-DD
  261. * @return $this Fluent Builder
  262. */
  263. public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self {
  264. $this->options['dateCreatedBefore'] = $dateCreatedBefore;
  265. return $this;
  266. }
  267. /**
  268. * Provide a friendly representation
  269. *
  270. * @return string Machine friendly representation
  271. */
  272. public function __toString(): string {
  273. $options = \http_build_query(Values::of($this->options), '', ' ');
  274. return '[Twilio.Video.V1.ReadRoomOptions ' . $options . ']';
  275. }
  276. }