Skip to content

Commit

Permalink
Added a wrapper ARTRealtime.request... method for making rest reque…
Browse files Browse the repository at this point in the history
…sts via internal `ARTRest` instance.
  • Loading branch information
maratal committed Aug 24, 2024
1 parent 55ad795 commit d75d7a4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Source/ARTRealtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ - (void)time:(ARTDateTimeCallback)cb {
[_internal time:cb];
}

- (BOOL)request:(NSString *)method
path:(NSString *)path
params:(nullable NSStringDictionary *)params
body:(nullable id)body
headers:(nullable NSStringDictionary *)headers
callback:(ARTHTTPPaginatedCallback)callback
error:(NSError *_Nullable *_Nullable)errorPtr {
return [_internal request:method path:path params:params body:body headers:headers callback:callback error:errorPtr];
}

- (void)ping:(ARTCallback)cb {
[_internal ping:cb];
}
Expand Down Expand Up @@ -482,6 +492,16 @@ - (void)time:(ARTDateTimeCallback)cb {
[self.rest time:cb];
}

- (BOOL)request:(NSString *)method
path:(NSString *)path
params:(nullable NSStringDictionary *)params
body:(nullable id)body
headers:(nullable NSStringDictionary *)headers
callback:(ARTHTTPPaginatedCallback)callback
error:(NSError *_Nullable *_Nullable)errorPtr {
return [self.rest request:method path:path params:params body:body headers:headers callback:callback error:errorPtr];
}

- (void)ping:(ARTCallback) cb {
if (cb) {
ARTCallback userCallback = cb;
Expand Down
11 changes: 11 additions & 0 deletions Source/include/Ably/ARTRealtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)time:(ARTDateTimeCallback)callback;

/**
* A wrapper around `-[ARTRestProtocol request:path:params:body:headers:callback:error:]` (See [RTC9](https://sdk.ably.com/builds/ably/specification/main/features/#RTC9)).
*/
- (BOOL)request:(NSString *)method
path:(NSString *)path
params:(nullable NSStringDictionary *)params
body:(nullable id)body
headers:(nullable NSStringDictionary *)headers
callback:(ARTHTTPPaginatedCallback)callback
error:(NSError *_Nullable *_Nullable)errorPtr;

/// :nodoc: TODO: docstring
- (void)ping:(ARTCallback)cb;

Expand Down

0 comments on commit d75d7a4

Please sign in to comment.