Skip to content

Instantly share code, notes, and snippets.

@rye761
Last active June 25, 2016 00:01
Show Gist options
  • Save rye761/b0bc708e8d05b66c747eabfdd3a32069 to your computer and use it in GitHub Desktop.
Save rye761/b0bc708e8d05b66c747eabfdd3a32069 to your computer and use it in GitHub Desktop.
package com.example;
import com.github.rye761.unsplash.Category;
import com.github.rye761.unsplash.Photo;
import com.github.rye761.unsplash.Stats;
import com.github.rye761.unsplash.Unsplash;
import java.util.HashMap;
public class TestOAuth {
public static void main(String[] args) {
HashMap<String, String> config = new HashMap<>();
config.put("applicationId", "your_appid");
config.put("secret", "your_secret");
config.put("callbackUrl", "urn:ietf:wg:oauth:2.0:oob");
Unsplash.getInstance().init(config);
Stats stats = Stats.total();
System.out.println(Integer.toString(stats.photoDownloads));
for (Category cat : Category.all()) {
System.out.println(cat.title);
System.out.println(cat.links.self);
}
Photo[] photos = Photo.all();
System.out.println(photos[0].urls.raw);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment