• Public
  • Public/Protected
  • All

Class KiiThingContext


  • KiiThingContext



  • bucketWithName(bucketName: string): KiiBucket
  • Creates a reference to a bucket in App scope operated by thing.

    Kii.authenticateAsThing("vendorThingID", "password").then(thingAuthContext => {
    let bucket = thingAuthContext.bucketWithName("myAppBucket");
    }).catch(error => {
    // auth failed.


    • bucketName: string

    Returns KiiBucket

    A working KiiBucket object

  • Creates a reference to a encrypted bucket in App scope operated by thing.

    The bucket will be created/accessed within this app's scope

    Kii.authenticateAsThing("vendorThingID", "password").then(thingAuthContext => {
    let bucket = thingAuthContext.encryptedBucketWithName("myAppBucket");
    }).catch(error => {
    // auth failed.


    • bucketName: string

    Returns KiiEncryptedBucket

    A working KiiBucket object

  • Gets authenticated KiiThing instance.
    Returned thing instance only have thingID, vendorThingID and accessToken. (vendorThingID is not included when you used Kii.authenticateAsThing to obtain KiiThingContext.)
    Please execute KiiThing.refresh to obtain other properties.

    Returns KiiThing

    return authenticated KiiThing instance.

  • listTopics(paginationKey?: string): Promise<[KiiTopic[], null | string]>
  • Gets a list of topics in app scope

    // Assume you already have thingAuthContext instance.
    thingAuthContext.listTopics().then(params => {
    let topicList = params[0];
    let nextPaginationKey = params[1];
    // do something with the result
    for (let i = 0; i < topicList.length; i++) {
    let topic = topicList[i];
    if (nextPaginationKey != null) {
    thingAuthContext.listTopics(null, nextPaginationKey)
    .then(params => {...})
    .catch(error => {...});
    }).catch(error => {
    // do something with the error response


    • Optional paginationKey: string

      You can specify the pagination key with the nextPaginationKey passed by callbacks.success. If empty string or no string object is provided, this API regards no paginationKey specified.

    Returns Promise<[KiiTopic[], null | string]>

    return promise object.

    • fulfill callback function: function(params). params is Array instance.
      • params[0] is array of KiiTopic instances.
      • params[1] is string of nextPaginationKey.
    • reject callback function: function(error). error is an Error instance.
      • error.target is a KiiAppAdminContext instance which this method was called on.
      • error.message

  • Creates a reference to an object operated by thing using object`s URI.


    {InvalidURIException} If the URI is null, empty or does not have correct format.


    • objectURI: string

    Returns KiiObject

    A working KiiObject instance

  • topicWithName(topicName: string): KiiTopic
  • Creates a reference to a topic in App scope operated by thing.

    The Topic will be created/accessed within this app's scope


    • topicName: string

      name of the topic. Must be a not empty string.

    Returns KiiTopic

    topic instance.

Generated using TypeDoc