Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update library state to override default parameters.initialization #109

Open
ferchoglober opened this issue Feb 9, 2023 · 1 comment
Open

Comments

@ferchoglober
Copy link

ferchoglober commented Feb 9, 2023

Hello you all! I'm using this awesome library some days ago, this works pretty well in some tests I did, Now I'm trying to get the data inside a navigateTo param when my app is NOT running. I'm using the firebolt Prameters module to get that data.

To do so, I'm trying to override the default mock value for parameters.initialization by uploading my parameters-initialization.json which contains the following json

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "parameters.initialization",
  "result": {
    "lmt": 0,
    "us_privacy": "1-Y-",
    "discovery": {
      "navigateTo": {
        "action": "playback",
        "context": {
            "source": "device"
        },
        "data": {
          "entityType": "program",
          "programType": "movie",
          "entityId": "my-entity-id"
        }
      }
    }
  }
}

this is the executed command node cli.mjs --upload ../examples/parameters-initialization.json

The update seems to be well since the cli says { status: 'SUCCESS' } and the server says "Updating state for default user 12345" (my app is working with the default user) but when I reload my app I'm getting the default data again and again :(

After updating the state of mock-firebolt and reloading my app I'm getting the default data:

{
  "navigateTo": {
    "action": "entity",
    "data": {
      "entityId": "abc",
      "entityType": "program",
      "programType": "movie"
    },
    "context": {
      "source": "voice"
    }
  }
}

I want mock-firebolt to get the data in my app as I defined in the library state, something like this:

{
  "navigateTo": {
    "action": "playback",
    "context": {
      "source": "device"
    },
    "data": {
      "entityType": "program",
      "programType": "movie",
      "entityId": "my-entity-id"
    }
  }
}

Could you help me please?

@ferchoglober
Copy link
Author

Hey, I found a solution for this, I just used a yaml file instead json to update the mock-firebolt state, my app is working now with this

command:

node cli.mjs --upload ../examples/parameters-initialization-playback.yaml

examples/parameters-initialization-playback.yaml:

---
methods:
  parameters.initialization:
    response: |
      function f(ctx, params) {
        const result = {"discovery":{"navigateTo":{"action":"playback","data":{"entityId":"my-entity-id","entityType":"program","programType":"movie"},"context":{"source":"device"}}}};
        return result;
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant