twitchdev / twitch-cli

The official Twitch CLI to make developing on Twitch easier.
Apache License 2.0
604 stars 71 forks source link

Mock API updates #302

Closed aaricdev closed 9 months ago

aaricdev commented 10 months ago

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem/Feature

Sorry for the slightly bigger PR!

For my current CI, I've started using the mock API to validate my PHP Twitch API SDK implementation against an actual system. These are some problems I've encountered while comparing the mock API, Twitch API docs and my implementation.

(I've tried to compare most of it by actually throwing some calls against the prod API and also started a Postman collection and environment for this)

Description of Changes:

  1. Changed status code of PUT /chat/color from 200 to 204
  2. Fixed a typo in clip struct
  3. Renamed started_at property in predictions to created_at in json mapping
  4. Wrapped raids response when starting a raid into an array
  5. Wrapped responses from POST / PATCH /schedule/segment into actual API responses
  6. Renamed video_languageproperty of Videostruct to language
  7. Changed that gifterId/Name/Login is not omitted when isGifted == false, but just noticed, that the check user subscription works exactly the opposite way (so this should be reverted)
  8. Changed that DateRange is always sent and the way started_at works to be closer to the prod API
  9. Renamed reward_prompt to just prompt
  10. Changed that user_input will return an empty string instead of null
  11. Add points as possible property for APIResponse, returning the total for simplicities sake on /subscriptions response
  12. Changed naming of video_offset for video_muted_segment
  13. Removed timezone property for schedule segments. I've accidentally removed it from PATCH/POST body, but will put it in back in another commit
  14. Added that when removing a video, the corresponding entry in stream_markers table will be deleted, too

Open TODOs

Checklist