Thing を削除すると、この Thing に関する以下の情報が削除されます。
Thing 情報およびオーナーに関する情報(ユーザーおよびグループそのものは削除されません)。
Thing スコープに作成されていたデータ(Bucket、KiiObject、トピック)。
Thing 削除の例を以下に挙げます。
Android
try {
// Instantiate a thing by vendor thing ID.
KiiThing thing = KiiThing . loadWithVendorThingID ( "rBnvSPOXBDF9r29GJeGS" );
// Delete the thing.
thing . delete ();
} catch ( AppException e ) {
// Handle the error.
} catch ( IOException e ) {
// Handle the error.
}
// Instantiate a thing by vendor thing ID.
KiiThing . loadWithVendorThingID ( "rBnvSPOXBDF9r29GJeGS" , new KiiCallback < KiiThing >() {
@Override
public void onComplete ( KiiThing result , Exception e ) {
if ( e != null ) {
// Handle the error.
return ;
}
// Delete the thing.
result . delete ( new KiiCallback < KiiThing >() {
@Override
public void onComplete ( KiiThing result , Exception e ) {
if ( e != null ) {
// Handle the error.
return ;
}
}
});
}
});
iOS
Swift:
let thing : KiiThing
do {
// Instantiate a thing by vendor thing ID.
thing = try KiiThing . loadSynchronous ( withVendorThingID : "rBnvSPOXBDF9r29GJeGS" )
} catch ( let error as NSError ){
// Handle the error.
return
}
do {
// Delete the thing.
try thing . deleteSynchronous ()
} catch let error as NSError {
// Handle the error.
return
}
// Instantiate a thing by vendor thing ID.
KiiThing . load ( withVendorThingID : "rBnvSPOXBDF9r29GJeGS" ) { ( thing , error ) -> Void in
if error != nil {
// Handle the error.
return
}
// Delete the thing.
thing !. delete ({ ( deletedThing , error : Error ?) -> Void in
if error != nil {
// Handle the error.
return
}
})
}
Objective-C:
NSError * error = nil ;
// Instantiate a thing by vendor thing ID.
KiiThing * thing = [ KiiThing loadSynchronousWithVendorThingID : @"rBnvSPOXBDF9r29GJeGS"
error : & error ];
// Delete the thing.
[ thing deleteSynchronous : & error ];
if ( error != nil ) {
// Handle the error.
return ;
}
// Instantiate a thing by vendor thing ID.
[ KiiThing loadWithVendorThingID : @"rBnvSPOXBDF9r29GJeGS"
block : ^ ( KiiThing * thing , NSError * error ) {
if ( error != nil ) {
// Handle the error.
return ;
}
// Delete the thing.
[ thing delete : ^ ( KiiThing * thing , NSError * error ) {
if ( error != nil ) {
// Handle the error.
return ;
}
}];
}];
JavaScript
// Instantiate a thing by vendor thing ID.
KiiThing . loadWithVendorThingID ( "rBnvSPOXBDF9r29GJeGS" ,{
success : function ( thing ) {
// Delete the thing.
thing . deleteThing ({
success : function ( theThing ) {
// Do something.
},
failure : function ( theThing , error ) {
// Handle the error.
}
});
},
failure : function ( error ) {
// Handle the error.
}
});