@@ -1312,6 +1312,120 @@ public function listPushProviders(): StreamResponse
13121312 return $ this ->get ("push_providers " );
13131313 }
13141314
1315+ /** Creates a campaign
1316+ * @throws StreamException
1317+ */
1318+ public function createCampaign (array $ campaign ): StreamResponse
1319+ {
1320+ return $ this ->post ("campaigns " , ["campaign " => $ campaign ]);
1321+ }
1322+
1323+ /** Returns a campaign
1324+ * @throws StreamException
1325+ */
1326+ public function getCampaign (string $ campaign_id ): StreamResponse
1327+ {
1328+ return $ this ->get ("campaigns/ $ {campaign_id}" );
1329+ }
1330+
1331+ /** List all campaigns.
1332+ * Options array can contain `limit` and `offset` for pagination.
1333+ * @throws StreamException
1334+ */
1335+ public function listCampaigns (array $ options = []): StreamResponse
1336+ {
1337+ return $ this ->get ("campaigns " , $ options );
1338+ }
1339+
1340+ /** Update a campaign
1341+ * @throws StreamException
1342+ */
1343+ public function updateCampaign (string $ campaign_id , array $ campaign ): StreamResponse
1344+ {
1345+ return $ this ->put ("campaigns/ $ {campaign_id}" , ["campaign " => $ campaign ]);
1346+ }
1347+
1348+ /** Delete a campaign
1349+ * @throws StreamException
1350+ */
1351+ public function deleteCampaign (string $ campaign_id ): StreamResponse
1352+ {
1353+ return $ this ->delete ("campaigns/ $ {campaign_id}" );
1354+ }
1355+
1356+ /** Schedule a campaign
1357+ * @throws StreamException
1358+ */
1359+ public function scheduleCampaign (string $ campaign_id , int $ sendAt ): StreamResponse
1360+ {
1361+ return $ this ->patch ("campaigns/ $ {campaign_id}/schedule " , ["send_at " => $ sendAt ]);
1362+ }
1363+
1364+ /** Stop a campaign
1365+ * @throws StreamException
1366+ */
1367+ public function stopCampaign (string $ campaign_id ): StreamResponse
1368+ {
1369+ return $ this ->patch ("campaigns/ $ {campaign_id}/stop " , []);
1370+ }
1371+
1372+ /** Resume a campaign
1373+ * @throws StreamException
1374+ */
1375+ public function resumeCampaign (string $ campaign_id ): StreamResponse
1376+ {
1377+ return $ this ->patch ("campaigns/ $ {campaign_id}/resume " , []);
1378+ }
1379+
1380+ /** Test a campaign
1381+ * @throws StreamException
1382+ */
1383+ public function testCampaign (string $ campaign_id , array $ users ): StreamResponse
1384+ {
1385+ return $ this ->post ("campaigns/ $ {campaign_id}/test " , ["users " => $ users ]);
1386+ }
1387+
1388+ /** Create a campaign segment
1389+ * @throws StreamException
1390+ */
1391+ public function createSegment (array $ segment ): StreamResponse
1392+ {
1393+ return $ this ->post ("segments " , ["segment " => $ segment ]);
1394+ }
1395+
1396+ /** Get a campaign segment
1397+ * @throws StreamException
1398+ */
1399+ public function getSegment (string $ segment_id ): StreamResponse
1400+ {
1401+ return $ this ->get ("segments/ $ {segment_id}" );
1402+ }
1403+
1404+ /** List all campaign segments.
1405+ * Options array can contain `limit` and `offset` for pagination.
1406+ * @throws StreamException
1407+ */
1408+ public function listSegments (array $ options = []): StreamResponse
1409+ {
1410+ return $ this ->get ("segments " , $ options );
1411+ }
1412+
1413+ /** Update a campaign segment
1414+ * @throws StreamException
1415+ */
1416+ public function updateSegment (string $ segment_id , array $ segment ): StreamResponse
1417+ {
1418+ return $ this ->put ("segments/ $ {segment_id}" , ["segment " => $ segment ]);
1419+ }
1420+
1421+ /** Delete a campaign segment
1422+ * @throws StreamException
1423+ */
1424+ public function deleteSegment (string $ segment_id ): StreamResponse
1425+ {
1426+ return $ this ->delete ("segments/ $ {segment_id}" );
1427+ }
1428+
13151429 /** Create import url
13161430 *
13171431 * A full flow looks like this:
0 commit comments