CafesApi
@interface CafesApi : NodeDependant
Provides access to Textile cafes related APIs
-
Used to register a remote Textile Cafe node with the local Textile node
Declaration
Objective-C
- (void)register:(nonnull NSString *)url token:(nonnull NSString *)token completion:(nonnull void (^)(NSError *_Nonnull))completion;Swift
func register(_ url: String, token: String, completion: @escaping (Error) -> Void)Parameters
urlThe url of the cafe being registered
tokenThe API token for the cafe being registered
completionA block that will get called with an error
-
Used to deregister a previously registered Textile Cafe
Declaration
Objective-C
- (void)deregister:(nonnull NSString *)sessionId completion:(nonnull void (^)(NSError *_Nonnull))completion;Swift
func deregister(_ sessionId: String, completion: @escaping (Error) -> Void)Parameters
sessionIdThe peer id of the cafe you want to deregister
completionA block that will get called with an error
-
Used to refresh an individual Textile Cafe session
Declaration
Objective-C
- (void)refreshSession:(nonnull NSString *)sessionId completion: (nonnull void (^)(int *_Nullable, NSError *_Nonnull))completion;Swift
func refreshSession(_ sessionId: String, completion: @escaping (UnsafeMutablePointer<Int32>?, Error) -> Void)Parameters
sessionIdThe peer id of the cafe who’s session you want to refresh
completionA block that will get called with the results of the refresh operation
-
Check messages from all registered cafes
Declaration
Objective-C
- (void)checkMessages:(nonnull void (^)(NSError *_Nonnull))completion;Swift
func checkMessages(_ completion: @escaping (Error) -> Void)Parameters
completionA block that will get called with an error
-
Fetches the CafeSession object for a previously registered Textile Cafe node
Declaration
Objective-C
- (id)session:(nonnull NSString *)peerId error:(NSError *_Nullable *_Nullable)error;Swift
func session(_ peerId: String) throws -> AnyParameters
peerIdThe peer id of the previously registered cafe node
errorA reference to an error pointer that will be set in the case of an error
Return Value
The CafeSession for the previously registered cafe
-
Used to get sessions for all previously registered Textile Cafes
Declaration
Objective-C
- (id)sessions:(NSError *_Nullable *_Nullable)error;Swift
func sessions() throws -> AnyParameters
errorA reference to an error pointer that will be set in the case of an error
Return Value
An object containing a list of cafe sessions
View on GitHub
CafesApi Class Reference