raspisms/models/Webhook.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2019-12-04 03:04:45 +01:00
<?php
/*
* This file is part of RaspiSMS.
*
* (c) Pierre-Lin Bonnemaison <plebwebsas@gmail.com>
*
* This source file is subject to the GPL-3.0 license that is bundled
* with this source code in the file LICENSE.
*/
namespace models;
class Webhook extends StandardModel
{
2021-03-23 04:31:13 +01:00
const TYPE_SEND_SMS = 'send_sms';
const TYPE_SEND_SMS_STATUS_CHANGE = 'send_sms_status_change';
2021-03-23 04:31:13 +01:00
const TYPE_RECEIVE_SMS = 'receive_sms';
const TYPE_INBOUND_CALL = 'inbound_call';
2021-06-08 02:00:48 +02:00
const TYPE_QUOTA_LEVEL_ALERT = 'quota_level';
const TYPE_QUOTA_REACHED = 'quota_reached';
2019-12-04 03:04:45 +01:00
/**
2020-01-17 18:19:25 +01:00
* Find all webhooks for a user and for a type of webhook.
*
* @param int $id_user : User id
* @param string $type : Webhook type
*
* @return array
*/
2020-01-17 18:19:25 +01:00
public function gets_for_type_and_user(int $id_user, string $type)
{
return $this->_select($this->get_table_name(), ['id_user' => $id_user, 'type' => $type]);
}
2020-01-17 18:19:25 +01:00
/**
* Return table name.
*/
protected function get_table_name(): string
{
return 'webhook';
}
2019-12-04 03:04:45 +01:00
}