Account-0.10.0

    Account-0.10.0


    Article summary


    title: Account

    # Account Module

    Version 0.10.0

    Overview

    A module for querying about the device account.

    OpenRPC

    Firebolt APIs are maintained in the rdkcentral/firebolt-core-sdk GitHub repository.

    You can see this API in the account.json OpenRPC JSON-Schema document.

    Table of Contents

    Usage

    To use the Account module, you can import it into your project from the Firebolt SDK:

    import { Account } from '@firebolt-js/sdk'
    

    Methods

    id

    Get the platform back-office account identifier

    To get the value of id call the method like this:

    function id(): Promise<string>
    

    Promise resolution:

    TypeDescription
    stringthe id

    Examples

    Default Example

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.id()
        .then(id => {
            console.log(id)
        })
    

    Value of id:

    "123"
    
    JSON-RPC:

    Request:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "account.id",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": "123"
    }
    

    To set the value of id call the method like this:

    Parameters:

    ParamTypeRequiredSummary
    ``

    Promise resolution:

    TypeSummary
    voidPromise resolves with no value when the operation is complete.

    Examples

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.id()
    
    JSON-RPC:

    Request:

    Response:

    To subscribe to notifications when the value changes, call the method like this:

    function id (subscriber: () => void): Promise<listenerId>
    

    Parameters:

    ParamTypeRequiredSummary
    ``
    subscriberfunctionYesCallback to execute when the value changes.

    Promise resolution:

    TypeSummary
    listenerIdThe id of the listener that can be used with Account.clear(listenerId) to unsubscribe

    Callback parameters:

    ParamTypeRequiredSummary
    ```

    Examples

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.id((value) => {
      // property value was changed
      console.log(value)
    }).then(listenerId => {
      // you can clear this listener w/ Account.clear(listenerId)
    })
    

    value of value:

    JSON-RPC:

    Request:

    Response:

    {
      "jsonrpc": "2.0",
      "id": "1",
      "result": {
        "listening": "true"
      }
    }
    

    uid

    Gets a unique id for the current app & account

    To get the value of uid call the method like this:

    function uid(): Promise<string>
    

    Promise resolution:

    TypeDescription
    stringa unique ID

    Examples

    Getting the unique ID

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.uid()
        .then(uniqueId => {
            console.log(uniqueId)
        })
    

    Value of uniqueId:

    "ee6723b8-7ab3-462c-8d93-dbf61227998e"
    
    JSON-RPC:

    Request:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "account.uid",
      "params": {}
    }
    

    Response:

    {
      "jsonrpc": "2.0",
      "id": 1,
      "result": "ee6723b8-7ab3-462c-8d93-dbf61227998e"
    }
    

    To set the value of uid call the method like this:

    Parameters:

    ParamTypeRequiredSummary
    ``

    Promise resolution:

    TypeSummary
    voidPromise resolves with no value when the operation is complete.

    Examples

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.uid()
    
    JSON-RPC:

    Request:

    Response:

    To subscribe to notifications when the value changes, call the method like this:

    function uid (subscriber: () => void): Promise<listenerId>
    

    Parameters:

    ParamTypeRequiredSummary
    ``
    subscriberfunctionYesCallback to execute when the value changes.

    Promise resolution:

    TypeSummary
    listenerIdThe id of the listener that can be used with Account.clear(listenerId) to unsubscribe

    Callback parameters:

    ParamTypeRequiredSummary
    ```

    Examples

    JavaScript:

    import { Account } from '@firebolt-js/sdk'
    
    Account.uid((value) => {
      // property value was changed
      console.log(value)
    }).then(listenerId => {
      // you can clear this listener w/ Account.clear(listenerId)
    })
    

    value of value:

    JSON-RPC:

    Request:

    Response:

    {
      "jsonrpc": "2.0",
      "id": "1",
      "result": {
        "listening": "true"
      }
    }
    


    Was this article helpful?