FilesApi
@interface FilesApi : NodeDependant
Provides access to Textile files related APIs
-
Add raw data to a Textile thread
Declaration
Objective-C
- (void)addData:(nonnull NSString *)base64 threadId:(nonnull NSString *)threadId caption:(nonnull NSString *)caption completion:(nonnull void (^)(int *_Nullable, NSError *_Nonnull))completion;Swift
func addData(_ base64: String, threadId: String, caption: String, completion: @escaping (UnsafeMutablePointer<Int32>?, Error) -> Void)Parameters
base64Raw data as base64 string
threadIdThe thread id the data will be added to
captionA caption to associate with the data
completionA block that will get called with the results of the add operation
-
Add files to a Textile thread
Declaration
Objective-C
- (void)addFiles:(nonnull NSString *)files threadId:(nonnull NSString *)threadId caption:(nonnull NSString *)caption completion: (nonnull void (^)(int *_Nullable, NSError *_Nonnull))completion;Swift
func addFiles(_ files: String, threadId: String, caption: String, completion: @escaping (UnsafeMutablePointer<Int32>?, Error) -> Void)Parameters
filesA comma-separated list of file paths to add, paths can be file system paths, IPFS hashes, or an existing file hash that may need decryption
threadIdThe thread id the files will be added to
captionA caption to associate with the files
completionA block that will get called with the results of the add operation
-
Share files already aded to a Textile thread to a Textile thread
Declaration
Objective-C
- (void)shareFiles:(nonnull NSString *)target threadId:(nonnull NSString *)threadId caption:(nonnull NSString *)caption completion: (nonnull void (^)(int *_Nullable, NSError *_Nonnull))completion;Swift
func shareFiles(_ target: String, threadId: String, caption: String, completion: @escaping (UnsafeMutablePointer<Int32>?, Error) -> Void)Parameters
targetThe source thread target of the files to share
threadIdThe thread id the files will be shared to
captionA caption to associate with the files
completionA block that will get called with the results of the add operation
-
Get a list of files data from a thread
Declaration
Objective-C
- (id)list:(nonnull NSString *)threadId offset:(nullable NSString *)offset limit:(long)limit error:(NSError *_Nullable *_Nullable)error;Swift
func list(_ threadId: String, offset: String?, limit: Int) throws -> AnyParameters
threadIdThe thread to query
offsetThe offset to beging querying from
limitThe max number of results to return
errorA reference to an error pointer that will be set in the case of an error
Return Value
An object containing a list of files data
-
Get raw data for a file hash
Declaration
Objective-C
- (void)content:(nonnull NSString *)hash completion:(nonnull void (^)(NSData *_Nullable, NSString *_Nullable, NSError *_Nonnull))completion;Swift
func content(_ hash: String, completion: @escaping (Data?, String?, Error) -> Void)Parameters
hashThe hash to return data for
completionA block that will get called with the results of content
-
Helper function to return the most appropriate image data for a minimun image width
Declaration
Objective-C
- (void)imageContentForMinWidth:(nonnull NSString *)path minWidth:(long)minWidth completion:(nonnull void (^)(NSData *_Nullable, NSString *_Nullable, NSError *_Nonnull))completion;Swift
func imageContent(forMinWidth path: String, minWidth: Int, completion: @escaping (Data?, String?, Error) -> Void)Parameters
pathThe IPFS path that includes image data for various image sizes
minWidthThe width of the image the data will be used for
completionA block that will get called with the results of content
View on GitHub
FilesApi Class Reference