public class Api extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Api.ApiData |
static class |
Api.Error |
| Constructor and Description |
|---|
Api(Api.ApiData apiData,
String accessToken,
Cache cache,
Logger logger,
FragmentParser fragmentParser)
Constructor to build a proper
Api object. |
| Modifier and Type | Method and Description |
|---|---|
static Api |
get(String url)
Entry point to get an
Api object. |
static Api |
get(String url,
String accessToken)
Entry point to get an
Api object. |
static Api |
get(String url,
String accessToken,
Cache cache,
Logger logger) |
static Api |
get(String endpoint,
String accessToken,
Cache cache,
Logger logger,
FragmentParser fragmentParser)
Entry point to get an
Api object. |
String |
getAccessToken() |
Map<String,String> |
getBookmarks()
From a properly built
Api object, returns the map associating the bookmark names to their document IDs. |
Cache |
getCache() |
Form.SearchForm |
getForm(String form)
From a properly built
Api object, return a Form object that will allow to perform queries. |
Map<String,String> |
getFormNames()
From a properly built
Api object, returns the Map of available form names. |
FragmentParser |
getFragmentParser() |
Logger |
getLogger() |
Ref |
getMaster()
From a properly built
Api object, returns the ref ID (points in a prismic.io repository's timeline,
whether in the past, in the present, or in the future) of the master ref (the one presently live). |
String |
getOAuthInitiateEndpoint() |
String |
getOAuthTokenEndpoint() |
List<Ref> |
getRefs()
From a properly built
Api object, returns the ref IDs (points in a prismic.io repository's timeline,
whether in the past, in the present, or in the future) to which the passed credentials give access. |
List<String> |
getTags()
From a properly built
Api object, returns the list of available tags. |
Map<String,String> |
getTypes()
From a properly built
Api object, returns the map associating the type names to their readable text. |
static String |
getVersion() |
public Api(Api.ApiData apiData, String accessToken, Cache cache, Logger logger, FragmentParser fragmentParser)
Api object. This is not to build an Api object
from an Api endpoint (the most usual case). In this case, you'll use the API.get method.apiData - the data retrieved from the API document, ready to be stored in memoryaccessToken - Your Oauth access token if you wish to use one (to access future content releases, for instance)cache - instance of a class that implements the Cache interface, and will handle the cachelogger - instance of a class that implements the Logger interface, and will handle the loggingfragmentParser - instance of a class that implements the FragmentParser interface, and will handle the JSON to Fragment conversion.public static String getVersion()
public static Api get(String endpoint, String accessToken, Cache cache, Logger logger, FragmentParser fragmentParser)
Api object.
Example: API api = API.get("https://lesbonneschoses.prismic.io/api", null, new Cache.BuiltInCache(999), new Logger.PrintlnLogger());endpoint - the endpoint of your prismic.io content repository, typically https://yourrepoid.prismic.io/apiaccessToken - Your Oauth access token if you wish to use one (to access future content releases, for instance)cache - instance of a class that implements the Cache interface, and will handle the cachelogger - instance of a class that implements the Logger interface, and will handle the loggingfragmentParser - instance of a class that implements the FragmentParser interface, and will handle the JSON to Fragment conversion.public static Api get(String url, String accessToken)
Api object.
Example: API api = API.get("https://lesbonneschoses.prismic.io/api", null);url - the endpoint of your prismic.io content repository, typically https://yourrepoid.prismic.io/apiaccessToken - Your Oauth access token if you wish to use one (to access future content releases, for instance)public static Api get(String url)
Api object.
Example: API api = API.get("https://lesbonneschoses.prismic.io/api");url - the endpoint of your prismic.io content repository, typically https://yourrepoid.prismic.io/apipublic Logger getLogger()
public String getAccessToken()
public Cache getCache()
public FragmentParser getFragmentParser()
public List<Ref> getRefs()
Api object, returns the ref IDs (points in a prismic.io repository's timeline,
whether in the past, in the present, or in the future) to which the passed credentials give access.public Map<String,String> getBookmarks()
Api object, returns the map associating the bookmark names to their document IDs.
Therefore, to get a bookmarked document's ID, it will look like this: api.getBookmarks().get("home")public Map<String,String> getTypes()
Api object, returns the map associating the type names to their readable text.
Therefore, to get a type's readable text, it will look like this: api.getTypes().get("blog")public List<String> getTags()
Api object, returns the list of available tags.
Therefore, to get all available tags, it will look like this: api.getTags()public Map<String,String> getFormNames()
Api object, returns the Map of available form names.public Form.SearchForm getForm(String form)
Api object, return a Form object that will allow to perform queries.
Currently, all the forms offered by prismic.io are SearchForms, but this will change.
To use it: api.get("everything").query(.....)......form - the name of the form to query onForm.SearchFormpublic Ref getMaster()
Api object, returns the ref ID (points in a prismic.io repository's timeline,
whether in the past, in the present, or in the future) of the master ref (the one presently live).public String getOAuthInitiateEndpoint()
public String getOAuthTokenEndpoint()
Copyright © 2014. All rights reserved.