ThingIFAPI
public class ThingIFAPI: NSObject, NSCoding
Class provides API of the ThingIF.
-
Tag of the ThingIFAPI instance
Declaration
Swift
public let tag : String?
-
URL of KiiApps Server
Declaration
Swift
public let baseURL: String!
-
The application ID found in your Kii developer console
Declaration
Swift
public let appID: String!
-
The application key found in your Kii developer console
Declaration
Swift
public let appKey: String!
-
Kii Cloud Application
Declaration
Swift
public let app: App!
-
owner of target
Declaration
Swift
public let owner: Owner!
-
Get installationID if the push is already installed. null will be returned if the push installation has not been done.
Returns
Installation ID used in IoT Cloud.Declaration
Swift
public var installationID: String?
Return Value
Installation ID used in IoT Cloud.
-
target
Declaration
Swift
public var target: Target?
-
Undocumented
Declaration
Swift
public class ThingIFAPI: NSObject, NSCoding
-
Undocumented
Declaration
Swift
public class ThingIFAPI: NSObject, NSCoding
-
On board IoT Cloud with the specified vendor thing ID. Specified thing will be owned by owner who consumes this API. (Specified on creation of ThingIFAPI instance.) If you are using a gateway, you need to use onboardEndnodeWithGateway to onboard endnode instead.
Note: You should not call onboard second time, after successfully onboarded. Otherwise, ThingIFError.ALREADY_ONBOARDED will be returned in completionHandler callback.
Parameter
Parameter vendorThingID: Thing ID given by vendor. Must be specified.Parameter
Parameter thingPassword: Thing Password given by vendor. Must be specified.Parameter
Parameter thingType: Type of the thing given by vendor. If the thing is already registered, this value would be ignored by IoT Cloud.Parameter
Parameter thingProperties: Properties of thing. If the thing is already registered, this value would be ignored by IoT Cloud. Refer to the REST API DOC About the format of this Document.Parameter
Parameter completionHandler: A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFErrorDeclaration
Swift
public func onboard( vendorThingID:String, thingPassword:String, thingType:String?, thingProperties:Dictionary<String,AnyObject>?, completionHandler: (Target?, ThingIFError?)-> Void ) ->Void
Parameters
vendorThingID
Thing ID given by vendor. Must be specified.
thingPassword
Thing Password given by vendor. Must be specified.
thingType
Type of the thing given by vendor. If the thing is already registered, this value would be ignored by IoT Cloud.
thingProperties
Properties of thing. If the thing is already registered, this value would be ignored by IoT Cloud. Refer to the About the format of this Document.
completionHandler
A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFError
-
On board IoT Cloud with the specified vendor thing ID. Specified thing will be owned by owner who consumes this API. (Specified on creation of ThingIFAPI instance.) If you are using a gateway, you need to use onboardEndnodeWithGateway to onboard endnode instead.
Note: You should not call onboard second time, after successfully onboarded. Otherwise, ThingIFError.ALREADY_ONBOARDED will be returned in completionHandler callback.
Parameter
Parameter vendorThingID: Thing ID given by vendor. Must be specified.Parameter
Parameter thingPassword: Thing Password given by vendor. Must be specified.Parameter
Parameter options: Optional parameters inside.Parameter
Parameter completionHandler: A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFErrorDeclaration
Swift
public func onboardWithVendorThingID( vendorThingID:String, thingPassword:String, options:OnboardWithVendorThingIDOptions? = nil, completionHandler: (Target?, ThingIFError?)-> Void ) ->Void
Parameters
vendorThingID
Thing ID given by vendor. Must be specified.
thingPassword
Thing Password given by vendor. Must be specified.
options
Optional parameters inside.
completionHandler
A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFError
-
On board IoT Cloud with the specified thing ID. Specified thing will be owned by owner who consumes this API. (Specified on creation of ThingIFAPI instance.) When you’re sure that the on board process has been done, this method is convenient. If you are using a gateway, you need to use onboardEndnodeWithGateway to onboard endnode instead.
Note: You should not call onboard second time, after successfully onboarded. Otherwise, ThingIFError.ALREADY_ONBOARDED will be returned in completionHandler callback.
Parameter
Parameter thingID: Thing ID given by IoT Cloud. Must be specified.Parameter
Parameter thingPassword: Thing Password given by vendor. Must be specified.Parameter
Parameter completionHandler: A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFErrorDeclaration
Swift
public func onboard( thingID:String, thingPassword:String, completionHandler: (Target?, ThingIFError?)-> Void ) ->Void
Parameters
thingID
Thing ID given by IoT Cloud. Must be specified.
thingPassword
Thing Password given by vendor. Must be specified.
completionHandler
A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFError
-
On board IoT Cloud with the specified thing ID. Specified thing will be owned by owner who consumes this API. (Specified on creation of ThingIFAPI instance.) When you’re sure that the on board process has been done, this method is convenient. If you are using a gateway, you need to use onboardEndnodeWithGateway to onboard endnode instead.
Note: You should not call onboard second time, after successfully onboarded. Otherwise, ThingIFError.ALREADY_ONBOARDED will be returned in completionHandler callback.
Parameter
Parameter thingID: Thing ID given by IoT Cloud. Must be specified.Parameter
Parameter thingPassword: Thing Password given by vendor. Must be specified.Parameter
Parameter options: Optional parameters inside.Parameter
Parameter completionHandler: A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFErrorDeclaration
Swift
public func onboardWithThingID( thingID:String, thingPassword:String, options:OnboardWithThingIDOptions? = nil, completionHandler: (Target?, ThingIFError?)-> Void ) ->Void
Parameters
thingID
Thing ID given by IoT Cloud. Must be specified.
thingPassword
Thing Password given by vendor. Must be specified.
options
Optional parameters inside.
completionHandler
A closure to be executed once on board has finished. The closure takes 2 arguments: an target, an ThingIFError
-
Endpoints execute onboarding for the thing and merge MQTT channel to the gateway. Thing act as Gateway is already registered and marked as Gateway.
Parameter
Parameter pendingEndnode: Pending End NodeParameter
Parameter endnodePassword: Password of the End NodeParameter
Parameter options: Optional parameters inside.Parameter
Parameter completionHandler: A closure to be executed once on board has finished. The closure takes 2 arguments: an end node, an ThingIFErrorDeclaration
Swift
public func onboardEndnodeWithGateway( pendingEndnode:PendingEndNode, endnodePassword:String, options:OnboardEndnodeWithGatewayOptions? = nil, completionHandler: (EndNode?, ThingIFError?)-> Void ) ->Void
-
Install push notification to receive notification from IoT Cloud. IoT Cloud will send notification when the Target replies to the Command. Application can receive the notification and check the result of Command fired by Application or registered Trigger. After installation is done Installation ID is managed in this class.
Parameter
Parameter deviceToken: NSData instance of device token for APNS.Parameter
Parameter development: flag indicate whether the cert is development or production. This is optional, the default is false (production).Parameter
Parameter completionHandler: A closure to be executed once on board has finished.Declaration
Swift
public func installPush( deviceToken:NSData, development:Bool?=false, completionHandler: (String?, ThingIFError?)-> Void )
Parameters
deviceToken
NSData instance of device token for APNS.
development
flag indicate whether the cert is development or production. This is optional, the default is false (production).
completionHandler
A closure to be executed once on board has finished.
-
Uninstall push notification. After done, notification from IoT Cloud won’t be notified.
Parameter
Parameter installationID: installation ID returned from installPush(). If null is specified, value of the installationID property is used.Declaration
Swift
public func uninstallPush( installationID:String?, completionHandler: (ThingIFError?)-> Void )
Parameters
installationID
installation ID returned from installPush(). If null is specified, value of the installationID property is used.
-
Post new command to IoT Cloud. Command will be delivered to specified target and result will be notified through push notification.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter schemaName: Name of the Schema of which the Command is defined.Parameter
Parameter schemaVersion: Version of the Schema of which the Command is defined.Parameter
Parameter actions: List of Actions to be executed in the Target.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.Declaration
Swift
public func postNewCommand( schemaName:String, schemaVersion:Int, actions:[Dictionary<String,AnyObject>], completionHandler: (Command?, ThingIFError?)-> Void ) -> Void
Parameters
schemaName
Name of the Schema of which the Command is defined.
schemaVersion
Version of the Schema of which the Command is defined.
actions
List of Actions to be executed in the Target.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.
-
Post new command to IoT Cloud. Command will be delivered to specified target and result will be notified through push notification.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter commandForm: Command form of posting command.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.Declaration
Swift
public func postNewCommand( commandForm: CommandForm, completionHandler: (Command?, ThingIFError?) -> Void) -> Void
Parameters
commandForm
Command form of posting command.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.
-
Get specified command
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter commandID: ID of the Command to obtain.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.Declaration
Swift
public func getCommand( commandID:String, completionHandler: (Command?, ThingIFError?)-> Void )
Parameters
commandID
ID of the Command to obtain.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: an instance of created command, an instance of ThingIFError when failed.
-
List Commands in the specified Target.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter bestEffortLimit: Limit the maximum number of the Commands in the Response. If omitted default limit internally defined is applied. Meaning of ‘bestEffort’ is if specified value is greater than default limit, default limit is applied.Parameter
Parameter paginationKey: If there is further page to be retrieved, this API returns paginationKey in sencond element. Specifying this value in next call results continue to get the results from the next page.Returns
Where 1st element is Array of the commands belongs to the Target. 2nd element is paginationKey if there is further page to be retrieved.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 3 arguments: 1st one is Array of Commands if found, 2nd one is paginationKey if there is further page to be retrieved, and 3rd one is an instance of ThingIFError when failed.Declaration
Swift
public func listCommands( bestEffortLimit:Int?, paginationKey:String?, completionHandler: ([Command]?, String?, ThingIFError?)-> Void )
Parameters
bestEffortLimit
Limit the maximum number of the Commands in the Response. If omitted default limit internally defined is applied. Meaning of ‘bestEffort’ is if specified value is greater than default limit, default limit is applied.
paginationKey
If there is further page to be retrieved, this API returns paginationKey in sencond element. Specifying this value in next call results continue to get the results from the next page.
completionHandler
A closure to be executed once finished. The closure takes 3 arguments: 1st one is Array of Commands if found, 2nd one is paginationKey if there is further page to be retrieved, and 3rd one is an instance of ThingIFError when failed.
Return Value
Where 1st element is Array of the commands belongs to the Target. 2nd element is paginationKey if there is further page to be retrieved.
-
Post new Trigger to IoT Cloud.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
When thing related to this ThingIFAPI instance meets condition described by predicate, A registered command sends to thing related to
TriggeredCommandForm.targetID
.target
property andTriggeredCommandForm.targetID
must be same owner’s things.Parameter
Parameter triggeredCommandForm: Triggered command form of posting trigger.Parameter
Parameter predicate: Predicate of this trigger.Parameter
Parameter options: Optional data for this trigger.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is an created Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func postNewTrigger( triggeredCommandForm:TriggeredCommandForm, predicate:Predicate, options:TriggerOptions? = nil, completionHandler: (Trigger?, ThingIFError?) -> Void)
Parameters
triggeredCommandForm
Triggered command form of posting trigger.
predicate
Predicate of this trigger.
options
Optional data for this trigger.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is an created Trigger instance, 2nd one is an ThingIFError instance when failed.
-
Post new Trigger to IoT Cloud.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
When thing related to this ThingIFAPI instance meets condition described by predicate, A registered command sends to thing related to target.
target
property and target argument must be same owner’s things.Parameter
Parameter schemaName: Name of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter schemaVersion: Version of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter actions: Actions to be executed by the Trigger.Parameter
Parameter predicate: Predicate of the Command.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is an created Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func postNewTrigger( schemaName:String, schemaVersion:Int, actions:[Dictionary<String, AnyObject>], predicate:Predicate, completionHandler: (Trigger?, ThingIFError?)-> Void )
Parameters
schemaName
Name of the Schema of which the Command specified in Trigger is defined.
schemaVersion
Version of the Schema of which the Command specified in Trigger is defined.
actions
Actions to be executed by the Trigger.
predicate
Predicate of the Command.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is an created Trigger instance, 2nd one is an ThingIFError instance when failed.
-
Post new Trigger to IoT Cloud.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter schemaName: Name of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter schemaVersion: Version of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter serverCode: Server code to be executed by the Trigger.Parameter
Parameter predicate: Predicate of the Command.Parameter
Parameter options: Optional data for this trigger.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is an created Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func postNewTrigger( serverCode:ServerCode, predicate:Predicate, options:TriggerOptions? = nil, completionHandler: (Trigger?, ThingIFError?)-> Void )
-
Get specified trigger
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter triggerID: ID of the Trigger to obtain.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: an instance of Trigger, an instance of ThingIFError when failed.Declaration
Swift
public func getTrigger( triggerID:String, completionHandler: (Trigger?, ThingIFError?)-> Void )
Parameters
triggerID
ID of the Trigger to obtain.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: an instance of Trigger, an instance of ThingIFError when failed.
-
Apply patch to a registered Trigger Modify a registered Trigger with the specified patch.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
target
property andTriggeredCommandForm.targetID
must be same owner’s things.Parameter
Parameter triggerID: ID of the Trigger to which the patch is applied.Parameter
Parameter triggeredCommandForm: Modified triggered command form to patch trigger.Parameter
Parameter predicate: Modified Predicate to be applied as patch.Parameter
Parameter options: Modified optional data for this trigger.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is the modified Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func patchTrigger( triggerID:String, triggeredCommandForm:TriggeredCommandForm? = nil, predicate:Predicate? = nil, options:TriggerOptions? = nil, completionHandler: (Trigger?, ThingIFError?) -> Void)
Parameters
triggerID
ID of the Trigger to which the patch is applied.
triggeredCommandForm
Modified triggered command form to patch trigger.
predicate
Modified Predicate to be applied as patch.
options
Modified optional data for this trigger.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is the modified Trigger instance, 2nd one is an ThingIFError instance when failed.
-
Apply patch to a registered Trigger Modify a registered Trigger with the specified patch.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter triggerID: ID of the Trigger to which the patch is applied.Parameter
Parameter schemaName: Name of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter schemaVersion: Version of the Schema of which the Command specified in Trigger is defined.Parameter
Parameter actions: Modified Actions to be applied as patch.Parameter
Parameter predicate: Modified Predicate to be applied as patch.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is the modified Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func patchTrigger( triggerID:String, schemaName:String?, schemaVersion:Int?, actions:[Dictionary<String, AnyObject>]?, predicate:Predicate?, completionHandler: (Trigger?, ThingIFError?)-> Void )
Parameters
triggerID
ID of the Trigger to which the patch is applied.
schemaName
Name of the Schema of which the Command specified in Trigger is defined.
schemaVersion
Version of the Schema of which the Command specified in Trigger is defined.
actions
Modified Actions to be applied as patch.
predicate
Modified Predicate to be applied as patch.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is the modified Trigger instance, 2nd one is an ThingIFError instance when failed.
-
Apply patch to a registered Trigger Modify a registered Trigger with the specified patch.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter triggerID: ID of the Trigger to which the patch is applied.Parameter
Parameter serverCode: Modified ServerCode to be applied as patch.Parameter
Parameter predicate: Modified Predicate to be applied as patch.Parameter
Parameter options: Optional data for this trigger.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is the modified Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func patchTrigger( triggerID:String, serverCode:ServerCode? = nil, predicate:Predicate? = nil, options:TriggerOptions? = nil, completionHandler: (Trigger?, ThingIFError?)-> Void )
-
Enable/Disable a registered Trigger If its already enabled(/disabled), this method won’t throw error and behave as succeeded.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter triggerID: ID of the Trigger to be enabled/disabled.Parameter
Parameter enable: Flag indicate enable/disable Trigger.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is the enabled/disabled Trigger instance, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func enableTrigger( triggerID:String, enable:Bool, completionHandler: (Trigger?, ThingIFError?)-> Void )
Parameters
triggerID
ID of the Trigger to be enabled/disabled.
enable
Flag indicate enable/disable Trigger.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is the enabled/disabled Trigger instance, 2nd one is an ThingIFError instance when failed.
-
Delete a registered Trigger.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter triggerID: ID of the Trigger to be deleted.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 2 arguments: 1st one is the deleted TriggerId, 2nd one is an ThingIFError instance when failed.Declaration
Swift
public func deleteTrigger( triggerID:String, completionHandler: (String, ThingIFError?)-> Void )
Parameters
triggerID
ID of the Trigger to be deleted.
completionHandler
A closure to be executed once finished. The closure takes 2 arguments: 1st one is the deleted TriggerId, 2nd one is an ThingIFError instance when failed.
-
List Triggers belongs to the specified Target
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter bestEffortLimit: Limit the maximum number of the Triggers in the Response. If omitted default limit internally defined is applied. Meaning of ‘bestEffort’ is if specified value is greater than default limit, default limit is applied.Parameter
Parameter paginationKey: If there is further page to be retrieved, this API returns paginationKey in 2nd element. Specifying this value in next call in the argument results continue to get the results from the next page.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 3 arguments: 1st one is Array of Triggers instance if found, 2nd one is paginationKey if there is further page to be retrieved, and 3rd one is an instance of ThingIFError when failed.Declaration
Swift
public func listTriggers( bestEffortLimit:Int?, paginationKey:String?, completionHandler: (triggers:[Trigger]?, paginationKey:String?, error: ThingIFError?)-> Void )
Parameters
bestEffortLimit
Limit the maximum number of the Triggers in the Response. If omitted default limit internally defined is applied. Meaning of ‘bestEffort’ is if specified value is greater than default limit, default limit is applied.
paginationKey
If there is further page to be retrieved, this API returns paginationKey in 2nd element. Specifying this value in next call in the argument results continue to get the results from the next page.
completionHandler
A closure to be executed once finished. The closure takes 3 arguments: 1st one is Array of Triggers instance if found, 2nd one is paginationKey if there is further page to be retrieved, and 3rd one is an instance of ThingIFError when failed.
-
Retrieves list of server code results that was executed by the specified trigger. Results will be listing with order by modified date descending (latest first)
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter bestEffortLimit: Limit the maximum number of the Results in the Response. If omitted default limit internally defined is applied. Meaning of ‘bestEffort’ is if specified value is greater than default limit, default limit is applied.Parameter
Parameter triggerID: ID of the TriggerParameter
Parameter paginationKey: If there is further page to be retrieved, this API returns paginationKey in 2nd element. Specifying this value in next call in the argument results continue to get the results from the next page.Parameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 3 arguments: 1st one is Array of Results instance if found, 2nd one is paginationKey if there is further page to be retrieved, and 3rd one is an instance of ThingIFError when failed.Declaration
Swift
public func listTriggeredServerCodeResults( triggerID:String, bestEffortLimit:Int?, paginationKey:String?, completionHandler: (results:[TriggeredServerCodeResult]?, paginationKey:String?, error: ThingIFError?)-> Void )
-
Get the state of specified target.
Note: Please onboard first, or provide a target instance by calling copyWithTarget. Otherwise, KiiCloudError.TARGET_NOT_AVAILABLE will be return in completionHandler callback
Parameter
Parameter completionHandler: A closure to be executed once get state has finished. The closure takes 2 arguments: 1st one is Dictionary that represent Target State and 2nd one is an instance of ThingIFError when failed.Declaration
Swift
public func getState( completionHandler: (Dictionary<String, AnyObject>?, ThingIFError?)-> Void )
Parameters
completionHandler
A closure to be executed once get state has finished. The closure takes 2 arguments: 1st one is Dictionary that represent Target State and 2nd one is an instance of ThingIFError when failed.
-
Get the Vendor Thing ID of specified Target.
Parameter
Parameter completionHandler: A closure to be executed once get id has finished. The closure takes 2 arguments: 1st one is Vendor Thing ID and 2nd one is an instance of ThingIFError when failed.Declaration
Swift
public func getVendorThingID( completionHandler: (String?, ThingIFError?)-> Void )
-
Update the Vendor Thing ID of specified Target.
Parameter
Parameter newVendorThingID: New vendor thing idParameter
Parameter newPassword: New passwordParameter
Parameter completionHandler: A closure to be executed once finished. The closure takes 1 argument: an instance of ThingIFError when failed.Declaration
Swift
public func updateVendorThingID( newVendorThingID: String, newPassword: String, completionHandler: (ThingIFError?)-> Void )
-
Get new instance with new target
Parameter
Parameter newTarget: target instance will be setted to new ThingIFAPI instanceParameter
Parameter tag: tag of the ThingIFAPI instance or nil for default tagReturns
New ThingIFAPI instance with newTargetDeclaration
Swift
public func copyWithTarget(newTarget: Target, tag : String? = nil) -> ThingIFAPI
Parameters
newTarget
target instance will be setted to new ThingIFAPI instance
tag
tag of the ThingIFAPI instance or nil for default tag
Return Value
New ThingIFAPI instance with newTarget
-
Try to load the instance of ThingIFAPI using stored serialized instance.
Parameter
Parameter tag: tag of the ThingIFAPI instanceReturns
ThingIFAPI instance.Declaration
Swift
public static func loadWithStoredInstance(tag : String? = nil) throws -> ThingIFAPI?
Parameters
tag
tag of the ThingIFAPI instance
Return Value
ThingIFAPI instance.
-
Save this instance
Declaration
Swift
public func saveInstance() -> Void
-
Clear all saved instances in the NSUserDefaults.
Declaration
Swift
public static func removeAllStoredInstances()
-
Remove saved specified instance in the NSUserDefaults. - Parameter tag: tag of the ThingIFAPI instance or nil for default tag
Declaration
Swift
public static func removeStoredInstances(tag : String?=nil)
Parameters
tag
tag of the ThingIFAPI instance or nil for default tag
-
Undocumented
Declaration
Swift
public class ThingIFAPI: NSObject, NSCoding