twitchdev/twitch-cli

Twitch CLI Mock-API - End Prediction - Response 200 but Data Prediction not Updated/Ended

Closed this issue · 0 comments

Had posted on Twitch Dev Forums but was recommended to post here as well, hope that's ok. I am unsure if this is user error or a bug.

Going through the API examples for the Prediction Lifecycle flow, and noticed that the End Prediction when using Twitch CLI is returning a Status code of 200 but not updating the Prediction at all. Is this expected behavior of the CLI Mock-Api?

Create Prediction (copied and adjusted to local host for CLI testing - All secret/client info is temp data)

curl -X POST 'http://localhost:8080/mock/predictions' \
-H 'Authorization: Bearer b2f6cf63a0e299d' \
-H 'Client-Id: 18d701582dfd7b433819ba79646edc' \
-H 'Content-Type: application/json' \
-d '{
  "broadcaster_id": "94542606",
  "title": "What is your Gender?",
  "outcomes": [
    {
      "title": "Male."
    },
    {
      "title": "Female."
    }
  ],
  "prediction_window": 120
}'

This successfully creates the Prediction.

{
    "data": [{
        "id": "6760ffdf-f129-c3d4-719c-7ddde06fda0d",
        "broadcaster_id": "94542606",
        "broadcaster_login": "komodohypedrake940",
        "broadcaster_name": "KomodoHypeDrake940",
        "title": "What is your Gender?",
        "winning_outcome_id": null,
        "prediction_window": 120,
        "status": "ACTIVE",
        "started_at": "2022-06-07T15:49:46Z",
        "ended_at": null,
        "locked_at": null,
        "outcomes": [{
            "id": "020241dc-3e92-58b7-42da-eaae02e77f07",
            "title": "Male.",
            "users": 0,
            "channel_points": 0,
            "top_predictors": null,
            "color": "BLUE"
        }, {
            "id": "a35ca554-966a-e226-4f32-31319c503544",
            "title": "Female.",
            "users": 0,
            "channel_points": 0,
            "top_predictors": null,
            "color": "PINK"
        }]
    }]
}

Next Step I try to end the Prediction with the following:

curl -X PATCH 'http://localhost:8080/mock/predictions' \
-H 'Authorization: Bearer b2f6cf63a0e299d' \
-H 'Client-Id: 18d701582dfd7b433819ba79646edc' \
-H 'Content-Type: application/json' \
-d  '{
  "broadcaster_id": "94542606",
  "id": "6760ffdf-f129-c3d4-719c-7ddde06fda0d",
  "status": "RESOLVED",
  "winning_outcome_id": "020241dc-3e92-58b7-42da-eaae02e77f07"
}'

But the Response is just returning a status code 200 success without changing the Prediction data. (double checked this by using GET Predictions as well).

{
    "data": [{
        "id": "02602652-4cad-3e25-67f7-cb3c42883a16",
        "broadcaster_id": "94542606",
        "broadcaster_login": "komodohypedrake940",
        "broadcaster_name": "KomodoHypeDrake940",
        "title": "What is your Gender?",
        "winning_outcome_id": null,
        "prediction_window": 120,
        "status": "ACTIVE",
        "started_at": "2022-06-07T15:27:07Z",
        "ended_at": null,
        "locked_at": null,
        "outcomes": [{
            "id": "58ccdd11-08ae-098d-a529-d247ff133616",
            "title": "Female.",
            "users": 0,
            "channel_points": 0,
            "top_predictors": null,
            "color": "PINK"
        }, {
            "id": "ed0c32ee-0dce-5242-c30b-61e06b3940da",
            "title": "Male.",
            "users": 0,
            "channel_points": 0,
            "top_predictors": null,
            "color": "BLUE"
        }]
    }]
}

If I list all predictions from the broadcast Id during my testing, the strange part is even the time limit isn't ending them. All test predictions are all remaining as ACTIVE with no change to their data. So that is why it seems it might be intended but I am not sure why that would be the case.