Skip to content

Commit

Permalink
MXRestClient: Update CS API call to support event ids hashes in room …
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Feb 12, 2019
1 parent 05a4376 commit 62baa74
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Changes in Matrix iOS SDK in 0.12.2 (2019-xx-)
===============================================

Improvements:
* MXRestClient: Update CS API call to support event ids hashes in room version 3 (vector-im/riot-ios#2194).
* MXRoom: Add a sendAudioFile API to send file using msgType "m.audio", thanks to N-Pex (PR #616).
* MXCrypto: Add key backup passphrase support (vector-im/riot-ios#2127).
* MXCrypto: Key backup: Ignore all whitespaces in recovery key (vector-im/riot-ios#2194).
Expand Down
31 changes: 25 additions & 6 deletions MatrixSDK/MXRestClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,10 @@ - (MXHTTPOperation*)redactEvent:(NSString*)eventId
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/redact/%@", apiPathPrefix, roomId, eventId];
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/redact/%@",
apiPathPrefix,
roomId,
[eventId mx_escapedStringForPathComponent]];

// All query parameters are optional. Fill the request parameters on demand
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
Expand Down Expand Up @@ -2292,7 +2295,10 @@ -(MXHTTPOperation *)reportEvent:(NSString *)eventId
success:(void (^)(void))success
failure:(void (^)(NSError *))failure
{
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/report/%@", apiPathPrefix, roomId, eventId];
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/report/%@",
apiPathPrefix,
roomId,
[eventId mx_escapedStringForPathComponent]];

NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithDictionary:@{
@"score": @(score)
Expand Down Expand Up @@ -2353,7 +2359,9 @@ - (MXHTTPOperation*)eventWithEventId:(NSString*)eventId
success:(void (^)(MXEvent *event))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"%@/events/%@", apiPathPrefix, eventId];
NSString *path = [NSString stringWithFormat:@"%@/events/%@",
apiPathPrefix,
[eventId mx_escapedStringForPathComponent]];

MXHTTPOperation *operation;
MXWeakify(self);
Expand Down Expand Up @@ -2385,7 +2393,10 @@ - (MXHTTPOperation*)eventWithEventId:(NSString*)eventId
success:(void (^)(MXEvent *event))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/event/%@", apiPathPrefix, roomId, eventId];
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/event/%@",
apiPathPrefix,
roomId,
[eventId mx_escapedStringForPathComponent]];

MXHTTPOperation *operation;
MXWeakify(self);
Expand Down Expand Up @@ -2440,7 +2451,10 @@ - (MXHTTPOperation*)contextOfEvent:(NSString*)eventId
success:(void (^)(MXEventContext *eventContext))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/context/%@", apiPathPrefix, roomId, eventId];
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/context/%@",
apiPathPrefix,
roomId,
[eventId mx_escapedStringForPathComponent]];

NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
parameters[@"limit"] = @(limit);
Expand Down Expand Up @@ -3015,9 +3029,14 @@ - (MXHTTPOperation*)sendReadReceipt:(NSString*)roomId
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/receipt/m.read/%@",
apiPathPrefix,
roomId,
[eventId mx_escapedStringForPathComponent]];

MXWeakify(self);
return [httpClient requestWithMethod:@"POST"
path: [NSString stringWithFormat:@"%@/rooms/%@/receipt/m.read/%@", apiPathPrefix, roomId, eventId]
path:path
parameters:[[NSDictionary alloc] init]
success:^(NSDictionary *JSONResponse) {
MXStrongifyAndReturnIfNil(self);
Expand Down

0 comments on commit 62baa74

Please sign in to comment.