@@ -13,7 +13,6 @@ import CoreManager from './CoreManager';
1313import ParseQuery from './ParseQuery' ;
1414
1515import type { WhereClause } from './ParseQuery' ;
16- import type { RequestOptions } from './RESTController' ;
1716
1817export type PushData = {
1918 where ?: WhereClause | ParseQuery ;
@@ -31,6 +30,10 @@ export type PushData = {
3130
3231/**
3332 * Sends a push notification.
33+ * **Available in Cloud Code only.**
34+ *
35+ * See {@link https://docs.parseplatform.org/js/guide/#push-notifications Push Notification Guide}
36+ *
3437 * @method send
3538 * @name Parse.Push.send
3639 * @param {Object } data - The data of the push notification. Valid fields
@@ -43,21 +46,12 @@ export type PushData = {
4346 * <li>expiration_interval - The seconds from now to expire the push.</li>
4447 * <li>where - A Parse.Query over Parse.Installation that is used to match
4548 * a set of installations to push to.</li>
46- * <li>data - The data to send as part of the push</li>
49+ * <li>data - The data to send as part of the push. </li>
4750 * <ol>
48- * @param {Object } options An object that has an optional success function,
49- * that takes no arguments and will be called on a successful push, and
50- * an error function that takes a Parse.Error and will be called if the push
51- * failed.
5251 * @return {Promise } A promise that is fulfilled when the push request
5352 * completes.
5453 */
55- export function send (
56- data : PushData ,
57- options ?: { useMasterKey ?: boolean , success ?: any , error ?: any }
58- ) : Promise {
59- options = options || { } ;
60-
54+ export function send ( data : PushData ) : Promise {
6155 if ( data . where && data . where instanceof ParseQuery ) {
6256 data . where = data . where . toJSON ( ) . where ;
6357 }
@@ -76,23 +70,17 @@ export function send(
7670 ) ;
7771 }
7872
79- return CoreManager . getPushController ( ) . send ( data , {
80- useMasterKey : options . useMasterKey
81- } ) ;
73+ return CoreManager . getPushController ( ) . send ( data ) ;
8274}
8375
8476const DefaultController = {
85- send ( data : PushData , options : RequestOptions ) {
86- const RESTController = CoreManager . getRESTController ( ) ;
87-
88- const request = RESTController . request (
77+ send ( data : PushData ) {
78+ return CoreManager . getRESTController ( ) . request (
8979 'POST' ,
9080 'push' ,
9181 data ,
92- { useMasterKey : ! ! options . useMasterKey }
82+ { useMasterKey : true }
9383 ) ;
94-
95- return request ;
9684 }
9785}
9886
0 commit comments