PageRenderTime 36ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Twilio/Rest/Chat/V2/Service/Channel/WebhookOptions.php

http://github.com/twilio/twilio-php
PHP | 267 lines | 88 code | 21 blank | 158 comment | 0 complexity | 6b43f9d4d2bf02104c4994de42888755 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\Chat\V2\Service\Channel;
  9. use Twilio\Options;
  10. use Twilio\Values;
  11. abstract class WebhookOptions {
  12. /**
  13. * @param string $configurationUrl The URL of the webhook to call
  14. * @param string $configurationMethod The HTTP method used to call
  15. * `configuration.url`
  16. * @param string[] $configurationFilters The events that cause us to call the
  17. * Channel Webhook
  18. * @param string[] $configurationTriggers A string that will cause us to call
  19. * the webhook when it is found in a
  20. * message body
  21. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  22. * an event occurs
  23. * @param int $configurationRetryCount The number of times to retry the webhook
  24. * if the first attempt fails
  25. * @return CreateWebhookOptions Options builder
  26. */
  27. public static function create(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE): CreateWebhookOptions {
  28. return new CreateWebhookOptions($configurationUrl, $configurationMethod, $configurationFilters, $configurationTriggers, $configurationFlowSid, $configurationRetryCount);
  29. }
  30. /**
  31. * @param string $configurationUrl The URL of the webhook to call
  32. * @param string $configurationMethod The HTTP method used to call
  33. * `configuration.url`
  34. * @param string[] $configurationFilters The events that cause us to call the
  35. * Channel Webhook
  36. * @param string[] $configurationTriggers A string that will cause us to call
  37. * the webhook when it is found in a
  38. * message body
  39. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  40. * an event occurs
  41. * @param int $configurationRetryCount The number of times to retry the webhook
  42. * if the first attempt fails
  43. * @return UpdateWebhookOptions Options builder
  44. */
  45. public static function update(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE): UpdateWebhookOptions {
  46. return new UpdateWebhookOptions($configurationUrl, $configurationMethod, $configurationFilters, $configurationTriggers, $configurationFlowSid, $configurationRetryCount);
  47. }
  48. }
  49. class CreateWebhookOptions extends Options {
  50. /**
  51. * @param string $configurationUrl The URL of the webhook to call
  52. * @param string $configurationMethod The HTTP method used to call
  53. * `configuration.url`
  54. * @param string[] $configurationFilters The events that cause us to call the
  55. * Channel Webhook
  56. * @param string[] $configurationTriggers A string that will cause us to call
  57. * the webhook when it is found in a
  58. * message body
  59. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  60. * an event occurs
  61. * @param int $configurationRetryCount The number of times to retry the webhook
  62. * if the first attempt fails
  63. */
  64. public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE) {
  65. $this->options['configurationUrl'] = $configurationUrl;
  66. $this->options['configurationMethod'] = $configurationMethod;
  67. $this->options['configurationFilters'] = $configurationFilters;
  68. $this->options['configurationTriggers'] = $configurationTriggers;
  69. $this->options['configurationFlowSid'] = $configurationFlowSid;
  70. $this->options['configurationRetryCount'] = $configurationRetryCount;
  71. }
  72. /**
  73. * The URL of the webhook to call using the `configuration.method`.
  74. *
  75. * @param string $configurationUrl The URL of the webhook to call
  76. * @return $this Fluent Builder
  77. */
  78. public function setConfigurationUrl(string $configurationUrl): self {
  79. $this->options['configurationUrl'] = $configurationUrl;
  80. return $this;
  81. }
  82. /**
  83. * The HTTP method used to call `configuration.url`. Can be: `GET` or `POST` and the default is `POST`.
  84. *
  85. * @param string $configurationMethod The HTTP method used to call
  86. * `configuration.url`
  87. * @return $this Fluent Builder
  88. */
  89. public function setConfigurationMethod(string $configurationMethod): self {
  90. $this->options['configurationMethod'] = $configurationMethod;
  91. return $this;
  92. }
  93. /**
  94. * The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger).
  95. *
  96. * @param string[] $configurationFilters The events that cause us to call the
  97. * Channel Webhook
  98. * @return $this Fluent Builder
  99. */
  100. public function setConfigurationFilters(array $configurationFilters): self {
  101. $this->options['configurationFilters'] = $configurationFilters;
  102. return $this;
  103. }
  104. /**
  105. * A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`.
  106. *
  107. * @param string[] $configurationTriggers A string that will cause us to call
  108. * the webhook when it is found in a
  109. * message body
  110. * @return $this Fluent Builder
  111. */
  112. public function setConfigurationTriggers(array $configurationTriggers): self {
  113. $this->options['configurationTriggers'] = $configurationTriggers;
  114. return $this;
  115. }
  116. /**
  117. * The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`.
  118. *
  119. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  120. * an event occurs
  121. * @return $this Fluent Builder
  122. */
  123. public function setConfigurationFlowSid(string $configurationFlowSid): self {
  124. $this->options['configurationFlowSid'] = $configurationFlowSid;
  125. return $this;
  126. }
  127. /**
  128. * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.
  129. *
  130. * @param int $configurationRetryCount The number of times to retry the webhook
  131. * if the first attempt fails
  132. * @return $this Fluent Builder
  133. */
  134. public function setConfigurationRetryCount(int $configurationRetryCount): self {
  135. $this->options['configurationRetryCount'] = $configurationRetryCount;
  136. return $this;
  137. }
  138. /**
  139. * Provide a friendly representation
  140. *
  141. * @return string Machine friendly representation
  142. */
  143. public function __toString(): string {
  144. $options = \http_build_query(Values::of($this->options), '', ' ');
  145. return '[Twilio.Chat.V2.CreateWebhookOptions ' . $options . ']';
  146. }
  147. }
  148. class UpdateWebhookOptions extends Options {
  149. /**
  150. * @param string $configurationUrl The URL of the webhook to call
  151. * @param string $configurationMethod The HTTP method used to call
  152. * `configuration.url`
  153. * @param string[] $configurationFilters The events that cause us to call the
  154. * Channel Webhook
  155. * @param string[] $configurationTriggers A string that will cause us to call
  156. * the webhook when it is found in a
  157. * message body
  158. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  159. * an event occurs
  160. * @param int $configurationRetryCount The number of times to retry the webhook
  161. * if the first attempt fails
  162. */
  163. public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE) {
  164. $this->options['configurationUrl'] = $configurationUrl;
  165. $this->options['configurationMethod'] = $configurationMethod;
  166. $this->options['configurationFilters'] = $configurationFilters;
  167. $this->options['configurationTriggers'] = $configurationTriggers;
  168. $this->options['configurationFlowSid'] = $configurationFlowSid;
  169. $this->options['configurationRetryCount'] = $configurationRetryCount;
  170. }
  171. /**
  172. * The URL of the webhook to call using the `configuration.method`.
  173. *
  174. * @param string $configurationUrl The URL of the webhook to call
  175. * @return $this Fluent Builder
  176. */
  177. public function setConfigurationUrl(string $configurationUrl): self {
  178. $this->options['configurationUrl'] = $configurationUrl;
  179. return $this;
  180. }
  181. /**
  182. * The HTTP method used to call `configuration.url`. Can be: `GET` or `POST` and the default is `POST`.
  183. *
  184. * @param string $configurationMethod The HTTP method used to call
  185. * `configuration.url`
  186. * @return $this Fluent Builder
  187. */
  188. public function setConfigurationMethod(string $configurationMethod): self {
  189. $this->options['configurationMethod'] = $configurationMethod;
  190. return $this;
  191. }
  192. /**
  193. * The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger).
  194. *
  195. * @param string[] $configurationFilters The events that cause us to call the
  196. * Channel Webhook
  197. * @return $this Fluent Builder
  198. */
  199. public function setConfigurationFilters(array $configurationFilters): self {
  200. $this->options['configurationFilters'] = $configurationFilters;
  201. return $this;
  202. }
  203. /**
  204. * A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`.
  205. *
  206. * @param string[] $configurationTriggers A string that will cause us to call
  207. * the webhook when it is found in a
  208. * message body
  209. * @return $this Fluent Builder
  210. */
  211. public function setConfigurationTriggers(array $configurationTriggers): self {
  212. $this->options['configurationTriggers'] = $configurationTriggers;
  213. return $this;
  214. }
  215. /**
  216. * The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` = `studio`.
  217. *
  218. * @param string $configurationFlowSid The SID of the Studio Flow to call when
  219. * an event occurs
  220. * @return $this Fluent Builder
  221. */
  222. public function setConfigurationFlowSid(string $configurationFlowSid): self {
  223. $this->options['configurationFlowSid'] = $configurationFlowSid;
  224. return $this;
  225. }
  226. /**
  227. * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.
  228. *
  229. * @param int $configurationRetryCount The number of times to retry the webhook
  230. * if the first attempt fails
  231. * @return $this Fluent Builder
  232. */
  233. public function setConfigurationRetryCount(int $configurationRetryCount): self {
  234. $this->options['configurationRetryCount'] = $configurationRetryCount;
  235. return $this;
  236. }
  237. /**
  238. * Provide a friendly representation
  239. *
  240. * @return string Machine friendly representation
  241. */
  242. public function __toString(): string {
  243. $options = \http_build_query(Values::of($this->options), '', ' ');
  244. return '[Twilio.Chat.V2.UpdateWebhookOptions ' . $options . ']';
  245. }
  246. }