class FirebaseTopicManagerService in Firebase Push Notification (FCM) 8
Same name and namespace in other branches
- 3.0.x src/Service/FirebaseTopicManagerService.php \Drupal\firebase\Service\FirebaseTopicManagerService
Service for managing topics.
Hierarchy
- class \Drupal\firebase\Service\FirebaseServiceBase implements FirebaseServiceInterface uses DependencySerializationTrait
- class \Drupal\firebase\Service\FirebaseTopicManagerService
Expanded class hierarchy of FirebaseTopicManagerService
1 string reference to 'FirebaseTopicManagerService'
1 service uses FirebaseTopicManagerService
File
- src/
Service/ FirebaseTopicManagerService.php, line 12
Namespace
Drupal\firebase\ServiceView source
class FirebaseTopicManagerService extends FirebaseServiceBase {
/**
* Endpoint for subscribe device on topic.
*/
const SUBSCRIBE_ENDPOINT = 'https://iid.googleapis.com/iid/v1:batchAdd';
/**
* Endpoint for subscribe device on topic.
*/
const UNSUBSCRIBE_ENDPOINT = 'https://iid.googleapis.com/iid/v1:batchRemove';
/**
* {@inheritdoc}
*/
public function __construct(ConfigFactory $configFactory, ClientInterface $client, LoggerChannelInterface $loggerChannel) {
parent::__construct($configFactory, $client, $loggerChannel);
$config = $this->configFactory
->get('firebase.settings');
$this->key = $config
->get('server_key');
}
/**
* Process topic un/subscription.
*
* @param string $topic
* The topic, which will be processed.
* @param string|array $tokens
* Token or tokens this will be subscriber\unsubscribe by topic.
* @param string $endpoint
* The endpoint for processing by topic.
*/
public function processTopicSubscription($topic, $tokens, $endpoint) {
$this->endpoint = $endpoint;
$this->body = [
'to' => '/topics/' . $topic,
'registration_tokens' => is_array($tokens) ? $tokens : [
$tokens,
],
];
$this
->send();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | Aliased as: sleep | 1 |
DependencySerializationTrait:: |
public | function | Aliased as: wakeup | 2 |
FirebaseServiceBase:: |
protected | property | Request body. | |
FirebaseServiceBase:: |
protected | property | HTTP client. | |
FirebaseServiceBase:: |
protected | property | The config factory. | |
FirebaseServiceBase:: |
protected | property | Firebase service endpoint. | |
FirebaseServiceBase:: |
protected | property | Firebase API Key. | |
FirebaseServiceBase:: |
protected | property | The logger channel. | |
FirebaseServiceBase:: |
public | function |
Build the header. Overrides FirebaseServiceInterface:: |
1 |
FirebaseServiceBase:: |
public | function | Reset body of service. | |
FirebaseServiceBase:: |
public | function |
Overrides FirebaseServiceInterface:: |
1 |
FirebaseServiceBase:: |
public | function | ||
FirebaseServiceBase:: |
public | function | ||
FirebaseTopicManagerService:: |
public | function | Process topic un/subscription. | |
FirebaseTopicManagerService:: |
constant | Endpoint for subscribe device on topic. | ||
FirebaseTopicManagerService:: |
constant | Endpoint for subscribe device on topic. | ||
FirebaseTopicManagerService:: |
public | function |
Constructs a FirebaseServiceBase object. Overrides FirebaseServiceBase:: |