@@ -13,7 +13,6 @@ import CoreManager from './CoreManager';
13
13
import ParseQuery from './ParseQuery' ;
14
14
15
15
import type { WhereClause } from './ParseQuery' ;
16
- import type { RequestOptions } from './RESTController' ;
17
16
18
17
export type PushData = {
19
18
where ?: WhereClause | ParseQuery ;
@@ -31,6 +30,10 @@ export type PushData = {
31
30
32
31
/**
33
32
* 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
+ *
34
37
* @method send
35
38
* @name Parse.Push.send
36
39
* @param {Object } data - The data of the push notification. Valid fields
@@ -43,21 +46,12 @@ export type PushData = {
43
46
* <li>expiration_interval - The seconds from now to expire the push.</li>
44
47
* <li>where - A Parse.Query over Parse.Installation that is used to match
45
48
* 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>
47
50
* <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.
52
51
* @return {Promise } A promise that is fulfilled when the push request
53
52
* completes.
54
53
*/
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 {
61
55
if ( data . where && data . where instanceof ParseQuery ) {
62
56
data . where = data . where . toJSON ( ) . where ;
63
57
}
@@ -76,23 +70,17 @@ export function send(
76
70
) ;
77
71
}
78
72
79
- return CoreManager . getPushController ( ) . send ( data , {
80
- useMasterKey : options . useMasterKey
81
- } ) ;
73
+ return CoreManager . getPushController ( ) . send ( data ) ;
82
74
}
83
75
84
76
const 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 (
89
79
'POST' ,
90
80
'push' ,
91
81
data ,
92
- { useMasterKey : ! ! options . useMasterKey }
82
+ { useMasterKey : true }
93
83
) ;
94
-
95
- return request ;
96
84
}
97
85
}
98
86
0 commit comments