putNotificationRequest: Build PutNotification's request
@link https://docs.qingcloud.com/qingstor/api/bucket/notification/put_notification.html Documentation URL
@param array 'notifications' Bucket Notification

@return Request
426623
public function putNotificationRequest($options=array())
    {
        $operation = array(
            'API' => 'PutBucketNotification',
            'Method' => 'PUT',
            'Uri' => '/<bucket-name>?notification',
            'Headers' => array(
                'Host' => $this->properties['zone'] . '.' . $this->config->host,
            ),
            'Params' => array(
            ),
            'Elements' => array(
                'notifications' => isset($options['notifications'])?$options['notifications']:null,
            ),
            'Properties' => $this->properties,
            'Body' => null
        );
        $this->putNotificationValidate($operation);
        $req = new Request($this->config, $operation);
        return $req;
    }
351141
protected function queueNotification($notifiables, $notification)
    {
        if (version_compare($this->app->version(), '5.2', '<')) {
            $this->app->make(Bus::class)->dispatch(
                (new SendQueuedNotifications($notifiables, $notification))
                    ->onQueue($notification->queue)
                    ->delay($notification->delay)
            );
        } else {
            $this->app->make(Bus::class)->dispatch(
                (new SendQueuedNotifications($notifiables, $notification))
                    ->onConnection($notification->connection)
                    ->onQueue($notification->queue)
                    ->delay($notification->delay)
            );
        }
    }
1155530
public function sendNow($notifiables, $notification, array $channels = null)
    {
        return (new NotificationSender(
            $this, $this->app->make(Bus::class), $this->app->make(Dispatcher::class), $this->locale)
        )->sendNow($notifiables, $notification, $channels);
    }
1161450
protected function formatNotificationData($notifications)
    {
        return collect($notifications)->map(function ($notification) {
            $notification->data = json_decode($notification->data);
            return $notification;
        });
    }
1065885
public function putNotificationQuery($expires, $options=array())
    {
        $req = $this->putNotificationRequest($options);
        return $req->query_sign($expires);
    }
671371
public function sendNow($notifiables, $notification, array $channels = null)
    {
        $notifiables = $this->formatNotifiables($notifiables);

        $original = clone $notification;

        foreach ($notifiables as $notifiable) {
            if (empty($viaChannels = $channels ?: $notification->via($notifiable))) {
                continue;
            }

            $notificationId = Uuid::uuid4()->toString();

            foreach ((array) $viaChannels as $channel) {
                $this->sendToNotifiable($notifiable, $notificationId, clone $original, $channel);
            }
        }
    }
489364
public function SendNotificationQueue() {
      foreach ($this->_NotificationQueue as $UserID => $Notifications) {
         if (is_array($Notifications)) {
            // Only send out one notification per user.
            $Notification = $Notifications[0];
            
            $Email = $Notification['Email'];
            
            if (is_object($Email)) {
               $this->EventArguments = $Notification;
               $this->FireEvent('BeforeSendNotification');

               try {
                  // Only send if the user is not banned
                  $User = Gdn::UserModel()->GetID($UserID);
                  if (!GetValue('Banned', $User))
                     $Email->Send();
                  
                  $Emailed = self::SENT_OK;
               } catch (phpmailerException $pex) {
                  if ($pex->getCode() == PHPMailer::STOP_CRITICAL)
                     $Emailed = self::SENT_FAIL;
                  else
                     $Emailed = self::SENT_ERROR;
               } catch(Exception $Ex) {
                  $Emailed = self::SENT_FAIL;
               }
               
               try {
                  $this->SQL->Put('Activity', array('Emailed' => $Emailed), array('ActivityID' => $Notification['ActivityID']));
               } catch (Exception $Ex) {
               }
            }
         }
      }

      // Clear out the queue
      unset($this->_NotificationQueue);
      $this->_NotificationQueue = array();
   }
1041084
public function send($notifiables, $notification)
    {
        $notifiables = $this->formatNotifiables($notifiables);

        if (! $notification instanceof ShouldQueueInterface) {
            return $this->sendNow($notifiables, $notification);
        }

        foreach ($notifiables as $notifiable) {
            $notificationId = Uuid::uuid4()->toString();

            foreach ($notification->via($notifiable) as $channel) {
                $this->queueToNotifiable($notifiable, $notificationId, clone $notification, $channel);
            }
        }
    }
1360456
function listNotifications(req, res, next){
  var logger = log.defaultLogger();
  var listReq = RequestTranslator.parseListNotificationsRequest(req);
  var NotificationsModel = models.getModels().Notification;
  NotificationsModel.queryNotifications(listReq.uid, listReq.env, listReq.domain, function(err, notifications){
    if(err) {
      logger.error(loggerPrefix + 'Notifications Query Error: ', err);
      next(err);
    } else {
      var notificationsRes = ResponseTranslator.mapNotificationsToResponse(notifications);
      req.resultData = notificationsRes;
      next();
    }
  });
}
144725
public function sendNotify($applicationName, $notificationName, $notificationTitle, $notificationText, $options = array())
    {
        $notification_options = $options;
        $notification_options['text'] = $notificationText;
        $register = new RegisterRequest($applicationName);
        $register->addNotification($notificationName);
        $notify = new NotificationRequest($applicationName, $notificationName, $notificationTitle, $notification_options);
        return $this->notifyOrRegister($notify, $register)->getStatus();
    }
102973
public void add(T notification) {
        notificationArray.remove(notification.getId());
        notificationArray.put(notification.getId(), notification);
    }
99759
public function send($notifiables, $notifications)
    {
        if (!is_array($notifiables)) {
            $notifiables = [$notifiables];
        }
        if (!is_array($notifications)) {
            $notifications = [$notifications];
        }
        foreach ($notifiables as $notifiable) {
            $channels = array_intersect($notifiable->viaChannels(), array_keys($this->getChannels(true)));
            foreach ($notifications as $notification) {
                if (!$notifiable->shouldReceiveNotification($notification)) {
                    continue;
                }
                $notification->id = StringHelper::ObjectId();
                $channels = array_intersect($channels, $notification->broadcastOn());
                foreach ($channels as $channel) {
                    $this->get($channel)->send($notifiable, $notification);
                }
            }
        }
    }
135155
def set_bucket_notification(self, bucket_name, notifications):
        
        is_valid_bucket_name(bucket_name)
        is_valid_bucket_notification_config(notifications)

        content = xml_marshal_bucket_notifications(notifications)
        headers = {
            'Content-Length': str(len(content)),
            'Content-Md5': get_md5_base64digest(content)
        }
        content_sha256_hex = get_sha256_hexdigest(content)
        self._url_open(
            'PUT',
            bucket_name=bucket_name,
            query={"notification": ""},
            headers=headers,
            body=content,
            content_sha256=content_sha256_hex
        )
1153704
public MaterialSection setNotifications(int notifications) {
        String textNotification;

        textNotification = String.valueOf(notifications);

        if(notifications < 1) {
            textNotification = "";
        }
        if(notifications > 99) {
            textNotification = "99+";
        }

        this.notifications.setText(textNotification);
        numberNotifications = notifications;

        return this;
    }
524619
public function viewedNotifications($notifications)
    {
        $notifications = (array) $notifications;

        $ids = clone $this->newNotificationIds;

        foreach ($notifications as $notification) {
            $ids->offsetUnset($notification->id);
        }

        $this->set('newNotificationIds', $ids);

        $this->save();
    }
415507
public function push(Notification $notification)
    {
        /**
         * Init curl, execute and close
         */
        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL, self::ENDPOINT);
        curl_setopt($curl, CURLOPT_USERAGENT, self::USER_AGENT);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $this->createPostFields($notification));
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        curl_exec($curl);
        $info = curl_getinfo($curl);
        curl_close($curl);

        /**
         * Handle result
         */
        switch ($info['http_code']) {
            case 201:
                return true;

            case 401:
                throw new InvalidAccessTokenException('Not Authorized: Access token not recognized');

            case 404:
                throw new NoDeviceAssociatedException('Not Found: No device associated with provided access token');
        }

        return false;
    }
365477
public function listNotifications(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $page = (int) $request->query->get('page', 0);

        return $this->app->json($this->getEventsManager()->get_notifications_as_array(($page < 0 ? 0 : $page)));
    }