Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:Superbalist/php-appboy
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgoslett committed May 30, 2017
2 parents 3c4d822 + 7e0eaa7 commit 9eb5736
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/SendPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

use GuzzleHttp\Client;
use Superbalist\Appboy\Appboy;
use Superbalist\Appboy\NotificationBuilder;
use Superbalist\Appboy\Messages\AndroidMessageBuilder;
use Superbalist\Appboy\Messages\AppleMessageBuilder;
use Superbalist\Appboy\NotificationBuilder;

$client = new Client();
$appboy = new Appboy($client, getenv('APPBOY_APP_GROUP_ID'));
Expand All @@ -36,4 +36,4 @@
])
->build()
);
var_dump($response);
var_dump($response);
8 changes: 8 additions & 0 deletions src/Appboy.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function getUri()
* The App Group Identifier can be found in the developer console settings.
*
* @param string $appGroupId
*
* @see https://www.appboy.com/documentation/REST_API/#app-group-identifier-explanation
*/
public function setAppGroupId($appGroupId)
Expand Down Expand Up @@ -99,6 +100,7 @@ public function getClient()
* Return the full uri to an API end-point.
*
* @param string $endpoint
*
* @return string
*/
public function makeBaseUri($endpoint)
Expand All @@ -113,6 +115,7 @@ public function makeBaseUri($endpoint)
* @param string $endpoint
* @param mixed $body
* @param array $headers
*
* @return Request
*/
protected function createRequest($method, $endpoint, $body = null, array $headers = [])
Expand All @@ -126,6 +129,7 @@ protected function createRequest($method, $endpoint, $body = null, array $header
*
* @param string $endpoint
* @param array $data
*
* @return array
*/
public function post($endpoint, array $data = [])
Expand All @@ -139,7 +143,9 @@ public function post($endpoint, array $data = [])
* Send an HTTP request.
*
* @param RequestInterface $request
*
* @throws \Exception
*
* @return array
*/
protected function sendRequest(RequestInterface $request)
Expand Down Expand Up @@ -178,6 +184,7 @@ protected function sendRequest(RequestInterface $request)
* ```
*
* @param array $params
*
* @return array
*/
public function sendMessage(array $params)
Expand Down Expand Up @@ -217,6 +224,7 @@ public function sendMessage(array $params)
* ```
*
* @param array $params
*
* @return array
*/
public function scheduleMessage(array $params)
Expand Down
20 changes: 19 additions & 1 deletion src/Messages/AndroidMessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function __construct()
* Set the message content.
*
* @param string $alert
*
* @return AndroidMessageBuilder
*/
public function setAlert($alert)
Expand All @@ -115,6 +116,7 @@ public function setAlert($alert)
* Set the message title.
*
* @param string $title
*
* @return AndroidMessageBuilder
*/
public function setTitle($title)
Expand All @@ -127,6 +129,7 @@ public function setTitle($title)
* Set additional key => value attributes to include with the message.
*
* @param array $attributes
*
* @return AndroidMessageBuilder
*/
public function withExtraAttributes(array $attributes)
Expand All @@ -140,6 +143,7 @@ public function withExtraAttributes(array $attributes)
*
* @param string $key
* @param mixed $value
*
* @return AndroidMessageBuilder
*/
public function addExtraAttribute($key, $value)
Expand All @@ -152,6 +156,7 @@ public function addExtraAttribute($key, $value)
* Add additional attributes to include with the message.
*
* @param array $attributes
*
* @return AndroidMessageBuilder
*/
public function addExtraAttributes(array $attributes)
Expand All @@ -164,6 +169,7 @@ public function addExtraAttributes(array $attributes)
* Set the message variation under which this send will be tracked under.
*
* @param string $messageVariationId
*
* @return AndroidMessageBuilder
*/
public function setMessageVariation($messageVariationId)
Expand All @@ -176,7 +182,9 @@ public function setMessageVariation($messageVariationId)
* Set the message priority.
*
* @param int $priority
*
* @return AndroidMessageBuilder
*
* @see https://www.appboy.com/documentation/Android/#advanced-use-cases
*/
public function setPriority($priority)
Expand All @@ -189,6 +197,7 @@ public function setPriority($priority)
* Set the collapse key.
*
* @param string $collapseKey
*
* @return AndroidMessageBuilder
*/
public function setCollapseKey($collapseKey)
Expand All @@ -203,6 +212,7 @@ public function setCollapseKey($collapseKey)
* The 'default' sound is used as a default.
*
* @param string $sound
*
* @return AndroidMessageBuilder
*/
public function setSound($sound)
Expand All @@ -215,6 +225,7 @@ public function setSound($sound)
* Set a uri / deep-link click through.
*
* @param string $uri
*
* @return AndroidMessageBuilder
*/
public function setUri($uri)
Expand All @@ -223,11 +234,11 @@ public function setUri($uri)
return $this;
}


/**
* Set the summary text.
*
* @param string $summaryText
*
* @return AndroidMessageBuilder
*/
public function setSummaryText($summaryText)
Expand All @@ -242,7 +253,9 @@ public function setSummaryText($summaryText)
* The ttl value is a number in seconds before which the message will expire.
*
* @param int $timeToLive
*
* @return AndroidMessageBuilder
*
* @see https://developers.google.com/cloud-messaging/concept-options
*/
public function setTimeToLive($timeToLive)
Expand All @@ -255,7 +268,9 @@ public function setTimeToLive($timeToLive)
* Set the time to live (TTL) based on a date/time.
*
* @param DateTime $date
*
* @return AndroidMessageBuilder
*
* @see https://developers.google.com/cloud-messaging/concept-options
*/
public function expiresAt(DateTime $date)
Expand All @@ -268,6 +283,7 @@ public function expiresAt(DateTime $date)
* Set the notification id.
*
* @param int $notificationId
*
* @return AndroidMessageBuilder
*/
public function setNotificationId($notificationId)
Expand All @@ -280,6 +296,7 @@ public function setNotificationId($notificationId)
* Set the push icon image url.
*
* @param string $url
*
* @return AndroidMessageBuilder
*/
public function setPushIconImageUrl($url)
Expand All @@ -292,6 +309,7 @@ public function setPushIconImageUrl($url)
* Set the accent colour to display in the push bar.
*
* @param int $colour
*
* @return AndroidMessageBuilder
*/
public function setAccentColour($colour)
Expand Down
11 changes: 11 additions & 0 deletions src/Messages/AppleMessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function __construct()
* Set the badge count to display after the message is received.
*
* @param int $count
*
* @return AppleMessageBuilder
*/
public function setBadgeCount($count)
Expand All @@ -96,6 +97,7 @@ public function setBadgeCount($count)
* Set the message content.
*
* @param string $alert
*
* @return AppleMessageBuilder
*/
public function setAlert($alert)
Expand All @@ -110,6 +112,7 @@ public function setAlert($alert)
* The 'default' sound is used as a default.
*
* @param string $sound
*
* @return AppleMessageBuilder
*/
public function setSound($sound)
Expand All @@ -122,6 +125,7 @@ public function setSound($sound)
* Set additional key => value attributes to include with the message.
*
* @param array $attributes
*
* @return AppleMessageBuilder
*/
public function withExtraAttributes(array $attributes)
Expand All @@ -135,6 +139,7 @@ public function withExtraAttributes(array $attributes)
*
* @param string $key
* @param mixed $value
*
* @return AppleMessageBuilder
*/
public function addExtraAttribute($key, $value)
Expand All @@ -147,6 +152,7 @@ public function addExtraAttribute($key, $value)
* Add additional attributes to include with the message.
*
* @param array $attributes
*
* @return AppleMessageBuilder
*/
public function addExtraAttributes(array $attributes)
Expand All @@ -159,6 +165,7 @@ public function addExtraAttributes(array $attributes)
* Set the category.
*
* @param string $category
*
* @return AppleMessageBuilder
*/
public function setCategory($category)
Expand All @@ -171,6 +178,7 @@ public function setCategory($category)
* Set a date/time at which the message will expire.
*
* @param DateTime $date
*
* @return AppleMessageBuilder
*/
public function expiresAt(DateTime $date)
Expand All @@ -183,6 +191,7 @@ public function expiresAt(DateTime $date)
* Set a uri / deep-link click through.
*
* @param string $uri
*
* @return AppleMessageBuilder
*/
public function setUri($uri)
Expand All @@ -195,6 +204,7 @@ public function setUri($uri)
* Set the message variation under which this send will be tracked under.
*
* @param string $messageVariationId
*
* @return AppleMessageBuilder
*/
public function setMessageVariation($messageVariationId)
Expand All @@ -210,6 +220,7 @@ public function setMessageVariation($messageVariationId)
*
* @param string $url
* @param string $fileType
*
* @return AppleMessageBuilder
*/
public function setAsset($url, $fileType)
Expand Down
12 changes: 12 additions & 0 deletions src/NotificationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public function __construct()
* Set the external user ids to send to.
*
* @param array|mixed $ids
*
* @return NotificationBuilder
*
* @see https://www.appboy.com/documentation/REST_API/#external-user-id
*/
public function toUsers($ids)
Expand All @@ -75,7 +77,9 @@ public function toUsers($ids)
* Set the external user id to send to.
*
* @param mixed $id
*
* @return NotificationBuilder
*
* @see https://www.appboy.com/documentation/REST_API/#external-user-id
*/
public function toUser($id)
Expand All @@ -87,7 +91,9 @@ public function toUser($id)
* Set the segment to send to.
*
* @param string $segmentId
*
* @return NotificationBuilder
*
* @see https://www.appboy.com/documentation/REST_API/#segment-identifier
*/
public function toSegment($segmentId)
Expand All @@ -100,7 +106,9 @@ public function toSegment($segmentId)
* Set the campaign identifier.
*
* @param string $campaignId
*
* @return NotificationBuilder
*
* @see https://www.appboy.com/documentation/REST_API/#campaign-identifier
*/
public function setCampaign($campaignId)
Expand Down Expand Up @@ -146,6 +154,7 @@ public function respectFrequencyCapping()
* The default state is 'subscribed' only.
*
* @param string $state (opted_int|subscribed|all)
*
* @return NotificationBuilder
*/
public function setSubscriptionState($state)
Expand All @@ -158,6 +167,7 @@ public function setSubscriptionState($state)
* Set the message push objects.
*
* @param array $messages
*
* @return NotificationBuilder
*/
public function withMessages(array $messages)
Expand All @@ -171,6 +181,7 @@ public function withMessages(array $messages)
*
* @param string $type (apple_push|android_push|...)
* @param array $message
*
* @return NotificationBuilder
*/
public function withMessage($type, array $message)
Expand All @@ -186,6 +197,7 @@ public function withMessage($type, array $message)
*
* @param string $type (apple_push|android_push|...)
* @param array $message
*
* @return NotificationBuilder
*/
public function addMessage($type, array $message)
Expand Down
1 change: 1 addition & 0 deletions src/ScheduledNotificationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function __construct()
* Set the send date/time.
*
* @param DateTime $date
*
* @return ScheduledNotificationBuilder
*/
public function sendsAt(DateTime $date)
Expand Down
Loading

0 comments on commit 9eb5736

Please sign in to comment.