feat: initial commit for the ApiAdapter class
This needs a *lot* of work to make moshidon *key compatible
This commit is contained in:
parent
3b7e11ba96
commit
eb78823cb1
|
@ -0,0 +1,45 @@
|
|||
package org.joinmastodon.android.api.adapter;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
import org.joinmastodon.android.api.requests.statuses.GetStatusByID;
|
||||
import org.joinmastodon.android.api.requests.timelines.GetHomeTimeline;
|
||||
import org.joinmastodon.android.model.Status;
|
||||
|
||||
public class ApiAdapter {
|
||||
public final ServerType serverType;
|
||||
|
||||
public ApiAdapter(ServerType serverType){
|
||||
this.serverType = serverType;
|
||||
}
|
||||
|
||||
public MastodonAPIRequest getPostById(String id){
|
||||
switch (serverType){
|
||||
case MASTODON -> {
|
||||
return new GetStatusByID(id);
|
||||
}
|
||||
case MISSKEY -> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MastodonAPIRequest getHomeTimeline(String maxID, String minID, int limit, String sinceID){
|
||||
switch (serverType){
|
||||
case MASTODON -> {
|
||||
return new GetHomeTimeline(maxID, minID, limit, sinceID);
|
||||
}
|
||||
case MISSKEY -> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public enum ServerType {
|
||||
MASTODON,
|
||||
MISSKEY,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue