Push

Update the pusher for this device on the SDN node.

- (MXHTTPOperation*)setPusherWithPushkey:(NSString *)pushkey
                                    kind:(NSObject *)kind
                                   appId:(NSString *)appId
                          appDisplayName:(NSString *)appDisplayName
                       deviceDisplayName:(NSString *)deviceDisplayName
                              profileTag:(NSString *)profileTag
                                    lang:(NSString *)lang
                                    data:(NSDictionary *)data
                                  append:(BOOL)append
                                 success:(void (^)(void))success
                                 failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;

Input Parameters:

Name
Type
Description
Required

pushkey

NSString

The pushkey for this pusher. This should be the APNS token formatted as required for your push gateway (base64 is the recommended formatting).

True

kind

NSString

The kind of pusher your push gateway requires. Generally 'http', or an NSNull to disable the pusher.

false

appId

NSString

The app ID of this application as required by your push gateway.

True

appDisplayName

NSString

A human readable display name for this app.

True

deviceDisplayName

NSString

A human readable display name for this device.

True

profileTag

NSString

The profile tag for this device. Identifies this device in push rules.

True

lang

NSString

The user's preferred language for push, eg. 'en' or 'en-US'

True

data

NSDictionary

Dictionary of data as required by your push gateway (generally the notification URI and aps-environment for APNS).

True

append

BOOL

If true, the node should add another pusher with the given pushkey and App ID in addition to any others with different user IDs.

True

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds. It provides credentials to use to create a MXRestClient.

true

failure

block

A block object called when the operation fails.

true

Update the pusher for this device on the node

- (MXHTTPOperation*)setPusherWithPushkey:(NSString *)pushkey
                                    kind:(NSObject *)kind
                                   appId:(NSString *)appId
                          appDisplayName:(NSString *)appDisplayName
                       deviceDisplayName:(NSString *)deviceDisplayName
                              profileTag:(NSString *)profileTag
                                    lang:(NSString *)lang
                                    data:(NSDictionary *)data
                                  append:(BOOL)append
                                 enabled:(BOOL)enabled
                                 success:(void (^)(void))success
                                 failure:(void (^)(NSError *))failure NS_REFINED_FOR_SWIFT;

Input Parameters

Name
Type
Description
Required

pushkey

NSString

The pushkey for this pusher. This should be the APNS token formatted as required for your push gateway (base64 is the recommended formatting).

True

kind

NSString

The kind of pusher your push gateway requires. Generally 'http', or an NSNull to disable the pusher.

false

appId

NSString

The app ID of this application as required by your push gateway.

True

appDisplayName

NSString

A human readable display name for this app.

True

deviceDisplayName

NSString

A human readable display name for this device.

True

profileTag

NSString

The profile tag for this device. Identifies this device in push rules.

True

lang

NSString

The user's preferred language for push, eg. 'en' or 'en-US'

True

data

NSDictionary

Dictionary of data as required by your push gateway (generally the notification URI and aps-environment for APNS).

True

append

BOOL

If true, the node should add another pusher with the given pushkey and App ID in addition to any others with different user IDs.

True

enabled

BOOL

Whether the pusher should actively create push notifications

True

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds. It provides credentials to use to create a MXRestClient.

true

failure

block

A block object called when the operation fails.

true

Get all currently active pushers for the authenticated user

- (MXHTTPOperation*)pushers:(void (^)(NSArray<MXPusher *> *pushers))success
                    failure:(void (^)(NSError *))failure NS_REFINED_FOR_SWIFT;

Input Parameters:None

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds

true

failure

block

A block object called when the operation fails.

true

Get all push notifications rules

- (MXHTTPOperation*)pushRules:(void (^)(MXPushRulesResponse *pushRules))success
                      failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;

Input Parameters: None

Output Parameters

Name
Type
Description
Required

success

NSString

A block object called when the operation succeeds

true

failure

NSString

A block object called when the operation fails.

true

Enable/Disable a push notification rule

- (MXHTTPOperation *)enablePushRule:(NSString*)ruleId
                              scope:(NSString*)scope
                               kind:(MXPushRuleKind)kind
                             enable:(BOOL)enable
                            success:(void (^)(void))success
                            failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;

Input Parameters

Name
Type
Description
Required

ruleId

NSString

The identifier for the rule.

True

scope

NSString

Either 'global' or 'device/<profile_tag>' to specify global rules or device rules for the given profile_tag.

false

kind

MXPushRuleKind

The kind of rule, ie. 'override', 'underride', 'sender', 'room', 'content' (see MXPushRuleKind).

True

enable

NSString

YES to enable

True

/**
 Push rules kind.
 
 Push rules are separated into different kinds of rules. These categories have a priority order: verride rules
 have the highest priority.
 Some category may define implicit conditions.
 */
typedef enum : NSUInteger
{
    MXPushRuleKindOverride,
    MXPushRuleKindContent,
    MXPushRuleKindRoom,
    MXPushRuleKindSender,
    MXPushRuleKindUnderride
} MXPushRuleKind NS_REFINED_FOR_SWIFT;

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds

true

failure

block

A block object called when the operation fails.

true

Remove a push notification rule

- (MXHTTPOperation *)removePushRule:(NSString*)ruleId
                              scope:(NSString*)scope
                               kind:(MXPushRuleKind)kind
                            success:(void (^)(void))success
                            failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;

Input Parameters

Name
Type
Description
Required

ruleId

NSString

The identifier for the rule.

True

scope

NSString

Either 'global' or 'device/<profile_tag>' to specify global rules or device rules for the given profile_tag.

false

kind

MXPushRuleKind

The kind of rule, ie. 'override', 'underride', 'sender', 'room', 'content' (see MXPushRuleKind).

True

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds

true

failure

block

A block object called when the operation fails.

true

Create a new push rule

- (MXHTTPOperation *)addPushRule:(NSString*)ruleId
                           scope:(NSString*)scope
                            kind:(MXPushRuleKind)kind
                         actions:(NSArray*)actions
                         pattern:(NSString*)pattern
                      conditions:(NSArray<NSDictionary *> *)conditions
                         success:(void (^)(void))success
                         failure:(void (^)(NSError *error))failure NS_REFINED_FOR_SWIFT;

Input Parameters

Name
Type
Description
Required

ruleId

NSString

The identifier for the rule (it depends on rule kind: user id for sender rule, room id for room rule...).

True

scope

NSString

Either 'global' or 'device/<profile_tag>' to specify global rules or device rules for the given profile_tag.

false

kind

MXPushRuleKind

The kind of rule, ie. 'sender', 'room' or 'content' (see MXPushRuleKind).

True

actions

NSArray

The rule actions: notify, don't notify, set tweak...

True

pattern

NSString

The pattern relevant for content rule.

True

conditions

NSArray

The conditions relevant for override and underride rule.

True

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds

true

failure

block

A block object called when the operation fails.

true

Update push rule actions

- (MXHTTPOperation *)updateActionsForPushRule:(NSString*)ruleId
                                        scope:(NSString*)scope
                                         kind:(MXPushRuleKind)kind
                                      actions:(NSArray*)actions
                                      success:(void (^)(void))success
                                      failure:(void (^)(NSError *error))failure;

Input Parameters

Name
Type
Description
Required

ruleId

NSString

The identifier for the rule (it depends on rule kind: user id for sender rule, room id for room rule...).

True

scope

NSString

Either 'global' or 'device/<profile_tag>' to specify global rules or device rules for the given profile_tag.

false

kind

MXPushRuleKind

The kind of rule, ie. 'sender', 'room' or 'content' (see MXPushRuleKind).

True

actions

NSArray

The rule actions: notify, don't notify, set tweak...

True

Output Parameters

Name
Type
Description
Required

success

block

A block object called when the operation succeeds

true

failure

block

A block object called when the operation fails.

true

Last updated