ThreadsApi
@interface ThreadsApi : NodeDependant
Provides access to Textile threads related APIs
-
Create a new thread
Declaration
Objective-C
- (id)add:(id)config error:(NSError *_Nullable *_Nullable)error;
Swift
func add(_ config: Any!) throws -> Any
Parameters
config
The configuration object that describes the thread to be created
error
A reference to an error pointer that will be set in the case of an error
Return Value
The newly created thread
-
Update an existing thread or create it if it doesn’t exist
Declaration
Objective-C
- (void)addOrUpdate:(id)thrd error:(NSError *_Nullable *_Nullable)error;
Swift
func addOrUpdate(_ thrd: Any!, error: NSErrorPointer)
Parameters
thrd
The updated representation of the thread to update
error
A reference to an error pointer that will be set in the case of an error
-
Rename a thread
Declaration
Objective-C
- (void)rename:(nonnull NSString *)threadId name:(nonnull NSString *)name error:(NSError *_Nullable *_Nullable)error;
Swift
func rename(_ threadId: String, name: String, error: NSErrorPointer)
Parameters
threadId
The id of the thread to rename
name
The new name for the thread
error
A reference to an error pointer that will be set in the case of an error
-
Get an existing thread by id
Declaration
Objective-C
- (id)get:(nonnull NSString *)threadId error:(NSError *_Nullable *_Nullable)error;
Swift
func get(_ threadId: String) throws -> Any
Parameters
threadId
The id of the thread to retrieve
error
A reference to an error pointer that will be set in the case of an error
Return Value
The corresponding thread object
-
List all threads the local peer account participates in
Declaration
Objective-C
- (id)list:(NSError *_Nullable *_Nullable)error;
Swift
func list() throws -> Any
Parameters
error
A reference to an error pointer that will be set in the case of an error
Return Value
An object containing a list of threads
-
List all peers that participate in a particular thread
Declaration
Objective-C
- (id)peers:(nonnull NSString *)threadId error:(NSError *_Nullable *_Nullable)error;
Swift
func peers(_ threadId: String) throws -> Any
Parameters
threadId
The id of the thread to query
error
A reference to an error pointer that will be set in the case of an error
Return Value
An object containing a list of contacts
-
Leave a thread
Declaration
Objective-C
- (nonnull NSString *)remove:(nonnull NSString *)threadId error:(NSError *_Nullable *_Nullable)error;
Swift
func remove(_ threadId: String, error: NSErrorPointer) -> String
Parameters
threadId
The id of the thread to remove
error
A reference to an error pointer that will be set in the case of an error
Return Value
The hash of the newly created thread leave block
-
Snapshot all threads and sync them to registered cafes
Declaration
Objective-C
- (void)snapshot:(NSError *_Nullable *_Nullable)error;
Swift
func snapshot(_ error: NSErrorPointer)
Parameters
error
A reference to an error pointer that will be set in the case of an error
-
Searches the network for thread snapshots
Declaration
Objective-C
- (id)searchSnapshots:(id)query options:(id)options error:(NSError *_Nullable *_Nullable)error;
Swift
func searchSnapshots(_ query: Any!, options: Any!) throws -> Any
Parameters
query
The object describing the query to execute
options
Options controlling the behavior of the search
error
A reference to an error pointer that will be set in the case of an error
Return Value
A handle that can be used to cancel the search