Giter Site home page Giter Site logo

giphy4j's Introduction

Giphy4J

An unofficial Java library for the Giphy API. This project is a fork of keshrath's Discord4J with minor updates since its release.

Access and API Keys

Take a look at the Giphy API page to get your api key.

  • The public beta/test key is "dc6zaTOxFJmzC”

Example

	Giphy giphy = new Giphy(API_KEY);
	
	SearchFeed feed = giphy.search("cat", 1, 0);
	
	feed.getDataList().get(0).getImages().getOriginal().getUrl();

Rendition Guide

  • fixed_height - Height set to 200px. Good for mobile use.
  • fixed_height_still - Static preview image for fixed_height
  • fixed_height_downsampled - Height set to 200px. Reduced to 6 frames to minimize file size to the lowest. Works well for unlimited scroll on mobile and as animated previews. See Giphy.com on mobile web as an example.
  • fixed_width - Width set to 200px. Good for mobile use.
  • fixed_width_still - Static preview image for fixed_width
  • fixed_width_downsampled - Width set to 200px. Reduced to 6 frames. Works well for unlimited scroll on mobile and as animated previews.
  • fixed_height_small - Height set to 100px. Good for mobile keyboards.
  • fixed_height_small_still - Static preview image for fixed_height_small
  • fixed_width_small - Width set to 100px. Good for mobile keyboards
  • fixed_width_small_still - Static preview image for fixed_width_small
  • downsized - File size under 1.5mb.
  • downsized_still - Static preview image for downsized
  • downsized_medium - File size under 5mb.
  • downsized_large - File size under 8mb.
  • original - Original file size and file dimensions. Good for desktop use.
  • original_still - Preview image for original

How to Use

Quick showcase how to use the library.

Search Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchFeed feed = giphy.search("cat", 1, 0);
	
	feed.getDataList().get(0).getImages().getOriginal().getUrl();

Get GIF by ID Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchGiphy giphyData = giphy.searchByID("feqkVgjJpYtjy");
	
	giphyData.getData().getImages().getOriginal().getUrl();

Translate Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchGiphy giphyData = giphy.translate("superman");
	
	giphyData.getData().getImages().getOriginal().getUrl();

Random Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchRandom giphyData = giphy.searchRandom("cat");
	
	giphyData.getData().getImageOriginalUrl();

Trending GIFs Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchFeed feed = giphy.trend();
	
	feed.getDataList().get(0).getImages().getOriginal().getUrl();

STICKER Search Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchFeed feed = giphy.searchSticker("cat", 1, 0);
	
	feed.getDataList().get(0).getImages().getOriginal().getUrl();

STICKER Translate Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchGiphy giphyData = giphy.translateSticker("superman");
	
	giphyData.getData().getImages().getOriginal().getUrl();

STICKER Random Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchRandom giphyData = giphy.trendSticker("cat");
	
	giphyData.getData().getImageOriginalUrl();

STICKER Trending Endpoint

	Giphy giphy = new Giphy(API_KEY);
	
	SearchFeed feed = giphy.trendSticker();
	
	feed.getDataList().get(0).getImages().getOriginal().getUrl();

Download Giphy4J

Giphy4J can either be downloaded as a JAR file or embedded as Maven dependency.

Manual Install

Download JAR from Sonatype.org.

Maven

	<dependency>
	  <groupId>com.trievosoftware</groupId>
	  <artifactId>giphy4j</artifactId>
	  <version>1.0.0</version>
	</dependency>

Logging

Please note, this project utilizes SLF4J, this should allow a user to configure their own loggers, so no fear of this library overwriting your current logging configuration, unlike the original version of this library.

giphy4j's People

Contributors

triippz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.