Skip to content

Latest commit

 

History

History
151 lines (140 loc) · 2.29 KB

GraphQL.md

File metadata and controls

151 lines (140 loc) · 2.29 KB

GraphQL test query/mutation

  • Music(url): get music information from youtube url, examples:

    query {
    music(url:"https://www.youtube.com/watch?v=jL8p9vteR5g")
    { src title author thumbnail}
    } 
    query {
        finduser(username: "111") {
          username
          password 
          playlists{
            id
            name
            description
            musics{
              src
              title
              author
              thumbnail
            }
          }
        }
      }
  • signup(signupinput):

    mutation {
    signup(
      input: { username: "test", email: "test@test.t", password: "testpassword" }
    ) {
      token
      user {
        username
        playlists {
          musics {
            src
            title
            author
            thumbnail
          }
        }
        email
        avatars
        description
      }
    }
    }
  • login(email, password):

    mutation {
    login(
      email: "test@test.t",
      password: "testpassword"
    ) {
      token
      user {
        _id
        username
        playlists {
          musics {
            src
            title
            author
            thumbnail
          }
        }
        email
        avatars
        description
      }
    }
    }
  • playlistAdd(playlistInput):

    mutation{
      playlistAdd(playlist:{
        name:"p3"
        description:"new playlist3"
      }
      ) {
        id name description
        musics{
          src title author thumbnail
        }
      }
    }
  • playlistDelete(playlistid):

    mutation{
      playlistDelete(playlistid:2) {
        id name description
        musics{
          src title author thumbnail
        }
      }
    }
  • musicAdd(playlistid, musicInput):

    mutation{
      musicAdd(playlistid:1, music:{
        src:"src3"
        title: "title3"
        author: "author3"
        thumbnail: "thumbnail3"
      }
      ) {
        id name description musics{
          src title author thumbnail
        } 
      }
    }
  • musicDelete(playlistid, title):

    mutation{
      musicDelete(playlistid:1, title:"title1") {
        id name description musics{
        src title author thumbnail
        } 
      }
    }
  • searchMuisc(keyword):

    query {
    searchMusic(keyword: "lemon") {
      src
      title
      author
      thumbnail
      }
    }