File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -1583,6 +1583,21 @@ NS_REFINED_FOR_SWIFT;
1583
1583
success : (void (^)(void ))success
1584
1584
failure : (void (^)(NSError *error))failure ;
1585
1585
1586
+ /* *
1587
+ Report a room.
1588
+
1589
+ @param roomId the id of the room.
1590
+ @param reason the redaction reason (optional).
1591
+
1592
+ @param success A block object called when the operation succeeds.
1593
+ @param failure A block object called when the operation fails.
1594
+
1595
+ @return a MXHTTPOperation instance.
1596
+ */
1597
+ -(MXHTTPOperation *)reportRoom : (NSString *)roomId
1598
+ reason : (NSString *)reason
1599
+ success : (void (^)(void ))success
1600
+ failure : (void (^)(NSError *))failure ;
1586
1601
1587
1602
/* *
1588
1603
Report an event.
Original file line number Diff line number Diff line change @@ -3091,6 +3091,29 @@ - (MXHTTPOperation*)redactEvent:(NSString*)eventId
3091
3091
}
3092
3092
failure:^(NSError *error) {
3093
3093
MXStrongifyAndReturnIfNil(self);
3094
+ [self dispatchFailure:error inBlock:failure];
3095
+ }];
3096
+ }
3097
+
3098
+ -(MXHTTPOperation *)reportRoom:(NSString *)roomId
3099
+ reason:(NSString *)reason
3100
+ success:(void (^)(void))success
3101
+ failure:(void (^)(NSError *))failure
3102
+ {
3103
+ NSString *path = [NSString stringWithFormat:@"%@/org.matrix.msc4151/rooms/%@/report", kMXAPIPrefixPathUnstable, roomId];
3104
+
3105
+ NSDictionary *parameters = @{ @"reason": reason.length > 0 ? reason : @"" };
3106
+
3107
+ MXWeakify(self);
3108
+ return [httpClient requestWithMethod:@"POST"
3109
+ path:path
3110
+ parameters:parameters
3111
+ success:^(NSDictionary *JSONResponse) {
3112
+ MXStrongifyAndReturnIfNil(self);
3113
+ [self dispatchSuccess:success];
3114
+ }
3115
+ failure:^(NSError *error) {
3116
+ MXStrongifyAndReturnIfNil(self);
3094
3117
[self dispatchFailure:error inBlock:failure];
3095
3118
}];
3096
3119
}
You can’t perform that action at this time.
0 commit comments