public class Area extends Descriptor
Areas are a way Posts are 'grouped'.
Each user's spread and reputation is different from one Area to another. The reputation goes up and down when you do certain actions. The spread determines how many people can see your Posts, it cannot be lower than 4.
| Modifier and Type | Method and Description |
|---|---|
void |
cachedDraft(Draft draft)
Adds a Draft to the cache.
|
Optional<Post> |
cachedPost(long id)
Gets the post with the given ID from the cache.
|
CacheManager |
cacheManager()
The Cache Manager that handles this object.
|
Draft |
draft()
Creates a new Draft, that will later be converted to a Post.
|
boolean |
equals(Object o) |
int |
hashCode() |
String |
ID()
The ID of this Area, which looks like its name in all lowercase characters.
|
void |
loadDrafts()
Clears the Draft Cache and loads it again.
|
void |
loadOwnPosts()
Queries the server for the list of posts that are owned by the logged-in user.
|
String |
name()
The display name of the Area.
|
Stream<Post> |
ownPosts()
The posts owned by this user.
|
List<Post> |
ownPostsList()
The posts owned by this user.
|
Optional<Post> |
post(long id)
Gets the post with the given ID from the cache, or from the server.
|
void |
removeCached(Draft draft)
Removes a Draft from the cache.
|
OptionalInt |
reputation()
The reputation of the logged-in user, in the current area.
|
OptionalInt |
spread()
The spread of the logged-in user, in the current area.
|
String |
toString() |
void |
update()
Updates this Descriptor.
|
isNew, isValid, isValid, usepublic String ID()
This API is written so you never *need* to use IDs; so if you are not sure why this exists, you can safely ignore it.
public String name()
In future versions, the display name of the Area will be handled by the server. This has not been implemented
yet, in the meantime, we provide a method that takes the ID and adds an uppercase letter to the
beginning of each word. Since this method is temporary, we make no claim that it is performance-efficient.
public OptionalInt reputation()
The reputation increases and decreases depending on your overall actions on WildFyre. You cannot control it.
Spreadpublic OptionalInt spread()
Your spread is related to your reputation, but cannot be inferior to 4. You cannot control it.
Reputationpublic CacheManager cacheManager()
DescriptorcacheManager in class Descriptorpublic void update()
throws Request.CantConnectException,
NoSuchEntityException
DescriptorThe update is always executed in the current thread.
update in class DescriptorRequest.CantConnectExceptionNoSuchEntityExceptionpublic Optional<Post> post(long id)
If the post is cached, this method will return in constant time and launch an update job in a new thread if needed; if the post is not cached, this method will request it from the server in the current thread and only return after parsing the result.
id - the ID of the postpublic Optional<Post> cachedPost(long id)
id - the ID of the postpublic void loadDrafts()
throws Request.CantConnectException
Request.CantConnectException - if the API cannot connect to the server.public void cachedDraft(Draft draft)
Note that this method does not save the Draft server-side. If this is what you want to do, see
draft().
draft - the Draftpublic void removeCached(Draft draft)
Note that this method does not delete the Draft from the server's data. If this is what you want to do,
see Draft.delete().
draft - the draft that should be removed from the cache.More detailspublic Draft draft()
This method is a wrapper around Draft.Draft(String) to enable cleaner code without touching to IDs.
public void loadOwnPosts()
throws Request.CantConnectException
Request.CantConnectException - if the lib cannot reach the serverThe list of posts owned by the logged-in user, as a Stream,
The list of posts owned by the logged-in user, as a Listpublic List<Post> ownPostsList()
Note that you need to load them first, using loadOwnPosts(), otherwise, this method will return an
empty list.
This method internally translates the stored list of IDs to a list of posts. During this process, posts are
queried using post(long); see its documentation for more information about the use of threads.
This method as a Stream, for better performances.public Stream<Post> ownPosts()
Note that you need to load them first, using loadOwnPosts()<, otherwise, this method will return an
empty Stream./p>
This method internally translates the stored list of IDs to a list of posts. During this process, posts are
queried using post(long); see its documentation for more information about the use of threads.
This method as a List, for compatibility with the "traditionnal way".