Class MemeBuilder

java.lang.Object
me.memerator.api.builder.MemeBuilder

public class MemeBuilder
extends Object
  • Constructor Summary

    Constructors 
    Constructor Description
    MemeBuilder()
    Constructor
  • Method Summary

    Modifier and Type Method Description
    org.json.JSONObject build()
    Build the JSON body.
    void setAge​(Age newAge)
    Sets the max age of the meme.
    void setCaption​(String newCaption)
    Sets the caption of the meme.
    void setImage​(String base64string)
    Sets the image of the meme to be uploaded, must be a base64 string.
    void setRating​(int newRating)
    Set the rating of the meme, when you upload it your rating will be automatically applied.
    void setUrl​(String newUrl)
    Deprecated. 

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • setUrl

      public void setUrl​(String newUrl)
      Deprecated.
      Sets the URL for the meme if uploading via URL. This or setImage() are required.
      Parameters:
      newUrl - the URL of the meme
    • setImage

      public void setImage​(String base64string)
      Sets the image of the meme to be uploaded, must be a base64 string. This or setUrl() are required.
      Parameters:
      base64string - the image in base64
    • setRating

      public void setRating​(int newRating) throws IllegalArgumentException
      Set the rating of the meme, when you upload it your rating will be automatically applied. Optional!
      Parameters:
      newRating - the rating to set
      Throws:
      IllegalArgumentException - if the rating is not valid (between 1 and 5)
    • setAge

      public void setAge​(Age newAge)
      Sets the max age of the meme. By default is TEEN.
      Parameters:
      newAge - the MaxAge to set.
    • setCaption

      public void setCaption​(String newCaption)
      Sets the caption of the meme. Optional!
      Parameters:
      newCaption - the caption to set
    • build

      public org.json.JSONObject build() throws IllegalStateException
      Build the JSON body. Used for the submitMeme() function.
      Returns:
      a Meme JSON object to be sent
      Throws:
      IllegalStateException - if a URL or Image has yet to be provided