static class API.Get
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
API.Get.LoginResponse
Bundle object to store responses from getting tokens, which yield
User s, tokens,
and emails. |
Constructor and Description |
---|
Get() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
autocompleteLanguage(RequestQueue queue,
java.lang.String text,
<any> listener)
Get potential
Language s that match a user's query text |
(package private) static void |
autocompletePlace(RequestQueue queue,
java.lang.String text,
<any> listener)
Get potential
Location s that match a user's query text |
(package private) static void |
instantiatePostReplyUser(RequestQueue queue,
com.culturemesh.android.models.PostReply comment,
<any> listener)
The API will return Post JSON Objects with id's for the user.
|
(package private) static void |
instantiatePostUser(RequestQueue queue,
com.culturemesh.android.models.Post post,
<any> listener)
The API will return Post JSON Objects with id's for the user.
|
(package private) static void |
language(RequestQueue queue,
long id,
<any> listener)
Get the
Language that has the provided ID |
(package private) static void |
loginToken(RequestQueue queue,
android.content.SharedPreferences settings,
<any> listener)
Generically get a login token.
|
(package private) static void |
loginWithCred(RequestQueue queue,
java.lang.String email,
java.lang.String password,
android.content.SharedPreferences settings,
<any> listener)
Use a user's login credentials to login to the server.
|
(package private) static void |
loginWithToken(RequestQueue queue,
java.lang.String token,
android.content.SharedPreferences settings,
<any> listener)
Same as
API.Get#loginWithCred(RequestQueue, String, String, SharedPreferences,
Response.Listener) ,
but a login token is used in place of the user's credentials. |
(package private) static void |
netFromFromAndNear(RequestQueue queue,
com.culturemesh.android.models.FromLocation from,
com.culturemesh.android.models.NearLocation near,
<any> listener)
Get the
Network that has the provided FromLocation and NearLocation |
(package private) static void |
netFromLangAndNear(RequestQueue queue,
com.culturemesh.android.models.Language lang,
com.culturemesh.android.models.NearLocation near,
<any> listener)
Get the
Network that has the provided Language and NearLocation |
private static void |
netFromTwoParams(RequestQueue queue,
java.lang.String key1,
java.lang.String val1,
java.lang.String key2,
java.lang.String val2,
<any> listener)
Get the
Network that is defined by the two parameters provided |
(package private) static void |
network(RequestQueue queue,
long id,
<any> callback)
Get the
Network corresponding to the provided ID |
(package private) static void |
networkEvents(RequestQueue queue,
long id,
java.lang.String maxId,
<any> listener)
Get the
Event s corresponding to a Network |
(package private) static void |
networkPostCount(RequestQueue queue,
long id,
<any> listener)
Get the number of
Post s that are currently
on a Network |
(package private) static void |
networkPosts(RequestQueue queue,
long id,
java.lang.String maxId,
<any> listener)
Get the
Post s of a Network |
(package private) static void |
networkUserCount(RequestQueue queue,
long id,
<any> listener)
Get the number of
User s who are currently members of a Network |
(package private) static void |
networkUsers(RequestQueue queue,
long id,
<any> listener)
Get all the
User s who are members of a Network |
(package private) static void |
post(RequestQueue queue,
long id,
<any> callback)
Get a
Post from it's ID |
(package private) static void |
postReplies(RequestQueue queue,
long id,
<any> listener)
Fetch the comments of a post.
|
(package private) static void |
topTen(RequestQueue queue,
<any> listener)
Fetches the ten
Network s with the most subscribers. |
(package private) static void |
user(RequestQueue queue,
long id,
<any> listener)
Get a
User object from it's ID |
(package private) static void |
userEvents(RequestQueue queue,
long id,
java.lang.String role,
<any> listener)
Get the
Event s a User is subscribed to. |
(package private) static void |
userEventsForNetwork(RequestQueue queue,
android.content.SharedPreferences settings,
long networkId,
<any> listener)
Get the
Event s a User is subscribed to for a given Network . |
(package private) static void |
userID(RequestQueue queue,
java.lang.String email,
<any> listener)
Get the ID of a
User from an email address. |
(package private) static void |
userNetworks(RequestQueue queue,
long id,
<any> listener)
Get the networks a user belongs to
|
(package private) static void |
userPosts(RequestQueue queue,
long id,
<any> listener)
Get the
Post s a User has made. |
static void user(RequestQueue queue, long id, <any> listener)
User
object from it's IDid
- ID of user to findstatic void userID(RequestQueue queue, java.lang.String email, <any> listener)
User
from an email address. Errors are communicated via a failed
NetworkResponse
.queue
- Queue to which the asynchronous task will be addedemail
- Email of user whose ID to look uplistener
- Listener whose onResponse method is called when the task has completedstatic void networkUserCount(RequestQueue queue, long id, <any> listener)
User
s who are currently members of a Network
queue
- Queue to which the asynchronous task will be addedid
- ID of the Network
whose User
count will be retrievedlistener
- Listener whose Response.Listener#onResponse(Object)
is called with
a NetworkResponse
that stores the result of the network requeststatic void networkPostCount(RequestQueue queue, long id, <any> listener)
Post
s that are currently
on a Network
queue
- Queue to which the asynchronous task will be addedid
- ID of the Network
whose Post
count will be retrievedlistener
- Listener whose Response.Listener#onResponse(Object)
is called with
a NetworkResponse
that stores the result of the network requeststatic void userNetworks(RequestQueue queue, long id, <any> listener)
queue
- RequestQueue to which the asynchronous job will be addedid
- ID of the user whose networks will be fetchedlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with a NetworkResponse
of an ArrayList
of
Network
sstatic void userPosts(RequestQueue queue, long id, <any> listener)
Post
s a User
has made.queue
- The RequestQueue
that will house the network requests.id
- The id of the User
.listener
- The listener that the UI will call when the request is finished.static void userEvents(RequestQueue queue, long id, java.lang.String role, <any> listener)
Event
s a User
is subscribed to.queue
- Queue to which the asynchronous task is added.id
- ID of the User
whose events are being searched forrole
- Either hosting
or attending
listener
- Listener whose onResponse
method is called with the results of
the taskstatic void userEventsForNetwork(RequestQueue queue, android.content.SharedPreferences settings, long networkId, <any> listener)
Event
s a User
is subscribed to for a given Network
.queue
- Queue to which the asynchronous task is added.settings
- SharedPreferences instance storing the token.networkId
- the id of the Network
of interest.listener
- The response listener to be called when the request completes.static void network(RequestQueue queue, long id, <any> callback)
Network
corresponding to the provided IDqueue
- Queue to which the asynchronous task to get the Network
will be addedid
- ID of the Network
to getcallback
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void networkPosts(RequestQueue queue, long id, java.lang.String maxId, <any> listener)
Post
s of a Network
queue
- Queue to which the asynchronous task will be addedid
- ID of the Network
whose
Post
s will be returnedlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void networkEvents(RequestQueue queue, long id, java.lang.String maxId, <any> listener)
Event
s corresponding to a Network
queue
- Queue to which the asynchronous task will be addedid
- ID of the Network
whose Event
s will be fetchedlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void networkUsers(RequestQueue queue, long id, <any> listener)
User
s who are members of a Network
queue
- Queue to which the asynchronous task will be addedid
- ID of the Network
whose users will be fetchedlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void post(RequestQueue queue, long id, <any> callback)
Post
from it's IDqueue
- Queue to which the asynchronous task will be addedid
- ID of the Post
to retrievecallback
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void postReplies(RequestQueue queue, long id, <any> listener)
queue
- The RequestQueue
to house the network requests.id
- the id of the post that we want comments for.listener
- the listener that we will call when the request is finished.static void autocompletePlace(RequestQueue queue, java.lang.String text, <any> listener)
Location
s that match a user's query textqueue
- Queue to which the asynchronous task will be addedtext
- User's query text to get autocomplete results forlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void autocompleteLanguage(RequestQueue queue, java.lang.String text, <any> listener)
Language
s that match a user's query textqueue
- Queue to which the asynchronous task will be addedtext
- User's query text to get autocomplete results forlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void netFromLangAndNear(RequestQueue queue, com.culturemesh.android.models.Language lang, com.culturemesh.android.models.NearLocation near, <any> listener)
Network
that has the provided Language
and NearLocation
queue
- Queue to which the asynchronous task will be addedlang
- Language
of the Network
to findnear
- NearLocation
of the Network
to findlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void netFromFromAndNear(RequestQueue queue, com.culturemesh.android.models.FromLocation from, com.culturemesh.android.models.NearLocation near, <any> listener)
Network
that has the provided FromLocation
and NearLocation
queue
- Queue to which the asynchronous task will be addedfrom
- FromLocation
of the Network
to findnear
- NearLocation
of the Network
to findlistener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.private static void netFromTwoParams(RequestQueue queue, java.lang.String key1, java.lang.String val1, java.lang.String key2, java.lang.String val2, <any> listener)
Network
that is defined by the two parameters providedqueue
- Queue to which the asynchronous task will be addedkey1
- Key for a parameter defining the Network
val1
- Value associated with key1
key2
- Key for a parameter defining the Network
val2
- Value associated with key2
listener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void language(RequestQueue queue, long id, <any> listener)
Language
that has the provided IDqueue
- Queue to which the asynchronous task will be addedid
- ID of the Language
to find. Must be unique, and the same ID must be
used throughout.listener
- Listener whose com.android.volley.Response.Listener#onResponse(Object)
is called with the NetworkResponse
created by the query.static void instantiatePostUser(RequestQueue queue, com.culturemesh.android.models.Post post, <any> listener)
queue
- The Volley RequestQueue object that handles all the request queueing.post
- An already instantiated Post object that has a null author field but a defined
userId field.listener
- the UI listener that will be called when we complete the task at hand.static void instantiatePostReplyUser(RequestQueue queue, com.culturemesh.android.models.PostReply comment, <any> listener)
queue
- The Volley RequestQueue object that handles all the request queueing.comment
- An already instantiated PostReply object that has a null author field but a defined
userId field.listener
- the UI listener that will be called when we complete the task at hand.static void loginToken(RequestQueue queue, android.content.SharedPreferences settings, <any> listener)
API.TOKEN_REFRESH
seconds have passed since the last token was retrieved
the current token is simply supplied. Otherwise, an attempt
is made to login with the token to get a new one. If this fails, the token has expired,
and the user is directed to sign in again by the error dialog. If it succeeds, the new
token is stored in place of the old one.queue
- Queue to which the asynchronous task will be addedlistener
- Listener whose onResponse method will be called when task completesNetworkResponse.genErrorDialog(Context, int, boolean, NetworkResponse.DialogTapListener)
,
API.LOGIN_TOKEN
,
API.TOKEN_RETRIEVED
static void loginWithCred(RequestQueue queue, java.lang.String email, java.lang.String password, android.content.SharedPreferences settings, <any> listener)
NetworkResponse
, which will not be
in a failed state, and passed to the listener. If the credentials are rejected, the
NetworkResponse
will be in a failed state with an error message communicating
the occurrence of an authentication failure and instructing the user to sign in again.
After dismissing the error dialog, the LoginActivity
will be launched.queue
- Queue to which the asynchronous task will be addedemail
- Email address that will serve as the username in the attempted loginpassword
- Password to use in the login attemptlistener
- Will be called with the NetworkResponse
when the operation
completesNetworkResponse.genErrorDialog(Context, int, boolean, NetworkResponse.DialogTapListener)
static void loginWithToken(RequestQueue queue, java.lang.String token, android.content.SharedPreferences settings, <any> listener)
API.Get#loginWithCred(RequestQueue, String, String, SharedPreferences,
Response.Listener)
,
but a login token is used in place of the user's credentials.queue
- Queue to which the asynchronous task will be addedtoken
- Login token to use to get another tokenlistener
- Will be called with the NetworkResponse
when the operation
completesstatic void topTen(RequestQueue queue, <any> listener)
Network
s with the most subscribers.queue
- Queue to which the asynchronous task will be addedlistener
- Will be called with the NetworkResponse
when the operation
completes