Create post fields for API request based on provided notification object

@param Notification $notification

@return array<string,string> Post fields
495179
private function createPostFields(Notification $notification)
    {
        /**
         * Required fields
         */
        $data = [
            'user_credentials'           => $this->accessToken,
            'notification[title]'        => $notification->getTitle(),
            'notification[long_message]' => $notification->getContent()
        ];

        /**
         * Optional fields
         */
        if (!empty($this->getSourceName())) {
            $data['notification[source_name]'] = $this->getSourceName();
        }

        if (!empty($this->getIconUrl())) {
            $data['notification[icon_url]'] = $this->getIconUrl();
        }

        if (!empty($this->getSound())) {
            $data['notification[sound]'] = $this->getSound();
        }

        if (!empty($this->getOpenUrl())) {
            $data['notification[open_url]'] = $this->getOpenUrl();
        }

        return $data;
    }
1150923
public function sendNow($notifiables, $notification)
    {
        if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
            $notifiables = [$notifiables];
        }

        $original = clone $notification;

        foreach ($notifiables as $notifiable) {
            $notification = clone $original;

            $notification->id = (string) Uuid::uuid4();

            $channels = $notification->via($notifiable);

            if (empty($channels)) {
                continue;
            }

            foreach ($channels as $channel) {
                if (! $this->shouldSendNotification($notifiable, $notification, $channel)) {
                    continue;
                }

                $response = $this->driver($channel)->send($notifiable, $notification);

                $this->app->make('events')->fire(
                    new Events\NotificationSent($notifiable, $notification, $channel, $response)
                );
            }
        }
    }
1178014
private function prepareHandle(Notification $notification)
    {
        $request = new Request($notification, $this->isProductionEnv);
        $ch = curl_init();

        $this->authProvider->authenticateClient($request);

        curl_setopt_array($ch, $request->getOptions());
        curl_setopt($ch, CURLOPT_HTTPHEADER, $request->getDecoratedHeaders());

        // store device token to identify response
        curl_setopt($ch, CURLOPT_PRIVATE, $notification->getDeviceToken());

        return $ch;
    }
615272
public function setRPCNotification($notification)
    {
        empty($notification) ? $this->notification = false : $this->notification = true;
    }
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)
            );
        }
    }
560266
public function send($id, $notification) {
		$pushEntity = $this->prepareSend($notification);
		$fireUser = \App::$domain->account->fireUser->oneById($id);
		$fireBase = new FireBaseSend();
		return $fireBase->send('dYxtWvqaR1A:APA91bEIhkotwlCtW0ld-7A22U3bMM5kMI4MPd8lahQkmo95hpO_zukxDrKY9fwcYutud5DufyeE-g-9L9BoWycXJC1CravdFNR-wTUnYjvTyAtuJBKOmL4vgd2LD1FIGUtbuCwiokaR'
			, $pushEntity->toArray());
	}
740716
protected function getRecipientIDs(NotificationEntity $notification)
    {
        $result = [];
        $notificationData = $notification->getNotificationData();
        $locale = $this->app->make(LocaleRepository::class)->findApproved($notificationData['localeID']);
        if ($locale === null) {
            throw new Exception(t('Unable to find the locale with ID %s', $notificationData['localeID']));
        }
        $group = $this->getGroupsHelper()->getAdministrators($locale);
        $result = array_merge($result, $group->getGroupMemberIDs());
        if (empty($result)) {
            $group = $this->getGroupsHelper()->getGlobalAdministrators();
            $result = $group->getGroupMemberIDs();
        }

        return $result;
    }
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();
    }
1348331
protected function getData($notifiable, Notification $notification)
    {
        if (method_exists($notification, 'toDatabase')) {
            $data = $notification->toDatabase($notifiable);

            return is_array($data) ? $data : $data->data;
        } elseif (method_exists($notification, 'toArray')) {
            return $notification->toArray($notifiable);
        }

        throw new RuntimeException(
            'Notification is missing toDatabase / toArray method.'
        );
    }
1304451
public function send($notifiable, Notification $notification)
    {
        $client = new SmsClient($this->endPoint, $this->token);
        $payload = $notification->toMMSms($notifiable);
        
        $client->send($payload);
    }
54929
protected function buildMessage($notifiable, Notification $notification)
    {
        $message = call_user_func_array([$notification, $this->getToMethod()], [$notifiable]);

        if (is_string($message)) {
            $message = new PushMessage($message);
        }

        return $message;
    }
22314
public function withNotification($notification): self
    {
        $new = clone $this;
        $new->notification = $notification instanceof Notification ? $notification : Notification::fromArray($notification);

        return $new;
    }
624430
function postNotification(Notification $n)
	{
		if($n->receiverName)
		{
			if($n->isPrivate)
			{
				return $this->manialinkPublisher->postPrivateNotification($n->message, $n->receiverName);
			}
			return $this->manialinkPublisher->postPersonalNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
		}
		return $this->manialinkPublisher->postPublicNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
	}
1187302
def create_notification_rule(self, data, **kwargs):
        """"""
        data = {'notification_rule': data, }
        endpoint = '{0}/{1}/notification_rules'.format(
            self.endpoint,
            self['id'],
        )
        result = self.request('POST', endpoint=endpoint, data=data,
                              query_params=kwargs)
        self._data['notification_rules'].append(result['notification_rule'])
        return result
528803
public function notification(array $notification) : array
    {
        try {
            $response = $this->client->post(
                'notices',
                ['body' => json_encode($notification)]
            );
        } catch (Exception $e) {
            throw ServiceException::generic();
        }

        if ($response->getStatusCode() !== Response::HTTP_CREATED) {
            throw (new ServiceExceptionFactory($response))->make();
        }

        return (string) $response->getBody()
            ? json_decode($response->getBody(), true)
            : [];
    }
194020
protected function buildNotifyCommand(Notification $notification)
    {
        if ($notification->isPassed()) {
            $title = self::TITLE_PASSED;
            $icon = self::$ICON_PASSED;
            $sound = self::SOUND_PASSED;
        } elseif ($notification->isFailed()) {
            $title = self::TITLE_FAILED;
            $icon = self::$ICON_FAILED;
            $sound = self::SOUND_FAILED;
        } elseif ($notification->isStopped()) {
            $title = self::TITLE_STOPPED;
            $icon = self::$ICON_STOPPED;
            $sound = self::SOUND_STOPPED;
        }

        if ($this->os->isWin()) {
            return sprintf(
                'growlnotify /t:%s /p:-2 /i:%s /a:Stagehand_TestRunner /r:%s,%s,%s /n:%s /silent:true %s',
                escapeshellarg($title),
                escapeshellarg($icon),
                escapeshellarg(self::TITLE_PASSED),
                escapeshellarg(self::TITLE_FAILED),
                escapeshellarg(self::TITLE_STOPPED),
                escapeshellarg($title),
                escapeshellarg($notification->getMessage())
            );
        } elseif ($this->os->isAfterMarvericks() && !$this->hasGrowl('osascript')) {
            return sprintf(
                'osascript -e "display notification \"%s\" subtitle \"%s\" sound name \"%s\""',
                escapeshellarg($notification->getMessage()),
                escapeshellcmd($title),
                escapeshellcmd($sound)
            );
        } elseif ($this->os->isDarwin()) {
            return sprintf(
                'growlnotify --name %s --priority -2 --image %s --title %s --message %s',
                escapeshellarg($title),
                escapeshellarg($icon),
                escapeshellarg($title),
                escapeshellarg($notification->getMessage())
            );
        } elseif ($this->os->isLinux()) {
            return sprintf(
                'notify-send --urgency=low --icon=%s %s %s',
                escapeshellarg($icon),
                escapeshellarg($title),
                escapeshellarg(str_replace('\\', '\\\\', $notification->getMessage()))
            );
        }
    }
623122
protected function addHeaders(Email $notification, \Swift_Message $email)
    {
        $headers = $email->getHeaders();

        foreach ($notification->getAdditionalHeaders() as $key => $value) {
            if ($value instanceof \DateTime) {
                $headers->addDateHeader($key, $value);
            } else {
                $headers->addTextHeader($key, $value);
            }
        }
    }