Skip to content

Mutation and action response models #995

Description

@sigma67

Part of #307. Base branch: ytmusicapi-2. Read the contributor guide from #982 before starting.

The mutating and action endpoints. These currently return the raw YTM response typed as JsonDict, str | JsonDict or similar, which tells a consumer nothing about what they actually got back.

Scope

  • mixins/library.pyrate_song, rate_playlist, edit_song_library_status, subscribe_artist, subscribe_artists, unsubscribe_artists, remove_history_items
  • mixins/playlists.pycreate_playlist, edit_playlist, add_playlist_items, remove_playlist_items, delete_playlist, join_collaborative_playlist
  • mixins/uploads.pydelete_upload_entity
  • mixins/search.pyremove_search_suggestions

Watch out for

  • Several return str | JsonDict: a plain id string on success, or the raw response. That union should become something a consumer can actually branch on.
  • add_playlist_items returns different content depending on duplicates and whether source_playlist was used.
  • These endpoints are the least covered by tests and the most likely to have undocumented shapes — expect to inspect real responses rather than rely on docstrings.
  • add_history_item and upload_song return requests.Response and are explicitly out of scope for Type validation with pydantic #307.

Definition of done

  • Each listed method returns a model or a documented, narrowable union.
  • mypy --strict clean.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededv2-modelspydantic response models effort (#307)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions