API.Post

static class Post

Methods

event

static void event(RequestQueue queue, Event event, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

POST to the server a request, via /event/new, to create a new Event. Success or failure status will be passed via a NetworkResponse to the listener.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • eventEvent to create.
  • listener – Listener whose onResponse method will be called when task completes

joinEvent

static void joinEvent(RequestQueue queue, long eventId, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

Add a user to an existing event. This operation requires authentication, so the user must be logged in.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • settingsSharedPreferences instance so we can get the token.
  • eventId – ID of the event to add the user to
  • listener – Listener whose onResponse method will be called when the operation completes

joinNetwork

static void joinNetwork(RequestQueue queue, long networkId, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

Add the current user to an existing network. This operation requires authentication, so the user must be logged in.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • networkId – ID of the network to add the user to
  • listener – Listener whose onResponse method will be called when the operation completes

leaveEvent

static void leaveEvent(RequestQueue queue, long eventId, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

Removes user from event subscription listing.

Parameters:
  • queue – Queue to which network request will be added.
  • eventId – id of event to remove user from.
  • settingsSharedPreferences instance that stores token.
  • listener – Listener whose onResponse will be called when the operation completes.

leaveNetwork

static void leaveNetwork(RequestQueue queue, long networkId, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

Remove the current user from a network. This operation requires authentication, so the user must be logged in. If the user is not in the specified network, no error is thrown.

Parameters:
  • queue – Asynchronous task to which the request will be added
  • networkId – ID of the network to remove the user from
  • settings – Reference to the SharedPreferences storing the user’s login token
  • listener – Listener whose onResponse method will be called when the operation completes

post

static void post(RequestQueue queue, org.codethechange.culturemesh.models.Post post, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

POST to the server a request, via /post/new, to create a new org.codethechange.culturemesh.models.Post. Success or failure status will be passed via a NetworkResponse to the listener.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • postorg.codethechange.culturemesh.models.Post to create.
  • listener – Listener whose onResponse method will be called when task completes

reply

static void reply(RequestQueue queue, PostReply comment, SharedPreferences settings, Response.Listener<NetworkResponse<String>> listener)

POST to the server a request, via /post/{postId}/reply, to create a new PostReply. Success or failure status will be passed via a NetworkResponse to the listener.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • commentPostReply to create.
  • listener – Listener whose onResponse method will be called when task completes

user

static void user(RequestQueue queue, User user, String email, String password, Response.Listener<NetworkResponse<String>> listener)

POST to the server a request, via /user/users, to create a new user. Note that Success or failure status will be passed via a NetworkResponse to the listener.

Parameters:
  • queue – Queue to which the asynchronous task will be added
  • user – User to create. Must have password set.
  • email – User’s email address
  • listener – Listener whose onResponse method will be called when task completes