Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KiiTopic

Represents a Topic object.

Hierarchy

  • KiiTopic

Index

Methods

  • Get ACL object of this topic. Access to topic can be configured by adding/removing KiiACLEntry to/from obtained acl object.

    Returns KiiACL

    acl object of this topic.

  • Delete the topic.

    example
    // assume topic is already instantiated.
    topic.deleteTopic().then(topic => {
    // Delete topic succeeded.
    }).catch(error => {
    // Handle error.
    });

    Returns Promise<KiiTopic>

    return promise object.

    • fulfill callback function: function(theDeletedTopic). theDeletedTopic is a KiiTopic instance.
    • reject callback function: function(error). error is an Error instance.
      • error.target is the KiiTopic instance which this method was called on.
      • error.message

  • exists(): Promise<boolean>
  • Checks whether the topic already exists or not.

    example
    // assume topic is already instantiated.
    topic.exists().then(existed => {
    }).catch(error => {
    // Handle error.
    });

    Returns Promise<boolean>

    return promise object.

    • fulfill callback function: function(existed). true if the topic exists.
    • reject callback function: function(error). error is an Error instance.
      • error.target is the KiiTopic instance which this method was called on.
      • error.message

  • getName(): string
  • get name of this topic

    Returns string

    name of this topic.

  • Save this topic on Kii Cloud. Note that only app admin can save application scope topic.

    example
    // assume topic is already instantiated.
    topic.save().then(topic => {
    // Save topic succeeded.
    }).catch(error => {
    // Handle error.
    });

    Returns Promise<KiiTopic>

    return promise object.

    • fulfill callback function: function(theSavedTopic). theSavedTopic is a KiiTopic instance.
    • reject callback function: function(error). error is an Error instance.
      • error.target is the KiiTopic instance which this method was called on.
      • error.message

  • sendMessage(message: any): Promise<[KiiTopic, any]>
  • sendMessage

    example
    // assume topic is already instantiated.
    let contents = {
    message : "hello push!"
    };
    let message = new KiiPushMessageBuilder(contents).build();
    topic.sendMessage(message).then(params => {
    // Send message succeeded.
    }).catch(error => {
    // Handle error.
    });

    Parameters

    • message: any

      message to be sent.

    Returns Promise<[KiiTopic, any]>

    return promise object.

    • fulfill callback function: function(params). params is an Array instance.
      • params[0] is the KiiTopic instance which this method was called on.
      • params[1] is the message object to send.
    • reject callback function: function(error). error is an Error instance.
      • error.target is the KiiTopic instance which this method was called on.
      • error.message

Generated using TypeDoc