Send Pushover message.

@link  https://pushover.net/api

@param  array  $params
@return \Psr\Http\Message\ResponseInterface
@throws CouldNotSendNotification
176595
public function send($params)
    {
        try {
            return $this->http->post($this->pushoverApiUrl, [
                'form_params' => $this->paramsWithToken($params),
            ]);
        } catch (RequestException $exception) {
            if ($exception->getResponse()) {
                throw CouldNotSendNotification::serviceRespondedWithAnError($exception->getResponse());
            }
            throw ServiceCommunicationError::communicationFailed($exception);
        } catch (Exception $exception) {
            throw ServiceCommunicationError::communicationFailed($exception);
        }
    }
882120
public function getOutletsResponse($params = [])
    {
        $resource = 'campaigns/' . $this->campaignId . '/outlets.json';
        $resource .= '?' . http_build_query($params);

        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));

        $decodedResponseBody = $this->getDecodedBody($response->getBody());

        return new Models\GetOutletsResponse($decodedResponseBody);
    }
569880
public function write($message, $params = [])
    {
        $options = $this->getMergedWriteParams($params);

        echo $this->getMessagePrefix($options)
            , $this->getDecoratedMessage($message, $options)
            , $this->getReset();

        return $this;
    }
987006
public function PostSmsMessagesSendTo(XsString $telephoneNumber, ApiSms $apiSms)
    {
        $this->execute(sprintf("/sms-messages/send-to/%s", $telephoneNumber), 'POST', $apiSms->toJson());
    }
964556
protected function performRequest(array $params)
    {
        $this->setRawResponse($this->rawResponse);
        $response = explode("\n", $this->rawResponse);

        return $response;
    }
1280348
public function call(array $params)
    {
        $this->initResolver();

        /**
         * makes sure that 'format' is passed and that 'API' and 'method'
         * parameters are not overwritten by defaults nor by call parameters
         */
        $defaults = array_merge(array('format' => $this->format), $this->defaultParams);
        $this->resolver->setDefaults($defaults);
        $this->resolver->setMandatory(array(
            'module' => 'API',
            'method' => $this->name()
        ));

        return $this->piwikClient->call($this->url(), $this->resolver->resolve($params));
    }
1010794
public function sendDeployNotification(array $args = array()) {
        $branch = array_get($args, 'branch', 'unknown');
        $user = ucfirst(array_get($args, 'user', 'unknown'));
        $gitVersion = array_get($args, 'git-version', 'unknown');

        $config = Zend_Registry::get('config');
        $appName = $config->app->name;
        $version = new Garp_Version();

        $env = APPLICATION_ENV;

        $slackParams = $config->slack->toArray();
        $slackParams['icon_emoji'] = ':rocket:';

        $slackConfig = new Garp_Service_Slack_Config($slackParams);
        $slack = new Garp_Service_Slack($slackConfig);

        if ($gitVersion && strpos($gitVersion, 'fatal') === false) {
            $version = $gitVersion;
        }

        return $slack->postMessage(
            "*{$appName}* *{$version}* (*{$branch}*) was deployed to *{$env}* by *{$user}*"
        );
    }
1080603
public function addSuccessMessage($message, $params = array())
    {
        $message = $this->trans($message, $params);
        static::$messages[$message] = array(
            'type' => 'success',
            'bootstrapType' => 'success',
            'message' => $message
        );
    }
429892
public function publish($params)
    {
        $payload = null;

        if (is_string($params)) {
            $payload = ["campaign" => $params];
        }
        elseif (is_object($params) || is_array($params)) {
            $payload = $params;
        }

        return $this->client->post("/vouchers/publish", $payload, null);
    }
236079
public function push(Message $message)
    {
        if (empty($this->params)) {
            throw new \RuntimeException('Please set up this client using setUp() method before pushing messages.');
        }

        $tokens = $message->getTokens();
        if (empty($tokens)) {
            throw new \RuntimeException('No device token set. Please add at least 1 token using Message::addToken() before trying to push the message.');
        }

        $this->logger->info('Connecting to APNS server');
        $stream = $this->getStreamSocketClient();

        $payload = $message->getPayloadAsJson();

        foreach ($tokens as $token) {
            $this->logger->info('Sending message to APNS server.', array(
                'deviceToken' => $token,
                'payload' => $payload,
            ));
            $this->writePayloadOnStreamForGivenToken($payload, $stream, $token);
        }

        fclose($stream);
    }
1007470
public function handle(...$params): void
    {
        /* @var Server $server */
        $server = array_shift($params);
        /* @var int $fd */
        $fd = array_shift($params);
        /* @var Container $app */
        $app = $server->getApplication();

        $packData = $app->make('websocket.parser')->pack(
            $app->make('websocket.data_converter')->conversion($params)
        );

        if ($server->getServer()->isEstablished($fd)) {
            $server->getServer()->push($fd, $packData);

            return;
        }

        throw new OutOfBoundsException("The fd:[{$fd}] not websocket or websocket close");
    }
1307412
public function notify(Message $message, $options=array())
    {
        $logger = $GLOBALS['logger'];
        $logger->debug(
            'Sending Voice Message ',
            array(
             $message->getFrom(),
             $message->getBody(),
            )
        );
        $path    = 'notifications/voice/send';
        $request = $this->_remoteServer->post($path);
        $request->setPostField('type', 'sms');
        $request->setPostField('from', $message->getFrom());
        $request->setPostField('to', implode(';', $message->getRecipients()));
        $request->setPostField('content', $message->getBody());

        try {
            $response = $request->send();
            if ($response->getStatusCode() !== 200) {
                throw new MessagingException();
            }

            $rawResponse = $response->getBody('true');

            return $rawResponse;
        } catch (\Exception $e) {
            throw new MessagingException();
        }

    }
1254797
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toTelegram($notifiable);

        if (is_string($message)) {
            $message = TelegramMessage::create($message);
        }

        if ($message->toNotGiven()) {
            if (!$to = $notifiable->routeNotificationFor('telegram')) {
                throw CouldNotSendNotification::chatIdNotProvided();
            }

            $message->to($to);
        }

        if(isset($message->payload['text']) && $message->payload['text'])
        {
            $params = $message->toArray();
            $this->telegram->sendMessage($params);
        }
        elseif (isset($message->payload['latitude']) && isset($message->payload['longitude'])) {
            $params = $message->toArray();
            $this->telegram->sendLocation($params);
        }
        else
        {
            if(isset($message->payload['file']))
            {
                $params = $message->toMultipart();
                $this->telegram->sendFile($params, $message->type, true);
            }
            else
            {
                $params = $message->toArray();
                $this->telegram->sendFile($params, $message->type);
            }
        }
    }
204629
public function send($notifiable, Notification $notification)
    {
        $message = $notification->toBearyChat($notifiable);

        if (! $message instanceof Message) {
            throw CouldNotSendNotification::invalidMessage($message);
        }

        if ($route = $notifiable->routeNotificationFor('BearyChat')) {
            if (Str::startsWith($route, ['@', '#'])) {
                $message->to($route);
            } elseif (Str::startsWith($route, ['http://', 'https://'])) {
                if ($client = $message->getClient()) {
                    $client->webhook($route);
                } else {
                    $message->setClient(new Client($route));
                }
            } else {
                $message->setClient($this->clientManager->client($route));
            }
        }

        if (is_null($message->getClient())) {
            $message->setClient($this->clientManager->client());
        }

        if (! $message->send()) {
            throw CouldNotSendNotification::sendingFailed($message->getClient()->getWebhook(), $message);
        }
    }
742896
protected function makeCall(TwilioCallMessage $message, $to)
    {
        $params = [
            'url' => trim($message->content),
        ];

        $this->fillOptionalParams($params, $message, [
            'statusCallback',
            'statusCallbackMethod',
            'method',
            'status',
            'fallbackUrl',
            'fallbackMethod',
        ]);

        if (! $from = $this->getFrom($message)) {
            throw CouldNotSendNotification::missingFrom();
        }

        return $this->twilioService->calls->create(
            $to,
            $from,
            $params
        );
    }
1113692
public function sendMessage(Announcement $announcement, array $users = [])
    {
        $message = $this->getMessage($announcement, $users);

        $announcementSend = new AnnouncementSend();
        $data = $message;
        $data['receivers'] = array_map(function (User $receiver) {
            return $receiver->getUsername();
        }, $message['receivers']);
        $data['sender'] = $message['sender']->getUsername();
        $announcementSend->setAnnouncement($announcement);
        $announcementSend->setData($data);
        $this->om->persist($announcementSend);
        $this->om->flush();

        $this->eventDispatcher->dispatch(
            'claroline_message_sending_to_users',
            'SendMessage',
            [
                $message['sender'],
                $message['content'],
                $message['object'],
                null,
                $message['receivers'],
            ]
        );
    }
791077
public function add($params) 
    {
        $response = $this->client->update(
            $this->uri,
            $params
        );

        return json_encode($response->getContent(), JSON_FORCE_OBJECT);
    }