IpfsApi
@interface IpfsApi : NodeDependant
Provides access to Textile IPFS related APIs
-
Fetch the IPFS peer id
Declaration
Objective-C
- (nonnull NSString *)peerId:(NSError *_Nullable *_Nullable)error;Swift
func peerId(_ error: NSErrorPointer) -> StringParameters
errorA reference to an error pointer that will be set in the case of an error
Return Value
The IPFS peer id of the local Textile node
-
Open a new direct connection to a peer using an IPFS multiaddr
Declaration
Objective-C
- (BOOL)swarmConnect:(nonnull NSString *)multiaddr error:(NSError *_Nullable *_Nullable)error;Swift
func swarmConnect(_ multiaddr: String) throwsParameters
multiaddrPeer IPFS multiaddr
errorA reference to an error pointer that will be set in the case of an error
Return Value
Whether the peer swarm connect was successfull
-
Get raw data stored at an IPFS path
Declaration
Objective-C
- (void)dataAtPath:(nonnull NSString *)path completion:(nonnull void (^)(NSData *_Nullable, NSString *_Nullable, NSError *_Nonnull))completion;Swift
func data(atPath path: String, completion: @escaping (Data?, String?, Error) -> Void)Parameters
pathThe IPFS path for the data you want to retrieve
completionA block that will get called with the results of the query
-
Publishes a message to a given pubsub topic
Declaration
Objective-C
- (void)pubsubPub:(nonnull NSString *)topic data:(nonnull NSString *)data error:(NSError *_Nullable *_Nullable)error;Swift
func pubsubPub(_ topic: String, data: String, error: NSErrorPointer)Parameters
topicThe topic to publish to
dataThe payload of message to publish
errorA reference to an error pointer that will be set in the case of an error
-
Subscribes to messages on a given topic
Declaration
Objective-C
- (nonnull NSString *)pubsubSub:(nonnull NSString *)topic error:(NSError *_Nullable *_Nullable)error;Swift
func pubsubSub(_ topic: String, error: NSErrorPointer) -> StringParameters
topicThe ipfs pubsub sub topic
errorA reference to an error pointer that will be set in the case of an error
Return Value
A query ID that can be used to cancel the sub
-
Cancel subscribe to messages on a given topic
Declaration
Objective-C
- (void)cancelPubsubSub:(nonnull NSString *)queryId;Swift
func cancelPubsubSub(_ queryId: String)Parameters
queryIdThe query ID that can be used to cancel the sub
View on GitHub
IpfsApi Class Reference